From 7d1927ec6e3298c76ff90b4c622f58d6d033ba9b Mon Sep 17 00:00:00 2001 From: wangdi Date: Fri, 1 Nov 2013 05:27:11 -0700 Subject: [PATCH] LU-1187 lmv: Locate right MDT in lmv. 1.Add fid in md_revalidate_lock for locate mdt in do_statahead_interpret. 2.locate right mdc for FID2PATH. 3.Only validating MDT0 connection for statfsi during Mount, so even some MDTs are not avaible, the system can still be setup. Signed-off-by: Wang Di Change-Id: I40a3dcbe1f87cd38386ea360547dd2b4528645d1 Reviewed-on: http://review.whamcloud.com/4356 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin --- lustre/include/obd_class.h | 3 ++- lustre/llite/llite_lib.c | 8 ++++++-- lustre/llite/statahead.c | 2 +- lustre/lmv/lmv_fld.c | 6 +++--- lustre/lmv/lmv_obd.c | 23 +++++++++++++++++++++-- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index beff126..5b3ea31 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -68,7 +68,8 @@ * interpret routine to be called. * lov_statfs_fini() must thus be called * by the request interpret routine */ - +#define OBD_STATFS_FOR_MDT0 0x0008 /* The statfs is only for retrieving + * information from MDT0. */ #define OBD_FL_PUNCH 0x00000001 /* To indicate it is punch operation */ /* OBD Device Declarations */ diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index f0e131ac..4b0d300 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -282,8 +282,12 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, GOTO(out, err); } + /* For mount, we only need fs info from MDT0, and also in DNE, it + * can make sure the client can be mounted as long as MDT0 is + * avaible */ err = obd_statfs(NULL, sbi->ll_md_exp, osfs, - cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0); + cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), + OBD_STATFS_FOR_MDT0); if (err) GOTO(out_md, err); @@ -320,7 +324,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, GOTO(out_md, err); } - LASSERT(osfs->os_bsize); + LASSERT(osfs->os_bsize); sb->s_blocksize = osfs->os_bsize; sb->s_blocksize_bits = log2(osfs->os_bsize); sb->s_magic = LL_SUPER_MAGIC; diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index b066a23..9eea49e 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -688,7 +688,7 @@ static void do_statahead_interpret(struct ll_statahead_info *sai, } it->d.lustre.it_lock_handle = entry->se_handle; - rc = md_revalidate_lock(ll_i2mdexp(dir), it, NULL, NULL); + rc = md_revalidate_lock(ll_i2mdexp(dir), it, ll_inode2fid(dir), NULL); if (rc != 1) GOTO(out, rc = -EAGAIN); diff --git a/lustre/lmv/lmv_fld.c b/lustre/lmv/lmv_fld.c index 62eb0d7..b630bbc26 100644 --- a/lustre/lmv/lmv_fld.c +++ b/lustre/lmv/lmv_fld.c @@ -61,10 +61,10 @@ int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid, mdsno_t *mds) { - int rc; - ENTRY; + int rc; + ENTRY; - LASSERT(fid_is_sane(fid)); + LASSERTF(fid_is_sane(fid), DFID" is insane!\n", PFID(fid)); /* FIXME: Because ZFS still use LOCAL fid sequence for root, * and root will always be in MDT0, for local fid, it will diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index ecba415..fec3b2e 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -816,7 +816,17 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, rc = obd_iocontrol(cmd, lmv->tgts[0].ltd_exp, len, karg, uarg); break; } + case OBD_IOC_FID2PATH: { + struct getinfo_fid2path *gf; + struct lmv_tgt_desc *tgt; + gf = (struct getinfo_fid2path *)karg; + tgt = lmv_find_target(lmv, &gf->gf_fid); + if (IS_ERR(tgt)) + RETURN(PTR_ERR(tgt)); + rc = obd_iocontrol(cmd, tgt->ltd_exp, len, karg, uarg); + break; + } default : { for (i = 0; i < count; i++) { int err; @@ -1118,8 +1128,17 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp, rc); GOTO(out_free_temp, rc); } - if (i == 0) { - *osfs = *temp; + + if (i == 0) { + *osfs = *temp; + /* If the statfs is from mount, it will needs + * retrieve necessary information from MDT0. + * i.e. mount does not need the merged osfs + * from all of MDT. + * And also clients can be mounted as long as + * MDT0 is in service*/ + if (flags & OBD_STATFS_FOR_MDT0) + GOTO(out_free_temp, rc); } else { osfs->os_bavail += temp->os_bavail; osfs->os_blocks += temp->os_blocks; -- 1.8.3.1