Whamcloud - gitweb
LU-6142 mdc: minor function cleanups.
[fs/lustre-release.git] / lustre / mdc / mdc_request.c
index 0b435d7..2a5b2c7 100644 (file)
@@ -455,7 +455,9 @@ static int mdc_getxattr(struct obd_export *exp, const struct lu_fid *fid,
        LASSERT(obd_md_valid == OBD_MD_FLXATTR ||
                obd_md_valid == OBD_MD_FLXATTRLS);
 
-       /* The below message is checked in sanity-selinux.sh test_20d */
+       /* Message below is checked in sanity-selinux test_20d
+        * and sanity-sec test_49
+        */
        CDEBUG(D_INFO, "%s: get xattr '%s' for "DFID"\n",
               exp->exp_obd->obd_name, name, PFID(fid));
        rc = mdc_xattr_common(exp, &RQF_MDS_GETXATTR, fid, MDS_GETXATTR,
@@ -505,9 +507,10 @@ out:
        return rc;
 }
 
-int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
-                      struct obd_export *dt_exp, struct obd_export *md_exp,
-                      struct lustre_md *md)
+static int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
+                            struct obd_export *dt_exp,
+                            struct obd_export *md_exp,
+                            struct lustre_md *md)
 {
         struct req_capsule *pill = &req->rq_pill;
         int rc;
@@ -622,10 +625,10 @@ out:
        return rc;
 }
 
-int mdc_free_lustre_md(struct obd_export *exp, struct lustre_md *md)
+static int mdc_free_lustre_md(struct obd_export *exp, struct lustre_md *md)
 {
-        ENTRY;
-        RETURN(0);
+       ENTRY;
+       RETURN(0);
 }
 
 void mdc_replay_open(struct ptlrpc_request *req)
@@ -635,6 +638,7 @@ void mdc_replay_open(struct ptlrpc_request *req)
        struct obd_client_handle *och;
        struct lustre_handle old_open_handle = { };
        struct mdt_body *body;
+       struct ldlm_reply *rep;
        ENTRY;
 
        if (mod == NULL) {
@@ -647,6 +651,11 @@ void mdc_replay_open(struct ptlrpc_request *req)
        body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
        LASSERT(body != NULL);
 
+       rep = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP);
+       if (rep != NULL && rep->lock_policy_res2 != 0)
+               DEBUG_REQ(D_ERROR, req, "Open request replay failed with %ld ",
+                       (long int)rep->lock_policy_res2);
+
        spin_lock(&req->rq_lock);
        och = mod->mod_och;
        if (och && och->och_open_handle.cookie)
@@ -804,18 +813,18 @@ static void mdc_free_open(struct md_open_data *mod)
                ptlrpc_request_committed(mod->mod_close_req, committed);
 }
 
-int mdc_clear_open_replay_data(struct obd_export *exp,
-                               struct obd_client_handle *och)
+static int mdc_clear_open_replay_data(struct obd_export *exp,
+                                     struct obd_client_handle *och)
 {
-        struct md_open_data *mod = och->och_mod;
-        ENTRY;
+       struct md_open_data *mod = och->och_mod;
+       ENTRY;
 
-        /**
-         * It is possible to not have \var mod in a case of eviction between
-         * lookup and ll_file_open().
-         **/
-        if (mod == NULL)
-                RETURN(0);
+       /**
+        * It is possible to not have \var mod in a case of eviction between
+        * lookup and ll_file_open().
+        **/
+       if (mod == NULL)
+               RETURN(0);
 
        LASSERT(mod != LP_POISON);
        LASSERT(mod->mod_open_req != NULL);
@@ -827,11 +836,11 @@ int mdc_clear_open_replay_data(struct obd_export *exp,
        spin_unlock(&mod->mod_open_req->rq_lock);
        mdc_free_open(mod);
 
-        mod->mod_och = NULL;
-        och->och_mod = NULL;
-        obd_mod_put(mod);
+       mod->mod_och = NULL;
+       och->och_mod = NULL;
+       obd_mod_put(mod);
 
-        RETURN(0);
+       RETURN(0);
 }
 
 static int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
@@ -2943,7 +2952,7 @@ static int __init mdc_init(void)
                goto out_dev;
        }
 
-       rc = class_register_type(&mdc_obd_ops, &mdc_md_ops, true, NULL,
+       rc = class_register_type(&mdc_obd_ops, &mdc_md_ops, true,
                                 LUSTRE_MDC_NAME, &mdc_device_type);
        if (rc)
                goto out_class;