Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

target: Drop se_subsystem_api->[write_cache,fua_write]_emulated flags

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>

+6 -12
+6 -4
drivers/target/target_core_device.c
··· 988 988 return -EINVAL; 989 989 } 990 990 991 - if (flag && dev->transport->fua_write_emulated == 0) { 992 - pr_err("fua_write_emulated not supported\n"); 991 + if (flag && 992 + dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) { 993 + pr_err("emulate_fua_write not supported for pSCSI\n"); 993 994 return -EINVAL; 994 995 } 995 996 dev->se_sub_dev->se_dev_attrib.emulate_fua_write = flag; ··· 1020 1019 pr_err("Illegal value %d\n", flag); 1021 1020 return -EINVAL; 1022 1021 } 1023 - if (flag && dev->transport->write_cache_emulated == 0) { 1024 - pr_err("write_cache_emulated not supported\n"); 1022 + if (flag && 1023 + dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) { 1024 + pr_err("emulate_write_cache not supported for pSCSI\n"); 1025 1025 return -EINVAL; 1026 1026 } 1027 1027 dev->se_sub_dev->se_dev_attrib.emulate_write_cache = flag;
-2
drivers/target/target_core_file.c
··· 546 546 .name = "fileio", 547 547 .owner = THIS_MODULE, 548 548 .transport_type = TRANSPORT_PLUGIN_VHBA_PDEV, 549 - .write_cache_emulated = 1, 550 - .fua_write_emulated = 1, 551 549 .attach_hba = fd_attach_hba, 552 550 .detach_hba = fd_detach_hba, 553 551 .allocate_virtdevice = fd_allocate_virtdevice,
-2
drivers/target/target_core_iblock.c
··· 766 766 .name = "iblock", 767 767 .owner = THIS_MODULE, 768 768 .transport_type = TRANSPORT_PLUGIN_VHBA_PDEV, 769 - .write_cache_emulated = 1, 770 - .fua_write_emulated = 1, 771 769 .attach_hba = iblock_attach_hba, 772 770 .detach_hba = iblock_detach_hba, 773 771 .allocate_virtdevice = iblock_allocate_virtdevice,
-1
drivers/target/target_core_rd.c
··· 474 474 static struct se_subsystem_api rd_mcp_template = { 475 475 .name = "rd_mcp", 476 476 .transport_type = TRANSPORT_PLUGIN_VHBA_VDEV, 477 - .write_cache_emulated = 1, 478 477 .attach_hba = rd_attach_hba, 479 478 .detach_hba = rd_detach_hba, 480 479 .allocate_virtdevice = rd_allocate_virtdevice,
-3
include/target/target_core_backend.h
··· 13 13 14 14 u8 transport_type; 15 15 16 - unsigned int fua_write_emulated : 1; 17 - unsigned int write_cache_emulated : 1; 18 - 19 16 int (*attach_hba)(struct se_hba *, u32); 20 17 void (*detach_hba)(struct se_hba *); 21 18 int (*pmode_enable_hba)(struct se_hba *, unsigned long);