[Stgt-devel] [PATCH] Fix online/offline status during backing store change.

Mark Harvey markh794
Fri Jul 18 10:10:01 CEST 2008


>From 5009444e0ca0dfaa85f72f1de391682f63cc93cb Mon Sep 17 00:00:00 2001
From: Mark Harvey <markh794 at gmail.com>
Date: Fri, 18 Jul 2008 17:50:28 +1000
Subject: device_path_update: Set status to Offline before closing backing store.

Toggle offline status before closing backing file.
Potential race ?? if other commands arrive and attempt to use backing file
after it has been closed.

Signed-off-by: Mark Harvey <markh794 at gmail.com>
---
 usr/target.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/usr/target.c b/usr/target.c
index 267a8e4..7abaa54 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -350,13 +350,13 @@ int tgt_device_path_update(struct target *target, struct scsi_lu *lu, char *path
 		if (lu->attrs.online)
 			return TGTADM_INVALID_REQUEST;
 
+		lu->dev_type_template.lu_offline(lu);
 		lu->bst->bs_close(lu);
 		free(lu->path);
 		lu->fd = 0;
 		lu->addr = 0;
 		lu->size = 0;
 		lu->path = NULL;
-		lu->dev_type_template.lu_online(lu);
 	}
 
 	path = strdup(path);
-- 
1.5.4.3





More information about the stgt mailing list