Whamcloud - gitweb
LU-5249 osd: check if FLD is fully intialized 06/10806/2
authorWang Di <di.wang@intel.com>
Tue, 24 Jun 2014 21:41:48 +0000 (14:41 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 25 Jun 2014 18:07:08 +0000 (18:07 +0000)
Check if FLD is fully initialized in OSD, before lookup
sequence in the local FLDB.

Change-Id: I07cbf293e617935588ce638f710868a05bdd0943
Signed-off-by: Wang Di <di.wang@intel.com>
Reviewed-on: http://review.whamcloud.com/10806
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-zfs/osd_index.c

index 7fa5a98..2cffd00 100644 (file)
@@ -1075,8 +1075,8 @@ static int osd_seq_exists(const struct lu_env *env,
        int                     rc;
        ENTRY;
 
        int                     rc;
        ENTRY;
 
-       if (ss == NULL)
-               RETURN(1);
+       LASSERT(ss != NULL);
+       LASSERT(ss->ss_server_fld != NULL);
 
        rc = osd_fld_lookup(env, osd, seq, range);
        if (rc != 0) {
 
        rc = osd_fld_lookup(env, osd, seq, range);
        if (rc != 0) {
@@ -3566,12 +3566,20 @@ static inline int osd_get_fid_from_dentry(struct ldiskfs_dir_entry_2 *de,
 static int osd_remote_fid(const struct lu_env *env, struct osd_device *osd,
                          struct lu_fid *fid)
 {
 static int osd_remote_fid(const struct lu_env *env, struct osd_device *osd,
                          struct lu_fid *fid)
 {
+       struct seq_server_site  *ss = osd_seq_site(osd);
        ENTRY;
 
        /* FID seqs not in FLDB, must be local seq */
        if (unlikely(!fid_seq_in_fldb(fid_seq(fid))))
                RETURN(0);
 
        ENTRY;
 
        /* FID seqs not in FLDB, must be local seq */
        if (unlikely(!fid_seq_in_fldb(fid_seq(fid))))
                RETURN(0);
 
+       /* If FLD is not being initialized yet, it only happens during the
+        * initialization, likely during mgs initialization, and we assume
+        * this is local FID. */
+       if (ss == NULL || ss->ss_server_fld == NULL)
+               RETURN(0);
+
+       /* Only check the local FLDB here */
        if (osd_seq_exists(env, osd, fid_seq(fid)))
                RETURN(0);
 
        if (osd_seq_exists(env, osd, fid_seq(fid)))
                RETURN(0);
 
index 7fb8326..bd5a08a 100644 (file)
@@ -480,8 +480,8 @@ static int osd_seq_exists(const struct lu_env *env, struct osd_device *osd,
        int                     rc;
        ENTRY;
 
        int                     rc;
        ENTRY;
 
-       if (ss == NULL)
-               RETURN(1);
+       LASSERT(ss != NULL);
+       LASSERT(ss->ss_server_fld != NULL);
 
        rc = osd_fld_lookup(env, osd, seq, range);
        if (rc != 0) {
 
        rc = osd_fld_lookup(env, osd, seq, range);
        if (rc != 0) {
@@ -496,12 +496,20 @@ static int osd_seq_exists(const struct lu_env *env, struct osd_device *osd,
 static int osd_remote_fid(const struct lu_env *env, struct osd_device *osd,
                          struct lu_fid *fid)
 {
 static int osd_remote_fid(const struct lu_env *env, struct osd_device *osd,
                          struct lu_fid *fid)
 {
+       struct seq_server_site  *ss = osd_seq_site(osd);
        ENTRY;
 
        /* FID seqs not in FLDB, must be local seq */
        if (unlikely(!fid_seq_in_fldb(fid_seq(fid))))
                RETURN(0);
 
        ENTRY;
 
        /* FID seqs not in FLDB, must be local seq */
        if (unlikely(!fid_seq_in_fldb(fid_seq(fid))))
                RETURN(0);
 
+       /* If FLD is not being initialized yet, it only happens during the
+        * initialization, likely during mgs initialization, and we assume
+        * this is local FID. */
+       if (ss == NULL || ss->ss_server_fld == NULL)
+               RETURN(0);
+
+       /* Only check the local FLDB here */
        if (osd_seq_exists(env, osd, fid_seq(fid)))
                RETURN(0);
 
        if (osd_seq_exists(env, osd, fid_seq(fid)))
                RETURN(0);