[PATCH 2/3] target: Show if configured via <so_dev>/info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



rtslib's storageobject.is_configured returns true if <dev>/info is
readable. This doesn't seem to be correct, because configfs makes the
info node right away, not when the device is configured.

This patch leaves that but returns "UNCONFIGURED" for status in /info. This
will let rtslib tell the difference between a configured and unconfigured
backstore device.

Also, only call the backstore's show_configfs_dev_params if the device has
been successfully configured.

Signed-off-by: Andy Grover <agrover@xxxxxxxxxx>
---
 drivers/target/target_core_configfs.c  |    3 ++-
 drivers/target/target_core_transport.c |    4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index 43b7ac6..49ac57e 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -1452,7 +1452,8 @@ static ssize_t target_core_show_dev_info(void *p, char *page)
 
 	transport_dump_dev_state(dev, page, &bl);
 	read_bytes += bl;
-	read_bytes += t->show_configfs_dev_params(dev, page+read_bytes);
+	if (dev->dev_flags & DF_CONFIGURED)
+		read_bytes += t->show_configfs_dev_params(dev, page+read_bytes);
 	return read_bytes;
 }
 
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index c3477fa..95b6de0 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -704,7 +704,9 @@ void transport_dump_dev_state(
 	int *bl)
 {
 	*bl += sprintf(b + *bl, "Status: ");
-	if (dev->export_count)
+	if (!(dev->dev_flags & DF_CONFIGURED))
+		*bl += sprintf(b + *bl, "UNCONFIGURED");
+	else if (dev->export_count)
 		*bl += sprintf(b + *bl, "ACTIVATED");
 	else
 		*bl += sprintf(b + *bl, "DEACTIVATED");
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux