tcm: Drop struct se_subsystem_api->create_virtdevice_from_fd()
Subsystems (2)
PATCH 1/1 tcm: Drop struct se_subsystem_api->create_virtdevice_from_fd()
From: Nicholas Bellinger <[email protected]>
This patch removes the SSA->create_virtdevice_from_fd() API op that was originally used by TCM/IBLOCK and TCM/pSCSI to perform backstore assocation using a user -> kernel passed file descriptor. This is now considered an unsafe method and this patch converts the last remaining user of this code (TCM/IBLOCK) to enforce the usage of open_bdev_exclusive() from a passed udev_path= within target_core_iblock:iblock_create_virtdevice().
Note that this change does break TCM/IBLOCK v3.x userspace code with TCM v4.0 code which currently assumes generic TCM/ConfigFS file descriptor association support with IBLOCK backstores.
--- drivers/target/target_core_configfs.c | 48 +------------- drivers/target/target_core_iblock.c | 118 ++++---------------------------- drivers/target/target_core_pscsi.c | 1 - drivers/target/target_core_stgt.c | 1 - include/target/target_core_transport.h | 5 -- 5 files changed, 16 insertions(+), 157 deletions(-)
drivers/target/target_core_configfs.c +1 -47
@@ -1930,48 +1930,6 @@ static struct target_core_configfs_attribute target_core_attr_dev_control = { .store = target_core_store_dev_control, }; -static ssize_t target_core_store_dev_fd (void *p,const char *page,size_t count) -{ -struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p; -struct se_device *dev; -struct se_hba *hba = se_dev->se_dev_hba; -struct se_subsystem_api *t = hba->transport; - -if (se_dev->se_dev_ptr) { -printk (KERN_ERR "se_dev->se_dev_ptr already set, ignoring" -" fd request\n" ); -return -EEXIST ; - } - -if (!(t->create_virtdevice_from_fd)) { -printk (KERN_ERR "struct se_subsystem_api->create_virtdevice_from" -"_fd() NULL for: %s\n" , hba->transport->name); -return -EINVAL ; - } -/* -* The subsystem PLUGIN is responsible for calling target_core_mod -* symbols to claim the underlying struct block_device for TYPE_DISK. -*/ - dev = t->create_virtdevice_from_fd (se_dev, page); -if (!(dev) ||IS_ERR (dev)) - goto out; - - se_dev->se_dev_ptr = dev; -printk (KERN_INFO "Target_Core_ConfigFS: Registered %s se_dev->se_dev" -"_ptr: %p from fd\n" , hba->transport->name, se_dev->se_dev_ptr); -return count; -out: -return -EINVAL ; -} - -static struct target_core_configfs_attribute target_core_attr_dev_fd = { - .attr = { .ca_owner =THIS_MODULE , - .ca_name ="fd" , - .ca_mode =S_IWUSR }, - .show =NULL , - .store = target_core_store_dev_fd, -}; -static ssize_t target_core_show_dev_alias (void *p,char *page) {struct se_subsystem_dev *se_dev = (struct se_subsystem_dev *)p;
@@ -2252,7 +2210,6 @@ static struct target_core_configfs_attribute target_core_attr_dev_alua_lu_gp = {static struct configfs_attribute *lio_core_dev_attrs[] = { &target_core_attr_dev_info.attr, &target_core_attr_dev_control.attr, - &target_core_attr_dev_fd.attr, &target_core_attr_dev_alias.attr, &target_core_attr_dev_udev_path.attr, &target_core_attr_dev_enable.attr,
@@ -2992,10 +2949,7 @@ static struct config_group *target_core_call_createdev(* * se_dev->se_dev_ptr will be set after ->create_virtdev() * has been called successfully in the next level up in the -* configfs tree for device object's struct config_group. This -* pointer is set in target_core_store_dev_fd() and -* target_core_store_dev_enable() above depending upon the -* reference method for struct scsi_device. +* configfs tree for device object's struct config_group. */ se_dev->se_dev_su_ptr = t->allocate_virtdevice (hba, name);if (!(se_dev->se_dev_su_ptr)) {
drivers/target/target_core_iblock.c +15 -103
137 lines not on this page · raw message
drivers/target/target_core_pscsi.c +0 -1
@@ -1567,7 +1567,6 @@ static struct se_subsystem_api pscsi_template = { .check_configfs_dev_params = pscsi_check_configfs_dev_params, .set_configfs_dev_params = pscsi_set_configfs_dev_params, .show_configfs_dev_params = pscsi_show_configfs_dev_params, - .create_virtdevice_from_fd = NULL, .get_plugin_info = pscsi_get_plugin_info, .get_hba_info = pscsi_get_hba_info, .get_dev_info = pscsi_get_dev_info,
drivers/target/target_core_stgt.c +0 -1
@@ -930,7 +930,6 @@ static struct se_subsystem_api stgt_template = { .check_configfs_dev_params = stgt_check_configfs_dev_params, .set_configfs_dev_params = stgt_set_configfs_dev_params, .show_configfs_dev_params = stgt_show_configfs_dev_params, - .create_virtdevice_from_fd = NULL, .plugin_init = stgt_plugin_init, .plugin_free = stgt_plugin_free, .get_plugin_info = stgt_get_plugin_info,
include/target/target_core_transport.h +0 -5
@@ -496,11 +496,6 @@ struct se_subsystem_api {ssize_t (*show_configfs_dev_params)(struct se_hba *,struct se_subsystem_dev *,char *);/* -* create_virtdevice_from-fd(): -*/ -struct se_device *(*create_virtdevice_from_fd)(struct se_subsystem_dev *, -const char *); -/* * plugin_init(): */ int (*plugin_init)(void );
Signature · 1 line
1.5.6.5