Whamcloud - gitweb
Revert "LU-5261 osc: use wait_for_completion_killable() instead"
[fs/lustre-release.git] / lustre / osd-zfs / osd_index.c
index 7fb8326..b635943 100644 (file)
@@ -480,8 +480,8 @@ static int osd_seq_exists(const struct lu_env *env, struct osd_device *osd,
        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) {
@@ -494,14 +494,22 @@ 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)
+                         const 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);
 
+       /* 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);
 
@@ -529,7 +537,8 @@ static int osd_dir_insert(const struct lu_env *env, struct dt_object *dt,
        struct osd_thread_info *oti = osd_oti_get(env);
        struct osd_object   *parent = osd_dt_obj(dt);
        struct osd_device   *osd = osd_obj2dev(parent);
-       struct lu_fid       *fid = (struct lu_fid *)rec;
+       struct dt_insert_rec *rec1 = (struct dt_insert_rec *)rec;
+       const struct lu_fid *fid = rec1->rec_fid;
        struct osd_thandle  *oh;
        struct osd_object   *child = NULL;
        __u32                attr;
@@ -556,7 +565,7 @@ static int osd_dir_insert(const struct lu_env *env, struct dt_object *dt,
        if (unlikely(rc == 1)) {
                /* Insert remote entry */
                memset(&oti->oti_zde.lzd_reg, 0, sizeof(oti->oti_zde.lzd_reg));
-               oti->oti_zde.lzd_reg.zde_type = IFTODT(S_IFDIR & S_IFMT);
+               oti->oti_zde.lzd_reg.zde_type = IFTODT(rec1->rec_type & S_IFMT);
        } else {
                /*
                 * To simulate old Orion setups with ./..  stored in the
@@ -661,11 +670,6 @@ static int osd_dir_delete(const struct lu_env *env, struct dt_object *dt,
        rc = -zap_remove(osd->od_objset.os, zap_db->db_object,
                         (char *) key, oh->ot_tx);
 
-#if LUSTRE_VERSION_CODE <= OBD_OCD_VERSION(2, 4, 53, 0)
-       if (unlikely(rc == -ENOENT && name[0] == '.' &&
-           (name[1] == 0 || (name[1] == '.' && name[2] == 0))))
-               rc = 0;
-#endif
        if (unlikely(rc && rc != -ENOENT))
                CERROR("%s: zap_remove failed: rc = %d\n", osd->od_svname, rc);
 
@@ -842,19 +846,6 @@ static struct dt_key *osd_dir_it_key(const struct lu_env *env,
 
        strcpy(it->ozi_name, za->za_name);
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 90, 0)
-       if (za->za_name[0] == '.') {
-               if (za->za_name[1] == 0 || (za->za_name[1] == '.' &&
-                   za->za_name[2] == 0)) {
-                       /* we should not get onto . and ..
-                        * stored in the directory. ->next() and
-                        * other methods should prevent this
-                        */
-                       LBUG();
-               }
-       }
-#endif
-
        RETURN((struct dt_key *)it->ozi_name);
 }
 
@@ -875,18 +866,6 @@ static int osd_dir_it_key_size(const struct lu_env *env, const struct dt_it *di)
        if ((rc = -zap_cursor_retrieve(it->ozi_zc, za)) == 0)
                rc = strlen(za->za_name);
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 90, 0)
-       if (rc == 0 && za->za_name[0] == '.') {
-               if (za->za_name[1] == 0 || (za->za_name[1] == '.' &&
-                   za->za_name[2] == 0)) {
-                       /* we should not get onto . and ..
-                        * stored in the directory. ->next() and
-                        * other methods should prevent this
-                        */
-                       LBUG();
-               }
-       }
-#endif
        RETURN(rc);
 }