target: Drop se_subsystem_api->[write_cache,fua_write]_emulated flags
authorNicholas Bellinger <nab@linux-iscsi.org>
Sun, 26 Aug 2012 20:35:58 +0000 (13:35 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Tue, 18 Sep 2012 00:13:34 +0000 (17:13 -0700)
This patch drops se_subsystem_api->[write_cache,fua_write]_emulated flags
set by viritual FILEIO/IBLOCK/RD_MCP backend drivers in favor of explict
TRANSPORT_PLUGIN_PHBA_PDEV checks to know when to fail if userspace is
attempting to set virtual emulation bits for an pSCSI (passthrough)
backend device.

Reported-by: Christoph Hellwig <hch@lst.de>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_device.c
drivers/target/target_core_file.c
drivers/target/target_core_iblock.c
drivers/target/target_core_rd.c
include/target/target_core_backend.h

index 2d0353355ebd9ace557b604beef2ce96440ba0d5..8d774da16320707cb81f525f511188ff202c57ae 100644 (file)
@@ -988,8 +988,9 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag)
                return -EINVAL;
        }
 
-       if (flag && dev->transport->fua_write_emulated == 0) {
-               pr_err("fua_write_emulated not supported\n");
+       if (flag &&
+           dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) {
+               pr_err("emulate_fua_write not supported for pSCSI\n");
                return -EINVAL;
        }
        dev->se_sub_dev->se_dev_attrib.emulate_fua_write = flag;
@@ -1019,8 +1020,9 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag)
                pr_err("Illegal value %d\n", flag);
                return -EINVAL;
        }
-       if (flag && dev->transport->write_cache_emulated == 0) {
-               pr_err("write_cache_emulated not supported\n");
+       if (flag &&
+           dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) {
+               pr_err("emulate_write_cache not supported for pSCSI\n");
                return -EINVAL;
        }
        dev->se_sub_dev->se_dev_attrib.emulate_write_cache = flag;
index cbb5aaf3e567f5d52f552cc940f3e9556ac8ee40..11119257e514bb6daaf3b674ad0b3831680f2448 100644 (file)
@@ -546,8 +546,6 @@ static struct se_subsystem_api fileio_template = {
        .name                   = "fileio",
        .owner                  = THIS_MODULE,
        .transport_type         = TRANSPORT_PLUGIN_VHBA_PDEV,
-       .write_cache_emulated   = 1,
-       .fua_write_emulated     = 1,
        .attach_hba             = fd_attach_hba,
        .detach_hba             = fd_detach_hba,
        .allocate_virtdevice    = fd_allocate_virtdevice,
index 0f6ece80bffee8709d07f341d2c5230ef6212971..5b745bb56a684ffbe85a09ef9239f8ce6959d44b 100644 (file)
@@ -766,8 +766,6 @@ static struct se_subsystem_api iblock_template = {
        .name                   = "iblock",
        .owner                  = THIS_MODULE,
        .transport_type         = TRANSPORT_PLUGIN_VHBA_PDEV,
-       .write_cache_emulated   = 1,
-       .fua_write_emulated     = 1,
        .attach_hba             = iblock_attach_hba,
        .detach_hba             = iblock_detach_hba,
        .allocate_virtdevice    = iblock_allocate_virtdevice,
index 58bcc870366fda650aec8a10fd8556a091915468..d00bbe33ff8b285f7777eaaf420d802e589169c2 100644 (file)
@@ -474,7 +474,6 @@ static int rd_parse_cdb(struct se_cmd *cmd)
 static struct se_subsystem_api rd_mcp_template = {
        .name                   = "rd_mcp",
        .transport_type         = TRANSPORT_PLUGIN_VHBA_VDEV,
-       .write_cache_emulated   = 1,
        .attach_hba             = rd_attach_hba,
        .detach_hba             = rd_detach_hba,
        .allocate_virtdevice    = rd_allocate_virtdevice,
index 941c84bf1065f406cfbc3eeb5f4b09e4fdcd58ec..2acd54018b64dd60a271ebd618fc02a0634e1b85 100644 (file)
@@ -13,9 +13,6 @@ struct se_subsystem_api {
 
        u8 transport_type;
 
-       unsigned int fua_write_emulated : 1;
-       unsigned int write_cache_emulated : 1;
-
        int (*attach_hba)(struct se_hba *, u32);
        void (*detach_hba)(struct se_hba *);
        int (*pmode_enable_hba)(struct se_hba *, unsigned long);