Commit 34e3ff96 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre/mdc: Adjust NULL comparison codestyle

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"

Also remove some redundant assertions.
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d2a13989
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid) static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
{ {
LASSERT(b != NULL);
b->suppgid = suppgid; b->suppgid = suppgid;
b->uid = from_kuid(&init_user_ns, current_uid()); b->uid = from_kuid(&init_user_ns, current_uid());
b->gid = from_kgid(&init_user_ns, current_gid()); b->gid = from_kgid(&init_user_ns, current_gid());
...@@ -83,7 +81,6 @@ void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid, ...@@ -83,7 +81,6 @@ void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid,
{ {
struct mdt_body *b = req_capsule_client_get(&req->rq_pill, struct mdt_body *b = req_capsule_client_get(&req->rq_pill,
&RMF_MDT_BODY); &RMF_MDT_BODY);
LASSERT(b != NULL);
b->valid = valid; b->valid = valid;
b->eadatasize = ea_size; b->eadatasize = ea_size;
b->flags = flags; b->flags = flags;
...@@ -323,7 +320,7 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data, ...@@ -323,7 +320,7 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
return; return;
lum = req_capsule_client_get(&req->rq_pill, &RMF_EADATA); lum = req_capsule_client_get(&req->rq_pill, &RMF_EADATA);
if (ea == NULL) { /* Remove LOV EA */ if (!ea) { /* Remove LOV EA */
lum->lmm_magic = LOV_USER_MAGIC_V1; lum->lmm_magic = LOV_USER_MAGIC_V1;
lum->lmm_stripe_size = 0; lum->lmm_stripe_size = 0;
lum->lmm_stripe_count = 0; lum->lmm_stripe_count = 0;
...@@ -346,7 +343,6 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data) ...@@ -346,7 +343,6 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_unlink)); CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_unlink));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
LASSERT(rec != NULL);
rec->ul_opcode = op_data->op_cli_flags & CLI_RM_ENTRY ? rec->ul_opcode = op_data->op_cli_flags & CLI_RM_ENTRY ?
REINT_RMENTRY : REINT_UNLINK; REINT_RMENTRY : REINT_UNLINK;
...@@ -362,7 +358,7 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data) ...@@ -362,7 +358,7 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
rec->ul_bias = op_data->op_bias; rec->ul_bias = op_data->op_bias;
tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME); tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
LASSERT(tmp != NULL); LASSERT(tmp);
LOGL0(op_data->op_name, op_data->op_namelen, tmp); LOGL0(op_data->op_name, op_data->op_namelen, tmp);
} }
...@@ -373,7 +369,6 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data) ...@@ -373,7 +369,6 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_link)); CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_link));
rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
LASSERT(rec != NULL);
rec->lk_opcode = REINT_LINK; rec->lk_opcode = REINT_LINK;
rec->lk_fsuid = op_data->op_fsuid; /* current->fsuid; */ rec->lk_fsuid = op_data->op_fsuid; /* current->fsuid; */
...@@ -456,10 +451,9 @@ static void mdc_hsm_release_pack(struct ptlrpc_request *req, ...@@ -456,10 +451,9 @@ static void mdc_hsm_release_pack(struct ptlrpc_request *req,
struct ldlm_lock *lock; struct ldlm_lock *lock;
data = req_capsule_client_get(&req->rq_pill, &RMF_CLOSE_DATA); data = req_capsule_client_get(&req->rq_pill, &RMF_CLOSE_DATA);
LASSERT(data != NULL);
lock = ldlm_handle2lock(&op_data->op_lease_handle); lock = ldlm_handle2lock(&op_data->op_lease_handle);
if (lock != NULL) { if (lock) {
data->cd_handle = lock->l_remote_handle; data->cd_handle = lock->l_remote_handle;
ldlm_lock_put(lock); ldlm_lock_put(lock);
} }
......
...@@ -129,7 +129,7 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data, ...@@ -129,7 +129,7 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
lock = ldlm_handle2lock((struct lustre_handle *)lockh); lock = ldlm_handle2lock((struct lustre_handle *)lockh);
LASSERT(lock != NULL); LASSERT(lock);
lock_res_and_lock(lock); lock_res_and_lock(lock);
if (lock->l_resource->lr_lvb_inode && if (lock->l_resource->lr_lvb_inode &&
lock->l_resource->lr_lvb_inode != data) { lock->l_resource->lr_lvb_inode != data) {
...@@ -191,12 +191,12 @@ int mdc_null_inode(struct obd_export *exp, ...@@ -191,12 +191,12 @@ int mdc_null_inode(struct obd_export *exp,
struct ldlm_resource *res; struct ldlm_resource *res;
struct ldlm_namespace *ns = class_exp2obd(exp)->obd_namespace; struct ldlm_namespace *ns = class_exp2obd(exp)->obd_namespace;
LASSERTF(ns != NULL, "no namespace passed\n"); LASSERTF(ns, "no namespace passed\n");
fid_build_reg_res_name(fid, &res_id); fid_build_reg_res_name(fid, &res_id);
res = ldlm_resource_get(ns, NULL, &res_id, 0, 0); res = ldlm_resource_get(ns, NULL, &res_id, 0, 0);
if (res == NULL) if (!res)
return 0; return 0;
lock_res(res); lock_res(res);
...@@ -317,7 +317,7 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp, ...@@ -317,7 +317,7 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_INTENT_OPEN); &RQF_LDLM_INTENT_OPEN);
if (req == NULL) { if (!req) {
ldlm_lock_list_put(&cancels, l_bl_ast, count); ldlm_lock_list_put(&cancels, l_bl_ast, count);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
...@@ -365,7 +365,7 @@ mdc_intent_getxattr_pack(struct obd_export *exp, ...@@ -365,7 +365,7 @@ mdc_intent_getxattr_pack(struct obd_export *exp,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_INTENT_GETXATTR); &RQF_LDLM_INTENT_GETXATTR);
if (req == NULL) if (!req)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
rc = ldlm_prep_enqueue_req(exp, req, &cancels, count); rc = ldlm_prep_enqueue_req(exp, req, &cancels, count);
...@@ -409,7 +409,7 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp, ...@@ -409,7 +409,7 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_INTENT_UNLINK); &RQF_LDLM_INTENT_UNLINK);
if (req == NULL) if (!req)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
...@@ -453,7 +453,7 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp, ...@@ -453,7 +453,7 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_INTENT_GETATTR); &RQF_LDLM_INTENT_GETATTR);
if (req == NULL) if (!req)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
...@@ -497,7 +497,7 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp, ...@@ -497,7 +497,7 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_INTENT_LAYOUT); &RQF_LDLM_INTENT_LAYOUT);
if (req == NULL) if (!req)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT, 0); req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT, 0);
...@@ -530,7 +530,7 @@ mdc_enqueue_pack(struct obd_export *exp, int lvb_len) ...@@ -530,7 +530,7 @@ mdc_enqueue_pack(struct obd_export *exp, int lvb_len)
int rc; int rc;
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_LDLM_ENQUEUE); req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_LDLM_ENQUEUE);
if (req == NULL) if (!req)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
rc = ldlm_prep_enqueue_req(exp, req, NULL, 0); rc = ldlm_prep_enqueue_req(exp, req, NULL, 0);
...@@ -573,7 +573,6 @@ static int mdc_finish_enqueue(struct obd_export *exp, ...@@ -573,7 +573,6 @@ static int mdc_finish_enqueue(struct obd_export *exp,
rc = 0; rc = 0;
} else { /* rc = 0 */ } else { /* rc = 0 */
lock = ldlm_handle2lock(lockh); lock = ldlm_handle2lock(lockh);
LASSERT(lock != NULL);
/* If the server gave us back a different lock mode, we should /* If the server gave us back a different lock mode, we should
* fix up our variables. */ * fix up our variables. */
...@@ -586,7 +585,6 @@ static int mdc_finish_enqueue(struct obd_export *exp, ...@@ -586,7 +585,6 @@ static int mdc_finish_enqueue(struct obd_export *exp,
} }
lockrep = req_capsule_server_get(pill, &RMF_DLM_REP); lockrep = req_capsule_server_get(pill, &RMF_DLM_REP);
LASSERT(lockrep != NULL); /* checked by ldlm_cli_enqueue() */
intent->it_disposition = (int)lockrep->lock_policy_res1; intent->it_disposition = (int)lockrep->lock_policy_res1;
intent->it_status = (int)lockrep->lock_policy_res2; intent->it_status = (int)lockrep->lock_policy_res2;
...@@ -618,7 +616,7 @@ static int mdc_finish_enqueue(struct obd_export *exp, ...@@ -618,7 +616,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
struct mdt_body *body; struct mdt_body *body;
body = req_capsule_server_get(pill, &RMF_MDT_BODY); body = req_capsule_server_get(pill, &RMF_MDT_BODY);
if (body == NULL) { if (!body) {
CERROR("Can't swab mdt_body\n"); CERROR("Can't swab mdt_body\n");
return -EPROTO; return -EPROTO;
} }
...@@ -645,7 +643,7 @@ static int mdc_finish_enqueue(struct obd_export *exp, ...@@ -645,7 +643,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
*/ */
eadata = req_capsule_server_sized_get(pill, &RMF_MDT_MD, eadata = req_capsule_server_sized_get(pill, &RMF_MDT_MD,
body->eadatasize); body->eadatasize);
if (eadata == NULL) if (!eadata)
return -EPROTO; return -EPROTO;
/* save lvb data and length in case this is for layout /* save lvb data and length in case this is for layout
...@@ -690,7 +688,7 @@ static int mdc_finish_enqueue(struct obd_export *exp, ...@@ -690,7 +688,7 @@ static int mdc_finish_enqueue(struct obd_export *exp,
LASSERT(client_is_remote(exp)); LASSERT(client_is_remote(exp));
perm = req_capsule_server_swab_get(pill, &RMF_ACL, perm = req_capsule_server_swab_get(pill, &RMF_ACL,
lustre_swab_mdt_remote_perm); lustre_swab_mdt_remote_perm);
if (perm == NULL) if (!perm)
return -EPROTO; return -EPROTO;
} }
} else if (it->it_op & IT_LAYOUT) { } else if (it->it_op & IT_LAYOUT) {
...@@ -700,21 +698,21 @@ static int mdc_finish_enqueue(struct obd_export *exp, ...@@ -700,21 +698,21 @@ static int mdc_finish_enqueue(struct obd_export *exp,
if (lvb_len > 0) { if (lvb_len > 0) {
lvb_data = req_capsule_server_sized_get(pill, lvb_data = req_capsule_server_sized_get(pill,
&RMF_DLM_LVB, lvb_len); &RMF_DLM_LVB, lvb_len);
if (lvb_data == NULL) if (!lvb_data)
return -EPROTO; return -EPROTO;
} }
} }
/* fill in stripe data for layout lock */ /* fill in stripe data for layout lock */
lock = ldlm_handle2lock(lockh); lock = ldlm_handle2lock(lockh);
if (lock != NULL && ldlm_has_layout(lock) && lvb_data != NULL) { if (lock && ldlm_has_layout(lock) && lvb_data) {
void *lmm; void *lmm;
LDLM_DEBUG(lock, "layout lock returned by: %s, lvb_len: %d\n", LDLM_DEBUG(lock, "layout lock returned by: %s, lvb_len: %d\n",
ldlm_it2str(it->it_op), lvb_len); ldlm_it2str(it->it_op), lvb_len);
lmm = libcfs_kvzalloc(lvb_len, GFP_NOFS); lmm = libcfs_kvzalloc(lvb_len, GFP_NOFS);
if (lmm == NULL) { if (!lmm) {
LDLM_LOCK_PUT(lock); LDLM_LOCK_PUT(lock);
return -ENOMEM; return -ENOMEM;
} }
...@@ -722,17 +720,17 @@ static int mdc_finish_enqueue(struct obd_export *exp, ...@@ -722,17 +720,17 @@ static int mdc_finish_enqueue(struct obd_export *exp,
/* install lvb_data */ /* install lvb_data */
lock_res_and_lock(lock); lock_res_and_lock(lock);
if (lock->l_lvb_data == NULL) { if (!lock->l_lvb_data) {
lock->l_lvb_type = LVB_T_LAYOUT; lock->l_lvb_type = LVB_T_LAYOUT;
lock->l_lvb_data = lmm; lock->l_lvb_data = lmm;
lock->l_lvb_len = lvb_len; lock->l_lvb_len = lvb_len;
lmm = NULL; lmm = NULL;
} }
unlock_res_and_lock(lock); unlock_res_and_lock(lock);
if (lmm != NULL) if (lmm)
kvfree(lmm); kvfree(lmm);
} }
if (lock != NULL) if (lock)
LDLM_LOCK_PUT(lock); LDLM_LOCK_PUT(lock);
return rc; return rc;
...@@ -782,7 +780,7 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, ...@@ -782,7 +780,7 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
policy = &getxattr_policy; policy = &getxattr_policy;
} }
LASSERT(reqp == NULL); LASSERT(!reqp);
generation = obddev->u.cli.cl_import->imp_generation; generation = obddev->u.cli.cl_import->imp_generation;
resend: resend:
...@@ -823,7 +821,7 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, ...@@ -823,7 +821,7 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
if (IS_ERR(req)) if (IS_ERR(req))
return PTR_ERR(req); return PTR_ERR(req);
if (req != NULL && it && it->it_op & IT_CREAT) if (req && it && it->it_op & IT_CREAT)
/* ask ptlrpc not to resend on EINPROGRESS since we have our own /* ask ptlrpc not to resend on EINPROGRESS since we have our own
* retry logic */ * retry logic */
req->rq_no_retry_einprogress = 1; req->rq_no_retry_einprogress = 1;
...@@ -878,7 +876,6 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, ...@@ -878,7 +876,6 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
} }
lockrep = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP); lockrep = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP);
LASSERT(lockrep != NULL);
lockrep->lock_policy_res2 = lockrep->lock_policy_res2 =
ptlrpc_status_ntoh(lockrep->lock_policy_res2); ptlrpc_status_ntoh(lockrep->lock_policy_res2);
...@@ -930,7 +927,6 @@ static int mdc_finish_intent_lock(struct obd_export *exp, ...@@ -930,7 +927,6 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
struct ldlm_lock *lock; struct ldlm_lock *lock;
int rc; int rc;
LASSERT(request != NULL);
LASSERT(request != LP_POISON); LASSERT(request != LP_POISON);
LASSERT(request->rq_repmsg != LP_POISON); LASSERT(request->rq_repmsg != LP_POISON);
...@@ -945,7 +941,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp, ...@@ -945,7 +941,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
return rc; return rc;
mdt_body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY); mdt_body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
LASSERT(mdt_body != NULL); /* mdc_enqueue checked */ LASSERT(mdt_body); /* mdc_enqueue checked */
/* If we were revalidating a fid/name pair, mark the intent in /* If we were revalidating a fid/name pair, mark the intent in
* case we fail and get called again from lookup */ * case we fail and get called again from lookup */
...@@ -1206,7 +1202,6 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, ...@@ -1206,7 +1202,6 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env,
} }
lockrep = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP); lockrep = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP);
LASSERT(lockrep != NULL);
lockrep->lock_policy_res2 = lockrep->lock_policy_res2 =
ptlrpc_status_ntoh(lockrep->lock_policy_res2); ptlrpc_status_ntoh(lockrep->lock_policy_res2);
......
...@@ -88,7 +88,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, ...@@ -88,7 +88,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
fid_build_reg_res_name(fid, &res_id); fid_build_reg_res_name(fid, &res_id);
res = ldlm_resource_get(exp->exp_obd->obd_namespace, res = ldlm_resource_get(exp->exp_obd->obd_namespace,
NULL, &res_id, 0, 0); NULL, &res_id, 0, 0);
if (res == NULL) if (!res)
return 0; return 0;
LDLM_RESOURCE_ADDREF(res); LDLM_RESOURCE_ADDREF(res);
/* Initialize ibits lock policy. */ /* Initialize ibits lock policy. */
...@@ -111,8 +111,6 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, ...@@ -111,8 +111,6 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
int count = 0, rc; int count = 0, rc;
__u64 bits; __u64 bits;
LASSERT(op_data != NULL);
bits = MDS_INODELOCK_UPDATE; bits = MDS_INODELOCK_UPDATE;
if (op_data->op_attr.ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) if (op_data->op_attr.ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID))
bits |= MDS_INODELOCK_LOOKUP; bits |= MDS_INODELOCK_LOOKUP;
...@@ -123,7 +121,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, ...@@ -123,7 +121,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
&cancels, LCK_EX, bits); &cancels, LCK_EX, bits);
req = ptlrpc_request_alloc(class_exp2cliimp(exp), req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_MDS_REINT_SETATTR); &RQF_MDS_REINT_SETATTR);
if (req == NULL) { if (!req) {
ldlm_lock_list_put(&cancels, l_bl_ast, count); ldlm_lock_list_put(&cancels, l_bl_ast, count);
return -ENOMEM; return -ENOMEM;
} }
...@@ -151,10 +149,10 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, ...@@ -151,10 +149,10 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
ptlrpc_request_set_replen(req); ptlrpc_request_set_replen(req);
if (mod && (op_data->op_flags & MF_EPOCH_OPEN) && if (mod && (op_data->op_flags & MF_EPOCH_OPEN) &&
req->rq_import->imp_replayable) { req->rq_import->imp_replayable) {
LASSERT(*mod == NULL); LASSERT(!*mod);
*mod = obd_mod_alloc(); *mod = obd_mod_alloc();
if (*mod == NULL) { if (!*mod) {
DEBUG_REQ(D_ERROR, req, "Can't allocate md_open_data"); DEBUG_REQ(D_ERROR, req, "Can't allocate md_open_data");
} else { } else {
req->rq_replay = 1; req->rq_replay = 1;
...@@ -181,8 +179,6 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, ...@@ -181,8 +179,6 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
epoch = req_capsule_client_get(&req->rq_pill, &RMF_MDT_EPOCH); epoch = req_capsule_client_get(&req->rq_pill, &RMF_MDT_EPOCH);
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
LASSERT(epoch != NULL);
LASSERT(body != NULL);
epoch->handle = body->handle; epoch->handle = body->handle;
epoch->ioepoch = body->ioepoch; epoch->ioepoch = body->ioepoch;
req->rq_replay_cb = mdc_replay_open; req->rq_replay_cb = mdc_replay_open;
...@@ -195,7 +191,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, ...@@ -195,7 +191,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
*request = req; *request = req;
if (rc && req->rq_commit_cb) { if (rc && req->rq_commit_cb) {
/* Put an extra reference on \var mod on error case. */ /* Put an extra reference on \var mod on error case. */
if (mod != NULL && *mod != NULL) if (mod && *mod)
obd_mod_put(*mod); obd_mod_put(*mod);
req->rq_commit_cb(req); req->rq_commit_cb(req);
} }
...@@ -237,7 +233,7 @@ int mdc_create(struct obd_export *exp, struct md_op_data *op_data, ...@@ -237,7 +233,7 @@ int mdc_create(struct obd_export *exp, struct md_op_data *op_data,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_MDS_REINT_CREATE_RMT_ACL); &RQF_MDS_REINT_CREATE_RMT_ACL);
if (req == NULL) { if (!req) {
ldlm_lock_list_put(&cancels, l_bl_ast, count); ldlm_lock_list_put(&cancels, l_bl_ast, count);
return -ENOMEM; return -ENOMEM;
} }
...@@ -308,7 +304,7 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data, ...@@ -308,7 +304,7 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
struct ptlrpc_request *req = *request; struct ptlrpc_request *req = *request;
int count = 0, rc; int count = 0, rc;
LASSERT(req == NULL); LASSERT(!req);
if ((op_data->op_flags & MF_MDC_CANCEL_FID1) && if ((op_data->op_flags & MF_MDC_CANCEL_FID1) &&
(fid_is_sane(&op_data->op_fid1)) && (fid_is_sane(&op_data->op_fid1)) &&
...@@ -324,7 +320,7 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data, ...@@ -324,7 +320,7 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
MDS_INODELOCK_FULL); MDS_INODELOCK_FULL);
req = ptlrpc_request_alloc(class_exp2cliimp(exp), req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_MDS_REINT_UNLINK); &RQF_MDS_REINT_UNLINK);
if (req == NULL) { if (!req) {
ldlm_lock_list_put(&cancels, l_bl_ast, count); ldlm_lock_list_put(&cancels, l_bl_ast, count);
return -ENOMEM; return -ENOMEM;
} }
...@@ -373,7 +369,7 @@ int mdc_link(struct obd_export *exp, struct md_op_data *op_data, ...@@ -373,7 +369,7 @@ int mdc_link(struct obd_export *exp, struct md_op_data *op_data,
MDS_INODELOCK_UPDATE); MDS_INODELOCK_UPDATE);
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_REINT_LINK); req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_REINT_LINK);
if (req == NULL) { if (!req) {
ldlm_lock_list_put(&cancels, l_bl_ast, count); ldlm_lock_list_put(&cancels, l_bl_ast, count);
return -ENOMEM; return -ENOMEM;
} }
...@@ -429,7 +425,7 @@ int mdc_rename(struct obd_export *exp, struct md_op_data *op_data, ...@@ -429,7 +425,7 @@ int mdc_rename(struct obd_export *exp, struct md_op_data *op_data,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_MDS_REINT_RENAME); &RQF_MDS_REINT_RENAME);
if (req == NULL) { if (!req) {
ldlm_lock_list_put(&cancels, l_bl_ast, count); ldlm_lock_list_put(&cancels, l_bl_ast, count);
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment