target: make close_session optional
authorChristoph Hellwig <hch@lst.de>
Mon, 2 May 2016 13:45:22 +0000 (15:45 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Tue, 10 May 2016 08:19:26 +0000 (01:19 -0700)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Documentation/target/tcm_mod_builder.py
drivers/target/loopback/tcm_loop.c
drivers/target/sbp/sbp_target.c
drivers/target/target_core_configfs.c
drivers/target/target_core_transport.c
drivers/usb/gadget/function/f_tcm.c
drivers/vhost/scsi.c
drivers/xen/xen-scsiback.c

index 6b8aa4086c5dc55a7b7de8c6eb2a0e28ef794a5b..94bf6944bb1e412b85f649aab136155052092e29 100755 (executable)
@@ -294,7 +294,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name):
        buf += "        .tpg_check_prod_mode_write_protect = " + fabric_mod_name + "_check_false,\n"
        buf += "        .tpg_get_inst_index             = " + fabric_mod_name + "_tpg_get_inst_index,\n"
        buf += "        .release_cmd                    = " + fabric_mod_name + "_release_cmd,\n"
-       buf += "        .close_session                  = " + fabric_mod_name + "_close_session,\n"
        buf += "        .sess_get_index                 = " + fabric_mod_name + "_sess_get_index,\n"
        buf += "        .sess_get_initiator_sid         = NULL,\n"
        buf += "        .write_pending                  = " + fabric_mod_name + "_write_pending,\n"
@@ -466,13 +465,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name):
                        buf += "}\n\n"
                        bufi += "void " + fabric_mod_name + "_release_cmd(struct se_cmd *);\n"
 
-               if re.search('close_session\)\(', fo):
-                       buf += "void " + fabric_mod_name + "_close_session(struct se_session *se_sess)\n"
-                       buf += "{\n"
-                       buf += "        return;\n"
-                       buf += "}\n\n"
-                       bufi += "void " + fabric_mod_name + "_close_session(struct se_session *);\n"
-
                if re.search('sess_get_index\)\(', fo):
                        buf += "u32 " + fabric_mod_name + "_sess_get_index(struct se_session *se_sess)\n"
                        buf += "{\n"
index 0941b2c13f5ab97e9e852e81674d3bb30241924f..5091b31b3e56b4e335b13fec53d34a7a84a29345 100644 (file)
@@ -601,11 +601,6 @@ static int tcm_loop_get_cmd_state(struct se_cmd *se_cmd)
        return tl_cmd->sc_cmd_state;
 }
 
-static void tcm_loop_close_session(struct se_session *se_sess)
-{
-       return;
-};
-
 static int tcm_loop_write_pending(struct se_cmd *se_cmd)
 {
        /*
@@ -1238,7 +1233,6 @@ static const struct target_core_fabric_ops loop_ops = {
        .tpg_get_inst_index             = tcm_loop_get_inst_index,
        .check_stop_free                = tcm_loop_check_stop_free,
        .release_cmd                    = tcm_loop_release_cmd,
-       .close_session                  = tcm_loop_close_session,
        .sess_get_index                 = tcm_loop_sess_get_index,
        .write_pending                  = tcm_loop_write_pending,
        .write_pending_status           = tcm_loop_write_pending_status,
index 6c8b8f84a0478546d8cb43ef8d923126aa11fae2..58bb6ed181853b49370d9fda31f73e7bd24c7fda 100644 (file)
@@ -1726,11 +1726,6 @@ static void sbp_release_cmd(struct se_cmd *se_cmd)
        sbp_free_request(req);
 }
 
-static void sbp_close_session(struct se_session *se_sess)
-{
-       return;
-}
-
 static u32 sbp_sess_get_index(struct se_session *se_sess)
 {
        return 0;
@@ -2344,7 +2339,6 @@ static const struct target_core_fabric_ops sbp_ops = {
        .tpg_check_prod_mode_write_protect = sbp_check_false,
        .tpg_get_inst_index             = sbp_tpg_get_inst_index,
        .release_cmd                    = sbp_release_cmd,
-       .close_session                  = sbp_close_session,
        .sess_get_index                 = sbp_sess_get_index,
        .write_pending                  = sbp_write_pending,
        .write_pending_status           = sbp_write_pending_status,
index 75c5000ca95e646efd4996c6c198c095f8015d1a..2001005bef45845dc45fdbf1e4bebf8c82d84fc5 100644 (file)
@@ -385,10 +385,6 @@ static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo)
                pr_err("Missing tfo->release_cmd()\n");
                return -EINVAL;
        }
-       if (!tfo->close_session) {
-               pr_err("Missing tfo->close_session()\n");
-               return -EINVAL;
-       }
        if (!tfo->sess_get_index) {
                pr_err("Missing tfo->sess_get_index()\n");
                return -EINVAL;
index ccd3a0eda0c8755810639993947e235275f0180c..2914d4c68fea6eb9a10560248c288b0b12e79455 100644 (file)
@@ -436,7 +436,8 @@ static void target_release_session(struct kref *kref)
                        struct se_session, sess_kref);
        struct se_portal_group *se_tpg = se_sess->se_tpg;
 
-       se_tpg->se_tpg_tfo->close_session(se_sess);
+       if (se_tpg->se_tpg_tfo->close_session)
+               se_tpg->se_tpg_tfo->close_session(se_sess);
 }
 
 int target_get_session(struct se_session *se_sess)
index f4ed427e04ced9e36367ffb337a896d4393fea03..35fe3c80cfc09a432cd4793a9ea125781bf4525f 100644 (file)
@@ -1290,10 +1290,6 @@ static void usbg_release_cmd(struct se_cmd *se_cmd)
        percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
 }
 
-static void usbg_close_session(struct se_session *se_sess)
-{
-}
-
 static u32 usbg_sess_get_index(struct se_session *se_sess)
 {
        return 0;
@@ -1730,7 +1726,6 @@ static const struct target_core_fabric_ops usbg_ops = {
        .tpg_check_prod_mode_write_protect = usbg_check_false,
        .tpg_get_inst_index             = usbg_tpg_get_inst_index,
        .release_cmd                    = usbg_release_cmd,
-       .close_session                  = usbg_close_session,
        .sess_get_index                 = usbg_sess_get_index,
        .sess_get_initiator_sid         = NULL,
        .write_pending                  = usbg_send_write_request,
index d2c60e5c48b312a9789766e5108028830615bd1a..9d6320e8ff3e07f55f9229ea9138624a09b6b488 100644 (file)
@@ -333,11 +333,6 @@ static void vhost_scsi_release_cmd(struct se_cmd *se_cmd)
        percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
 }
 
-static void vhost_scsi_close_session(struct se_session *se_sess)
-{
-       return;
-}
-
 static u32 vhost_scsi_sess_get_index(struct se_session *se_sess)
 {
        return 0;
@@ -2109,7 +2104,6 @@ static struct target_core_fabric_ops vhost_scsi_ops = {
        .tpg_get_inst_index             = vhost_scsi_tpg_get_inst_index,
        .release_cmd                    = vhost_scsi_release_cmd,
        .check_stop_free                = vhost_scsi_check_stop_free,
-       .close_session                  = vhost_scsi_close_session,
        .sess_get_index                 = vhost_scsi_sess_get_index,
        .sess_get_initiator_sid         = NULL,
        .write_pending                  = vhost_scsi_write_pending,
index 783947a272ab3503ed7ae2e7ab9a9bd8bc6ddb0a..d6950e0802b7df16b8fe5084fe4008104c19df61 100644 (file)
@@ -1399,10 +1399,6 @@ static void scsiback_release_cmd(struct se_cmd *se_cmd)
        percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
 }
 
-static void scsiback_close_session(struct se_session *se_sess)
-{
-}
-
 static u32 scsiback_sess_get_index(struct se_session *se_sess)
 {
        return 0;
@@ -1836,7 +1832,6 @@ static const struct target_core_fabric_ops scsiback_ops = {
        .tpg_get_inst_index             = scsiback_tpg_get_inst_index,
        .check_stop_free                = scsiback_check_stop_free,
        .release_cmd                    = scsiback_release_cmd,
-       .close_session                  = scsiback_close_session,
        .sess_get_index                 = scsiback_sess_get_index,
        .sess_get_initiator_sid         = NULL,
        .write_pending                  = scsiback_write_pending,