Whamcloud - gitweb
- three lmv obj leaks fixed
authoralex <alex>
Tue, 22 Jun 2004 15:50:42 +0000 (15:50 +0000)
committeralex <alex>
Tue, 22 Jun 2004 15:50:42 +0000 (15:50 +0000)
- cross-node mkdir() splits newly-created directory if requested
- remove_entries_from_orig_dir() accepts cross-node dir entries
- sanity check 3a tests splitting a directory with cross-node entries

lustre/lmv/lmv_intent.c
lustre/lmv/lmv_objmgr.c
lustre/mds/mds_lmv.c
lustre/mds/mds_reint.c
lustre/tests/sanity-lmv.sh

index bc3bbe3..5cfa650 100644 (file)
@@ -144,7 +144,6 @@ repeat:
                  * request to the right MDS */
                 mds = raw_name2idx(obj->objcount, (char *)name, len);
                 CDEBUG(D_OTHER, "forward to MDS #%u\n", mds);
-
                 rpfid = obj->objs[mds].fid;
                 lmv_put_obj(obj);
         }
@@ -501,10 +500,12 @@ repeat:
          * because returned values will be put in struct inode */
 
         obj = lmv_grab_obj(obd, pfid);
-        if (obj && len) {
-                /* directory is already splitted. calculate mds */
-                mds = raw_name2idx(obj->objcount, (char *)name, len);
-                rpfid = obj->objs[mds].fid;
+        if (obj) {
+                if (len) {
+                        /* directory is already splitted. calculate mds */
+                        mds = raw_name2idx(obj->objcount, (char *)name, len);
+                        rpfid = obj->objs[mds].fid;
+                }
                 lmv_put_obj(obj);
         }
 
@@ -517,7 +518,6 @@ repeat:
                 CWARN("lookup for %lu/%lu/%lu and data should be uptodate\n",
                       (unsigned long)rpfid.mds, (unsigned long)rpfid.id,
                       (unsigned long)rpfid.generation);
-                
                 LASSERT(*reqp == NULL);
                 RETURN(rc);
         }
@@ -540,7 +540,7 @@ repeat:
                 obj = lmv_create_obj(exp, &rpfid, NULL);
                 if (IS_ERR(obj))
                         RETURN(PTR_ERR(obj));
-                
+                lmv_put_obj(obj);
                 goto repeat;
         }
 
@@ -562,9 +562,8 @@ repeat:
                         obj = lmv_create_obj(exp, &body->fid1, mea);
                         if (IS_ERR(obj))
                                 RETURN(PTR_ERR(obj));
-                } else {
-                        lmv_put_obj(obj);
                 }
+                lmv_put_obj(obj);
         }
 
         RETURN(rc);
index 7c2c8e5..fd9eeef 100644 (file)
@@ -340,6 +340,12 @@ lmv_delete_obj(struct obd_export *exp, struct ll_fid *fid)
         if (obj) {
                 obj->state |= O_FREEING;
                 
+                if (atomic_read(&obj->count) > 1)
+                        CERROR("obj %lu/%lu/%lu has count > 2 (%d)\n",
+                               (unsigned long) obj->fid.mds,
+                               (unsigned long) obj->fid.id,
+                               (unsigned long) obj->fid.generation,
+                               atomic_read(&obj->count));
                 __put_obj(obj);
                 __put_obj(obj);
                 rc = 1;
@@ -352,8 +358,7 @@ lmv_delete_obj(struct obd_export *exp, struct ll_fid *fid)
 int
 lmv_setup_mgr(struct obd_device *obd)
 {
-        CWARN("LMV object manager setup (%s)\n",
-              obd->obd_uuid.uuid);
+        CDEBUG(D_INFO, "LMV object manager setup (%s)\n", obd->obd_uuid.uuid);
         return 0;
 }
 
@@ -363,8 +368,7 @@ lmv_cleanup_mgr(struct obd_device *obd)
         struct lmv_obj *obj;
         struct list_head *cur, *tmp;
 
-        CWARN("LMV object manager cleanup (%s)\n",
-              obd->obd_uuid.uuid);
+        CDEBUG(D_INFO, "LMV object manager cleanup (%s)\n", obd->obd_uuid.uuid);
         
         spin_lock(&lmv_obj_list_lock);
         list_for_each_safe(cur, tmp, &lmv_obj_list) {
index e50aef5..3267e6f 100644 (file)
@@ -336,7 +336,6 @@ static int remove_entries_from_orig_dir(struct dirsplit_control *dc, int mdsnum)
                                                 de->name, (int) PTR_ERR(dentry));
                                 goto next;
                         }
-                        LASSERT(dentry->d_inode != NULL);
                         rc = fsfilt_del_dir_entry(dc->obd, dentry);
                         l_dput(dentry);
 next:
@@ -533,8 +532,11 @@ int mds_try_to_split_dir(struct obd_device *obd, struct dentry *dentry,
        ENTRY;
 
         /* TODO: optimization possible - we already may have mea here */
-        if (mds_splitting_expected(obd, dentry) != MDS_EXPECT_SPLIT)
-                RETURN(0);
+        rc = mds_splitting_expected(obd, dentry);
+        if (rc == MDS_NO_SPLITTABLE)
+                return 0;
+        if (rc == MDS_NO_SPLIT_EXPECTED && nstripes == 0)
+                return 0;
         
         LASSERT(mea == NULL || *mea == NULL);
 
@@ -593,8 +595,7 @@ int mds_try_to_split_dir(struct obd_device *obd, struct dentry *dentry,
         handle = fsfilt_start(obd, dir, FSFILT_OP_SETATTR, NULL);
         if (IS_ERR(handle)) {
                 up(&dir->i_sem);
-                CERROR("fsfilt_start() failed, error %d.\n",
-                       PTR_ERR(handle));
+                CERROR("fsfilt_start() failed: %d\n", (int) PTR_ERR(handle));
                 GOTO(err_oa, rc = PTR_ERR(handle));
         }
         
@@ -617,15 +618,13 @@ int mds_try_to_split_dir(struct obd_device *obd, struct dentry *dentry,
 
        /* 3) read through the dir and distribute it over objects */
         rc = scan_and_distribute(obd, dentry, *mea);
+       if (mea == &tmea)
+                obd_free_diskmd(mds->mds_lmv_exp, (struct lov_mds_md **)mea);
         if (rc) {
-                CERROR("scan_and_distribute() failed, error %d.\n",
-                       rc);
+                CERROR("scan_and_distribute() failed, error %d.\n", rc);
                 RETURN(rc);
         }
 
-       if (mea == &tmea)
-                obd_free_diskmd(mds->mds_lmv_exp,
-                                (struct lov_mds_md **)mea);
        RETURN(1);
 
 err_oa:
index 8a69aca..84b6442 100644 (file)
@@ -693,6 +693,12 @@ static int mds_reint_create(struct mds_update_record *rec, int offset,
                         oa = obdo_alloc();
                         LASSERT(oa != NULL);
                         oa->o_mds = i;
+                        oa->o_easize = 0;
+                        if (rec->ur_eadata) {
+                                /* user asks for creating splitted dir */
+                                oa->o_easize = *((u16 *) rec->ur_eadata);
+                        }
+
                         obdo_from_inode(oa, dir, OBD_MD_FLTYPE | OBD_MD_FLATIME |
                                         OBD_MD_FLMTIME | OBD_MD_FLCTIME |
                                         OBD_MD_FLUID | OBD_MD_FLGID);
index ccf4fb4..c9d6a53 100644 (file)
@@ -288,6 +288,16 @@ test_2b() {
 }
 run_test 2b " list splitted dir after remount ============================="
 
+test_3a() {
+       mkdir $DIR/3a0 || error
+       for i in `seq 100`; do
+               mkdir $DIR/3a0/d${i} || error
+       done
+       createmany -o $DIR/3a0/f 5000 || error
+       rm -rf $DIR/3a0 || error
+}
+run_test 3a " dir splitting with cross-ref ============================="
+
 TMPDIR=$OLDTMPDIR
 TMP=$OLDTMP
 HOME=$OLDHOME