From 69d090b70a6dcf9b17d8b2ee7e85cee712e2a8c0 Mon Sep 17 00:00:00 2001 From: fanyong Date: Thu, 13 Aug 2009 01:27:03 +0000 Subject: [PATCH] Branch HEAD b=20133 i=pravin.shelar i=rahul.deshmukh Insert ".." item just at the second slot of the whole directory. --- lustre/mdd/mdd_dir.c | 5 ++--- lustre/tests/sanity.sh | 12 ++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 390ce74..451011e 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -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 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index fe3574be..793f8c1 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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 -- 1.8.3.1