Skip to contentSkip to conversation

Handle SCSI device states "quiesce" and "transport-offline" properly

PATCH Applied Bart Van Assche 3 participants 3 messages Feb 14, 2013 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Handle SCSI device states "quiesce" and "transport-offline" properly

---
 libmultipath/discovery.c |    5 +++--
 libmultipath/structs.h   |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
libmultipath/discovery.c +3 -2
index 3fbc181..0b5fd1d 100644
@@ -797,12 +797,13 @@ path_offline (struct path * pp)
 
 	condlog(3, "%s: path state = %s", pp->dev, buff);
 
-	if (!strncmp(buff, "offline", 7)) {
+	if (!strncmp(buff, "offline", 7) ||
+	    !strncmp(buff, "transport-offline", 17)) {
 		pp->offline = 1;
 		return PATH_DOWN;
 	}
 	pp->offline = 0;
-	if (!strncmp(buff, "blocked", 7))
+	if (!strncmp(buff, "blocked", 7) || !strncmp(buff, "quiesce", 7))
 		return PATH_PENDING;
 	else if (!strncmp(buff, "running", 7))
 		return PATH_UP;
libmultipath/structs.h +1 -1
index ab05a78..b9ace36 100644
@@ -20,7 +20,7 @@
 #define SCSI_VENDOR_SIZE	9
 #define SCSI_PRODUCT_SIZE	17
 #define SCSI_REV_SIZE		5
-#define SCSI_STATE_SIZE		9
+#define SCSI_STATE_SIZE		19
 
 #define NO_PATH_RETRY_UNDEF	0
 #define NO_PATH_RETRY_FAIL	-1
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#1 lore raw

Patch looks ok to me. When I added transport-offline to scsi-ml, I forgot to modify userspace apps. Thanks for fixing.

For the second part, I think it makes sense to handle quiesce like blocked since drivers use that state like how fc/iscsi use blocked.

Quoted 40 lines · Bart Van Assche
---
 libmultipath/discovery.c |    5 +++--
 libmultipath/structs.h   |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
libmultipath/discovery.c +3 -2
index 3fbc181..0b5fd1d 100644
@@ -797,12 +797,13 @@ path_offline (struct path * pp)
 
 	condlog(3, "%s: path state = %s", pp->dev, buff);
 
-	if (!strncmp(buff, "offline", 7)) {
+	if (!strncmp(buff, "offline", 7) ||
+	    !strncmp(buff, "transport-offline", 17)) {
 		pp->offline = 1;
 		return PATH_DOWN;
 	}
 	pp->offline = 0;
-	if (!strncmp(buff, "blocked", 7))
+	if (!strncmp(buff, "blocked", 7) || !strncmp(buff, "quiesce", 7))
 		return PATH_PENDING;
 	else if (!strncmp(buff, "running", 7))
 		return PATH_UP;
libmultipath/structs.h +1 -1
index ab05a78..b9ace36 100644
@@ -20,7 +20,7 @@
 #define SCSI_VENDOR_SIZE	9
 #define SCSI_PRODUCT_SIZE	17
 #define SCSI_REV_SIZE		5
-#define SCSI_STATE_SIZE		9
+#define SCSI_STATE_SIZE		19
 
 #define NO_PATH_RETRY_UNDEF	0
 #define NO_PATH_RETRY_FAIL	-1
#2 lore raw
In reply to Bart Van Assche
Quoted 2 lines · Bart Van Assche

---

Applied.

Thanks,
Christophe Varoqui
www.opensvc.com

Quoted 37 lines
 libmultipath/discovery.c |    5 +++--
 libmultipath/structs.h   |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
libmultipath/discovery.c +3 -2
index 3fbc181..0b5fd1d 100644
@@ -797,12 +797,13 @@ path_offline (struct path * pp)
 
 	condlog(3, "%s: path state = %s", pp->dev, buff);
 
-	if (!strncmp(buff, "offline", 7)) {
+	if (!strncmp(buff, "offline", 7) ||
+	    !strncmp(buff, "transport-offline", 17)) {
 		pp->offline = 1;
 		return PATH_DOWN;
 	}
 	pp->offline = 0;
-	if (!strncmp(buff, "blocked", 7))
+	if (!strncmp(buff, "blocked", 7) || !strncmp(buff, "quiesce", 7))
 		return PATH_PENDING;
 	else if (!strncmp(buff, "running", 7))
 		return PATH_UP;
libmultipath/structs.h +1 -1
index ab05a78..b9ace36 100644
@@ -20,7 +20,7 @@
 #define SCSI_VENDOR_SIZE	9
 #define SCSI_PRODUCT_SIZE	17
 #define SCSI_REV_SIZE		5
-#define SCSI_STATE_SIZE		9
+#define SCSI_STATE_SIZE		19
 
 #define NO_PATH_RETRY_UNDEF	0
 #define NO_PATH_RETRY_FAIL	-1