From 2fce7266154b9fff4663393a68ac45712cec0a64 Mon Sep 17 00:00:00 2001 From: fanyong Date: Mon, 25 Sep 2006 13:24:13 +0000 Subject: [PATCH] Use NULL parameter when no need permission check. --- lustre/mdt/mdt_handler.c | 35 ++++++++--------------------------- lustre/mdt/mdt_open.c | 11 +++++------ lustre/mdt/mdt_recovery.c | 4 ++-- lustre/mdt/mdt_reint.c | 2 +- lustre/mdt/mdt_xattr.c | 9 ++++----- 5 files changed, 20 insertions(+), 41 deletions(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index f246dfe..954f54e 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -293,7 +293,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, ma->ma_lmm_size = req_capsule_get_size(pill, &RMF_MDT_MD, RCL_SERVER); } - rc = mo_attr_get(ctxt, next, ma, &info->mti_uc); + rc = mo_attr_get(ctxt, next, ma, NULL); if (rc == -EREMOTE) { /* This object is located on remote node.*/ repbody->fid1 = *mdt_object_fid(o); @@ -330,8 +330,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, } } else if (S_ISLNK(la->la_mode) && reqbody->valid & OBD_MD_LINKNAME) { - rc = mo_readlink(ctxt, next, ma->ma_lmm, ma->ma_lmm_size, - &info->mti_uc); + rc = mo_readlink(ctxt, next, ma->ma_lmm, ma->ma_lmm_size, NULL); if (rc <= 0) { CERROR("readlink failed: %d\n", rc); rc = -EFAULT; @@ -374,7 +373,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info, length = req_capsule_get_size(pill, &RMF_ACL, RCL_SERVER); if (length > 0) { rc = mo_xattr_get(ctxt, next, buffer, length, - XATTR_NAME_ACL_ACCESS, &info->mti_uc); + XATTR_NAME_ACL_ACCESS, NULL); if (rc < 0) { if (rc == -ENODATA || rc == -EOPNOTSUPP) rc = 0; @@ -395,24 +394,14 @@ static int mdt_getattr(struct mdt_thread_info *info) { int rc; struct mdt_object *obj; - struct mdt_body *reqbody; obj = info->mti_object; LASSERT(obj != NULL); LASSERT(lu_object_assert_exists(&obj->mot_obj.mo_lu)); ENTRY; - reqbody = req_capsule_client_get(&info->mti_pill, &RMF_MDT_BODY); - if (reqbody == NULL) - RETURN(-EFAULT); - - rc = mdt_init_ucred(info, reqbody); - if (rc) - RETURN(rc); - rc = mdt_getattr_internal(info, obj); mdt_shrink_reply(info, REPLY_REC_OFF + 1); - mdt_exit_ucred(info); RETURN(rc); } @@ -771,7 +760,7 @@ static int mdt_write_dir_page(struct mdt_thread_info *info, struct page *page) memcpy(name, ent->lde_name, ent->lde_namelen); rc = mdo_name_insert(info->mti_ctxt, md_object_next(&object->mot_obj), - name, lf, 0, &info->mti_uc); + name, lf, 0, NULL); OBD_FREE(name, ent->lde_namelen + 1); if (rc) GOTO(out, rc); @@ -984,7 +973,7 @@ static int mdt_reint_internal(struct mdt_thread_info *info, } rc = mdt_init_ucred_reint(info); - if (rc != 0) + if (rc) RETURN(rc); rc = mdt_fix_attr_ucred(info, op); @@ -1089,12 +1078,8 @@ static int mdt_sync(struct mdt_thread_info *info) if (body == NULL) RETURN(-EINVAL); - rc = mdt_init_ucred(info, body); - if (rc) - RETURN(rc); - if (MDT_FAIL_CHECK(OBD_FAIL_MDS_SYNC_PACK)) - GOTO(out, rc = -ENOMEM); + RETURN(-ENOMEM); if (fid_seq(&body->fid1) == 0) { /* sync the whole device */ @@ -1114,8 +1099,7 @@ static int mdt_sync(struct mdt_thread_info *info) next = mdt_object_child(info->mti_object); info->mti_attr.ma_need = MA_INODE; rc = mo_attr_get(info->mti_ctxt, next, - &info->mti_attr, - &info->mti_uc); + &info->mti_attr, NULL); if (rc == 0) { body = req_capsule_server_get(pill, &RMF_MDT_BODY); @@ -1126,10 +1110,7 @@ static int mdt_sync(struct mdt_thread_info *info) } } } - EXIT; -out: - mdt_exit_ucred(info); - return rc; + RETURN(rc); } static int mdt_quotacheck_handle(struct mdt_thread_info *info) diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 41ca490..9ef1d83 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -524,7 +524,7 @@ static int mdt_open_by_fid(struct mdt_thread_info* info, mdt_set_disposition(info, rep, DISP_IT_EXECD); mdt_set_disposition(info, rep, DISP_LOOKUP_EXECD); mdt_set_disposition(info, rep, DISP_LOOKUP_POS); - rc = mo_attr_get(ctxt, mdt_object_child(o), ma, &info->mti_uc); + rc = mo_attr_get(ctxt, mdt_object_child(o), ma, NULL); if (rc == 0) rc = mdt_mfd_open(info, NULL, o, flags, 0, rep); } else if (rc == 0) { @@ -563,8 +563,7 @@ static int mdt_cross_open(struct mdt_thread_info* info, rc = lu_object_exists(&o->mot_obj.mo_lu); if (rc > 0) { - rc = mo_attr_get(info->mti_ctxt, mdt_object_child(o), ma, - &info->mti_uc); + rc = mo_attr_get(info->mti_ctxt, mdt_object_child(o), ma, NULL); if (rc == 0) rc = mdt_mfd_open(info, NULL, o, flags, 0, rep); } else if (rc == 0) { @@ -723,7 +722,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc) } else { /* We have to get attr & lov ea for this object */ result = mo_attr_get(info->mti_ctxt, mdt_object_child(child), - ma, &info->mti_uc); + ma, NULL); /* * The object is on remote node, return its FID for remote open. */ @@ -830,9 +829,9 @@ int mdt_mfd_close(struct mdt_thread_info *info, struct mdt_file_data *mfd) ma->ma_need |= MA_INODE; if (!MFD_CLOSED(mode)) - rc = mo_close(info->mti_ctxt, next, ma, &info->mti_uc); + rc = mo_close(info->mti_ctxt, next, ma, NULL); else if (ret == -EAGAIN) - rc = mo_attr_get(info->mti_ctxt, next, ma, &info->mti_uc); + rc = mo_attr_get(info->mti_ctxt, next, ma, NULL); /* If the object is unlinked, do not try to re-enable SIZEONMDS */ if ((ret == -EAGAIN) && (ma->ma_valid & MA_INODE) && diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index 96c68f3..ba05274 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -979,7 +979,7 @@ static void mdt_reconstruct_create(struct mdt_thread_info *mti, body = req_capsule_server_get(&mti->mti_pill, &RMF_MDT_BODY); rc = mo_attr_get(mti->mti_ctxt, mdt_object_child(child), - &mti->mti_attr, &mti->mti_uc); + &mti->mti_attr, NULL); if (rc == -EREMOTE) { /* object was created on remote server */ req->rq_status = rc; @@ -1007,7 +1007,7 @@ static void mdt_reconstruct_setattr(struct mdt_thread_info *mti, obj = mdt_object_find(mti->mti_ctxt, mdt, mti->mti_rr.rr_fid1); LASSERT(!IS_ERR(obj)); mo_attr_get(mti->mti_ctxt, mdt_object_child(obj), - &mti->mti_attr, &mti->mti_uc); + &mti->mti_attr, NULL); mdt_pack_attr2body(body, &mti->mti_attr.ma_attr, mdt_object_fid(obj)); mdt_body_reverse_idmap(mti, body); diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index f32fca3..f8e43bc 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -263,7 +263,7 @@ static int mdt_reint_setattr(struct mdt_thread_info *info, ma->ma_need = MA_INODE; next = mdt_object_child(mo); - rc = mo_attr_get(info->mti_ctxt, next, ma, &info->mti_uc); + rc = mo_attr_get(info->mti_ctxt, next, ma, NULL); if (rc != 0) GOTO(out, rc); diff --git a/lustre/mdt/mdt_xattr.c b/lustre/mdt/mdt_xattr.c index 99c8484..a9c689c 100644 --- a/lustre/mdt/mdt_xattr.c +++ b/lustre/mdt/mdt_xattr.c @@ -73,11 +73,11 @@ static int mdt_getxattr_pack_reply(struct mdt_thread_info * info) else rc = mo_xattr_get(info->mti_ctxt, mdt_object_child(info->mti_object), - NULL, 0, xattr_name, &info->mti_uc); + NULL, 0, xattr_name, NULL); } else if ((valid & OBD_MD_FLXATTRLS) == OBD_MD_FLXATTRLS) { rc = mo_xattr_list(info->mti_ctxt, mdt_object_child(info->mti_object), - NULL, 0, &info->mti_uc); + NULL, 0, NULL); } else { CERROR("valid bits: "LPX64"\n", info->mti_body->valid); return -EINVAL; @@ -176,7 +176,7 @@ int mdt_getxattr(struct mdt_thread_info *info) buf, buflen); } else { rc = mo_xattr_get(info->mti_ctxt, next, buf, buflen, - xattr_name, &info->mti_uc); + xattr_name, NULL); } if (rc < 0 && rc != -ENODATA && rc != -EOPNOTSUPP && @@ -185,8 +185,7 @@ int mdt_getxattr(struct mdt_thread_info *info) } else if (info->mti_body->valid & OBD_MD_FLXATTRLS) { CDEBUG(D_INODE, "listxattr\n"); - rc = mo_xattr_list(info->mti_ctxt, next, buf, buflen, - &info->mti_uc); + rc = mo_xattr_list(info->mti_ctxt, next, buf, buflen, NULL); if (rc < 0) CDEBUG(D_OTHER, "listxattr failed: %d\n", rc); } else -- 1.8.3.1