Whamcloud - gitweb
LU-3928 ost: update OST export connection flags 11/7611/4
authorAlexander.Boyko <alexander_boyko@xyratex.com>
Wed, 11 Sep 2013 08:44:14 +0000 (12:44 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 24 Sep 2013 14:56:11 +0000 (14:56 +0000)
LU-1623 introduce atomically update export connection flags for MDT.
The same issue exist for OST. In any case the flags would be updated
for export, even if error handling code path occured.

Signed-off-by: Alexander Boyko <alexander_boyko@xyratex.com>
Xyratex-bug-id: MRP-1306
Change-Id: I4f93ff88cd94467cfe6d6fdb9d7214c727c43db2
Reviewed-on: http://review.whamcloud.com/7611
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ofd/ofd_obd.c
lustre/ost/ost_handler.c

index aa2c48a..55ba8d0 100644 (file)
@@ -137,7 +137,6 @@ static int ofd_parse_connect_data(const struct lu_env *env,
        fed->fed_group = data->ocd_group;
 
        data->ocd_connect_flags &= OST_CONNECT_SUPPORTED;
-       exp->exp_connect_data = *data;
        data->ocd_version = LUSTRE_VERSION_CODE;
 
        /* Kindly make sure the SKIP_ORPHAN flag is from MDS. */
@@ -156,7 +155,7 @@ static int ofd_parse_connect_data(const struct lu_env *env,
                data->ocd_grant_extent = ofd->ofd_dt_conf.ddp_grant_frag >> 10;
        }
 
-       if (exp_connect_flags(exp) & OBD_CONNECT_GRANT)
+       if (data->ocd_connect_flags & OBD_CONNECT_GRANT)
                data->ocd_grant = ofd_grant_connect(env, exp, data->ocd_grant,
                                                    new_connection);
 
index a3ee3dc..906421b 100644 (file)
@@ -1559,14 +1559,11 @@ static int ost_llog_handle_connect(struct obd_export *exp,
         RETURN(rc);
 }
 
-#define ost_init_sec_none(reply, exp)                                  \
+#define ost_init_sec_none(reply)                                       \
 do {                                                                   \
        reply->ocd_connect_flags &= ~(OBD_CONNECT_RMT_CLIENT |          \
                                      OBD_CONNECT_RMT_CLIENT_FORCE |    \
                                      OBD_CONNECT_OSS_CAPA);            \
-       spin_lock(&exp->exp_lock);                                      \
-       *exp_connect_flags_ptr(exp) = reply->ocd_connect_flags;         \
-       spin_unlock(&exp->exp_lock);                                    \
 } while (0)
 
 static int ost_init_sec_level(struct ptlrpc_request *req)
@@ -1587,7 +1584,7 @@ static int ost_init_sec_level(struct ptlrpc_request *req)
 
         /* connection from MDT is always trusted */
         if (req->rq_auth_usr_mdt) {
-                ost_init_sec_none(reply, exp);
+               ost_init_sec_none(reply);
                 RETURN(0);
         }
 
@@ -1599,7 +1596,7 @@ static int ost_init_sec_level(struct ptlrpc_request *req)
                               client, obd->obd_name, filter->fo_sec_level);
                         RETURN(-EACCES);
                 } else {
-                        ost_init_sec_none(reply, exp);
+                       ost_init_sec_none(reply);
                         RETURN(0);
                 }
         }
@@ -1616,7 +1613,7 @@ static int ost_init_sec_level(struct ptlrpc_request *req)
                         CWARN("client %s -> target %s uses old version, "
                               "run under security level %d.\n",
                               client, obd->obd_name, filter->fo_sec_level);
-                        ost_init_sec_none(reply, exp);
+                       ost_init_sec_none(reply);
                         RETURN(0);
                 }
         }
@@ -1644,7 +1641,7 @@ static int ost_init_sec_level(struct ptlrpc_request *req)
         switch (filter->fo_sec_level) {
         case LUSTRE_SEC_NONE:
                 if (!remote) {
-                        ost_init_sec_none(reply, exp);
+                       ost_init_sec_none(reply);
                         break;
                 } else {
                         CDEBUG(D_SEC, "client %s -> target %s is set as remote, "
@@ -1654,7 +1651,7 @@ static int ost_init_sec_level(struct ptlrpc_request *req)
                 }
         case LUSTRE_SEC_REMOTE:
                 if (!remote)
-                        ost_init_sec_none(reply, exp);
+                       ost_init_sec_none(reply);
                 break;
         case LUSTRE_SEC_ALL:
                 if (!remote) {
@@ -1662,10 +1659,6 @@ static int ost_init_sec_level(struct ptlrpc_request *req)
                                                       OBD_CONNECT_RMT_CLIENT_FORCE);
                         if (!filter->fo_fl_oss_capa)
                                 reply->ocd_connect_flags &= ~OBD_CONNECT_OSS_CAPA;
-
-                       spin_lock(&exp->exp_lock);
-                       *exp_connect_flags_ptr(exp) = reply->ocd_connect_flags;
-                       spin_unlock(&exp->exp_lock);
                 }
                 break;
         default:
@@ -2360,6 +2353,18 @@ int ost_handle(struct ptlrpc_request *req)
                         if (!rc)
                                 rc = ost_connect_check_sptlrpc(req);
                 }
+               if (rc == 0) {
+                       struct obd_export *exp = req->rq_export;
+                       struct obd_connect_data *reply;
+                       /* Now that connection handling has completed
+                        * successfully, atomically update the connect flags
+                        * in the shared export data structure.*/
+                       reply = req_capsule_server_get(&req->rq_pill,
+                                                      &RMF_CONNECT_DATA);
+                       spin_lock(&exp->exp_lock);
+                       exp->exp_connect_data = *reply;
+                       spin_unlock(&exp->exp_lock);
+               }
                 break;
         }
         case OST_DISCONNECT: