target: Ensure sess_prot_type is saved across session restart
authorNicholas Bellinger <nab@linux-iscsi.org>
Tue, 14 Apr 2015 18:52:22 +0000 (11:52 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Thu, 16 Apr 2015 05:46:30 +0000 (22:46 -0700)
The following incremental patch saves the current sess_prot_type into
se_node_acl, and will always reset sess_prot_type if a previous saved
value exists.  So the PI setting for the fabric's session with backend
devices not supporting PI is persistent across session restart.

(Fix se_node_acl dereference for discovery sessions - DanCarpenter)

Reviewed-by: Martin Petersen <martin.petersen@oracle.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_transport.c
include/target/target_core_base.h

index 4edb183cf8dfaf8e804f6ff8e2ba6feb6e3a7463..14e324991c34933acdab3d88f058e4d8f00a87eb 100644 (file)
@@ -327,13 +327,6 @@ void __transport_register_session(
 
        se_sess->se_tpg = se_tpg;
        se_sess->fabric_sess_ptr = fabric_sess_ptr;
-       /*
-        * Determine if fabric allows for T10-PI feature bits to be exposed
-        * to initiators for device backends with !dev->dev_attrib.pi_prot_type
-        */
-       if (tfo->tpg_check_prot_fabric_only)
-               se_sess->sess_prot_type = tfo->tpg_check_prot_fabric_only(se_tpg);
-
        /*
         * Used by struct se_node_acl's under ConfigFS to locate active se_session-t
         *
@@ -341,6 +334,21 @@ void __transport_register_session(
         * eg: *NOT* discovery sessions.
         */
        if (se_nacl) {
+               /*
+                *
+                * Determine if fabric allows for T10-PI feature bits exposed to
+                * initiators for device backends with !dev->dev_attrib.pi_prot_type.
+                *
+                * If so, then always save prot_type on a per se_node_acl node
+                * basis and re-instate the previous sess_prot_type to avoid
+                * disabling PI from below any previously initiator side
+                * registered LUNs.
+                */
+               if (se_nacl->saved_prot_type)
+                       se_sess->sess_prot_type = se_nacl->saved_prot_type;
+               else if (tfo->tpg_check_prot_fabric_only)
+                       se_sess->sess_prot_type = se_nacl->saved_prot_type =
+                                       tfo->tpg_check_prot_fabric_only(se_tpg);
                /*
                 * If the fabric module supports an ISID based TransportID,
                 * save this value in binary from the fabric I_T Nexus now.
index e1de142b7b071268919adea7e41141969cf6650f..480e9f82dfea861a70fa5e1df45076770c719f2e 100644 (file)
@@ -589,6 +589,7 @@ struct se_node_acl {
        bool                    acl_stop:1;
        u32                     queue_depth;
        u32                     acl_index;
+       enum target_prot_type   saved_prot_type;
 #define MAX_ACL_TAG_SIZE 64
        char                    acl_tag[MAX_ACL_TAG_SIZE];
        /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */
This page took 0.030518 seconds and 5 git commands to generate.