Whamcloud - gitweb
Branch HEAD
authorfanyong <fanyong>
Thu, 13 Aug 2009 01:27:03 +0000 (01:27 +0000)
committerfanyong <fanyong>
Thu, 13 Aug 2009 01:27:03 +0000 (01:27 +0000)
b=20133
i=pravin.shelar
i=rahul.deshmukh

Insert ".." item just at the second slot of the whole directory.

lustre/mdd/mdd_dir.c
lustre/tests/sanity.sh

index 390ce74..451011e 100644 (file)
@@ -2056,7 +2056,7 @@ static int mdd_rename(const struct lu_env *env,
                 GOTO(cleanup, rc);
 
         /* "mv dir1 dir2" needs "dir1/.." link update */
-        if (is_dir && mdd_sobj) {
+        if (is_dir && mdd_sobj && !lu_fid_eq(spobj_fid, tpobj_fid)) {
                 rc = __mdd_index_delete_only(env, mdd_sobj, dotdot, handle,
                                         mdd_object_capa(env, mdd_sobj));
                 if (rc)
@@ -2064,9 +2064,8 @@ static int mdd_rename(const struct lu_env *env,
 
                 rc = __mdd_index_insert_only(env, mdd_sobj, tpobj_fid, dotdot,
                                       handle, mdd_object_capa(env, mdd_sobj));
-                if (rc) {
+                if (rc)
                         GOTO(fixup_spobj, rc);
-                }
         }
 
         /* Remove target name from target directory
index fe3574b..793f8c1 100644 (file)
@@ -6610,6 +6610,18 @@ test_213() {
 }
 run_test 213 "OSC lock completion and cancel race don't crash - bug 18829"
 
+test_214() { # for bug 20133
+       mkdir -p $DIR/d214p/d214c
+       for (( i=0; i < 340; i++ )) ; do
+               touch $DIR/d214p/d214c/a$i
+       done
+
+       ls -l $DIR/d214p || error "ls -l $DIR/d214p failed"
+       mv $DIR/d214p/d214c $DIR/ || error "mv $DIR/d214p/d214c $DIR/ failed"
+       ls $DIR/d214c || error "ls $DIR/d214c failed"
+       rm -rf $DIR/d214* || error "rm -rf $DIR/d214* failed"
+}
+run_test 214 "hash-indexed directory test - bug 20133"
 
 #
 # tests that do cleanup/setup should be run at the end