[PATCH 27/32] target: Move call to remove_lun to the release function from drop_link

2013-12-13 Thread Andy Grover
Configfs is still using the memory until release() is called, so it's not
safe to free it in drop_link().

Signed-off-by: Andy Grover 
---
 drivers/target/target_core_fabric_configfs.c |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/target/target_core_fabric_configfs.c 
b/drivers/target/target_core_fabric_configfs.c
index 45a1763..1e584fa 100644
--- a/drivers/target/target_core_fabric_configfs.c
+++ b/drivers/target/target_core_fabric_configfs.c
@@ -809,11 +809,19 @@ static int target_fabric_port_unlink(
tf->tf_ops.fabric_pre_unlink(se_tpg, lun);
}
 
-   core_tpg_remove_lun(se_tpg, lun);
return 0;
 }
 
+static void target_fabric_release_lun(struct config_item *item)
+{
+   struct se_lun *lun = container_of(to_config_group(item),
+   struct se_lun, lun_group);
+
+   core_tpg_remove_lun(lun->lun_tpg, lun);
+}
+
 static struct configfs_item_operations target_fabric_port_item_ops = {
+   .release= target_fabric_release_lun,
.show_attribute = target_fabric_port_attr_show,
.store_attribute= target_fabric_port_attr_store,
.allow_link = target_fabric_port_link,
-- 
1.7.1

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


Re: [PATCH 27/32] target: Move call to remove_lun to the release function from drop_link

2013-12-16 Thread Nicholas A. Bellinger
On Fri, 2013-12-13 at 15:59 -0800, Andy Grover wrote:
> Configfs is still using the memory until release() is called, so it's not
> safe to free it in drop_link().
> 
> Signed-off-by: Andy Grover 
> ---
>  drivers/target/target_core_fabric_configfs.c |   10 +-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 

No longer is applicable, given the previous NAKs.

--nab

> diff --git a/drivers/target/target_core_fabric_configfs.c 
> b/drivers/target/target_core_fabric_configfs.c
> index 45a1763..1e584fa 100644
> --- a/drivers/target/target_core_fabric_configfs.c
> +++ b/drivers/target/target_core_fabric_configfs.c
> @@ -809,11 +809,19 @@ static int target_fabric_port_unlink(
>   tf->tf_ops.fabric_pre_unlink(se_tpg, lun);
>   }
>  
> - core_tpg_remove_lun(se_tpg, lun);
>   return 0;
>  }
>  
> +static void target_fabric_release_lun(struct config_item *item)
> +{
> + struct se_lun *lun = container_of(to_config_group(item),
> + struct se_lun, lun_group);
> +
> + core_tpg_remove_lun(lun->lun_tpg, lun);
> +}
> +
>  static struct configfs_item_operations target_fabric_port_item_ops = {
> + .release= target_fabric_release_lun,
>   .show_attribute = target_fabric_port_attr_show,
>   .store_attribute= target_fabric_port_attr_store,
>   .allow_link = target_fabric_port_link,


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