Whamcloud - gitweb
LU-1187 lmv: Locate right MDT in lmv.
authorwangdi <di.wang@whamcloud.com>
Fri, 1 Nov 2013 12:27:11 +0000 (05:27 -0700)
committerOleg Drokin <green@whamcloud.com>
Sat, 19 Jan 2013 00:02:29 +0000 (19:02 -0500)
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 <di.wang@intel.com>
Change-Id: I40a3dcbe1f87cd38386ea360547dd2b4528645d1
Reviewed-on: http://review.whamcloud.com/4356
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
lustre/include/obd_class.h
lustre/llite/llite_lib.c
lustre/llite/statahead.c
lustre/lmv/lmv_fld.c
lustre/lmv/lmv_obd.c

index beff126..5b3ea31 100644 (file)
@@ -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 */
index f0e131a..4b0d300 100644 (file)
@@ -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;
index b066a23..9eea49e 100644 (file)
@@ -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);
 
index 62eb0d7..b630bbc 100644 (file)
@@ -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
index ecba415..fec3b2e 100644 (file)
@@ -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;