Whamcloud - gitweb
LU-4629 mdc: fix issue found by Klocwork Insight tool
[fs/lustre-release.git] / lustre / mdc / mdc_reint.c
index b28b332..a233011 100644 (file)
@@ -171,6 +171,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
                         req->rq_cb_data = *mod;
                         (*mod)->mod_open_req = req;
                         req->rq_commit_cb = mdc_commit_open;
+                       (*mod)->mod_is_create = true;
                         /**
                          * Take an extra reference on \var mod, it protects \var
                          * mod from being freed on eviction (commit callback is
@@ -202,12 +203,13 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
                 rc = 0;
         }
         *request = req;
-        if (rc && req->rq_commit_cb) {
-                /* Put an extra reference on \var mod on error case. */
-                obd_mod_put(*mod);
-                req->rq_commit_cb(req);
-        }
-        RETURN(rc);
+       if (rc && req->rq_commit_cb) {
+               /* Put an extra reference on \var mod on error case. */
+               if (mod != NULL && *mod != NULL)
+                       obd_mod_put(*mod);
+               req->rq_commit_cb(req);
+       }
+       RETURN(rc);
 }
 
 int mdc_create(struct obd_export *exp, struct md_op_data *op_data,
@@ -361,13 +363,13 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
                RETURN(rc);
        }
 
-        mdc_unlink_pack(req, op_data);
+       mdc_unlink_pack(req, op_data);
 
-        req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
-                             obd->u.cli.cl_max_mds_easize);
-        req_capsule_set_size(&req->rq_pill, &RMF_LOGCOOKIES, RCL_SERVER,
-                             obd->u.cli.cl_max_mds_cookiesize);
-        ptlrpc_request_set_replen(req);
+       req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
+                            obd->u.cli.cl_default_mds_easize);
+       req_capsule_set_size(&req->rq_pill, &RMF_LOGCOOKIES, RCL_SERVER,
+                            obd->u.cli.cl_default_mds_cookiesize);
+       ptlrpc_request_set_replen(req);
 
         *request = req;
 
@@ -478,11 +480,11 @@ int mdc_rename(struct obd_export *exp, struct md_op_data *op_data,
 
         mdc_rename_pack(req, op_data, old, oldlen, new, newlen);
 
-        req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
-                             obd->u.cli.cl_max_mds_easize);
-        req_capsule_set_size(&req->rq_pill, &RMF_LOGCOOKIES, RCL_SERVER,
-                             obd->u.cli.cl_max_mds_cookiesize);
-        ptlrpc_request_set_replen(req);
+       req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
+                            obd->u.cli.cl_default_mds_easize);
+       req_capsule_set_size(&req->rq_pill, &RMF_LOGCOOKIES, RCL_SERVER,
+                            obd->u.cli.cl_default_mds_cookiesize);
+       ptlrpc_request_set_replen(req);
 
         rc = mdc_reint(req, obd->u.cli.cl_rpc_lock, LUSTRE_IMP_FULL);
         *request = req;