From: huanghua Date: Fri, 28 Jul 2006 11:34:01 +0000 (+0000) Subject: fixed bugs: X-Git-Tag: v1_8_0_110~486^2~1322 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=c457da8292e225b580023a4eeebfb66dc28b3650;p=fs%2Flustre-release.git fixed bugs: (1) using uninitialized variable; (2) wrong lock type; --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 9baac52..43b985b 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -405,13 +405,13 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, ENTRY; LASSERT(info->mti_object != NULL); - CDEBUG(D_INODE, "getattr with lock for "DFID3"/%s, ldlm_rep = %p\n", - PFID3(mdt_object_fid(parent)), name, ldlm_rep); - name = req_capsule_client_get(&info->mti_pill, &RMF_NAME); if (name == NULL) RETURN(-EFAULT); + CDEBUG(D_INODE, "getattr with lock for "DFID3"/%s, ldlm_rep = %p\n", + PFID3(mdt_object_fid(parent)), name, ldlm_rep); + intent_set_disposition(ldlm_rep, DISP_LOOKUP_EXECD); if (strlen(name) == 0) { /* only open the child. parent is on another node. */ @@ -557,7 +557,7 @@ static int mdt_sendpage(struct mdt_thread_info *info, for (i = 0, tmpcount = rdpg->rp_count; i < rdpg->rp_npages; i++, tmpcount -= tmpsize) { - tmpsize = min(tmpcount, CFS_PAGE_SIZE); + tmpsize = min_t(int, tmpcount, CFS_PAGE_SIZE); ptlrpc_prep_bulk_page(desc, rdpg->rp_pages[i], 0, tmpsize); } @@ -628,7 +628,7 @@ static int mdt_readpage(struct mdt_thread_info *info) RETURN(-EFAULT); } rdpg->rp_count = reqbody->nlink; - rdpg->rp_npages = rdpg->rp_count + CFS_PAGE_SIZE - 1 >> CFS_PAGE_SHIFT; + rdpg->rp_npages = (rdpg->rp_count + CFS_PAGE_SIZE - 1)>> CFS_PAGE_SHIFT; OBD_ALLOC(rdpg->rp_pages, rdpg->rp_npages * sizeof rdpg->rp_pages[0]); if (rdpg->rp_pages == NULL) RETURN(-ENOMEM); diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index b7902b3..d5b6402 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -264,9 +264,9 @@ int mdt_reint_open(struct mdt_thread_info *info) intent_set_disposition(ldlm_rep, DISP_LOOKUP_EXECD); lh = &info->mti_lh[MDT_LH_PARENT]; if (!(la->la_flags & MDS_OPEN_CREAT)) - lh->mlh_mode = LCK_PR; + lh->mlh_mode = LCK_CR; else - lh->mlh_mode = LCK_PW; + lh->mlh_mode = LCK_EX; parent = mdt_object_find_lock(info, rr->rr_fid1, lh, MDS_INODELOCK_UPDATE); if (IS_ERR(parent)) diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 917f4f5..9a6a536 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -356,7 +356,7 @@ static int mdt_reint_rename_tgt(struct mdt_thread_info *info) /* step 1: lookup & lock the tgt dir */ lh_tgt = &info->mti_lh[MDT_LH_CHILD]; lh_tgtdir = &info->mti_lh[MDT_LH_PARENT]; - lh_tgtdir->mlh_mode = LCK_PW; + lh_tgtdir->mlh_mode = LCK_EX; mtgtdir = mdt_object_find_lock(info, rr->rr_fid1, lh_tgtdir, MDS_INODELOCK_UPDATE); if (IS_ERR(mtgtdir))