From: Oleg Drokin Date: Sat, 1 Mar 2014 03:40:39 +0000 (+0000) Subject: Revert "LU-4659 mdd: rename forgets updating target linkea" X-Git-Tag: 2.5.57~39 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0463179c98b81aed4f3745d7440d70b36fc86e16 Revert "LU-4659 mdd: rename forgets updating target linkea" This now breaks the build due to conflict with some DNE patch. This reverts commit f6c64625b87c06749e04a0a74960852bb9e50750. Change-Id: Ie47a36b5e9df70183f3f27cec0f47402cebb102c Reviewed-on: http://review.whamcloud.com/9445 Reviewed-by: Oleg Drokin Tested-by: Oleg Drokin --- diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 2b57407..4ec2946 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -1330,10 +1330,8 @@ static int mdd_declare_finish_unlink(const struct lu_env *env, /* caller should take a lock before calling */ int mdd_finish_unlink(const struct lu_env *env, - struct mdd_object *obj, struct md_attr *ma, - const struct mdd_object *pobj, - const struct lu_name *lname, - struct thandle *th) + struct mdd_object *obj, struct md_attr *ma, + struct thandle *th) { int rc = 0; int is_dir = S_ISDIR(ma->ma_attr.la_mode); @@ -1362,12 +1360,9 @@ int mdd_finish_unlink(const struct lu_env *env, } else { rc = mdo_destroy(env, obj, th); } - } else if (!is_dir) { - /* old files may not have link ea; ignore errors */ - mdd_links_del(env, obj, mdo2fid(pobj), lname, th); - } + } - RETURN(rc); + RETURN(rc); } /* @@ -1589,12 +1584,16 @@ static int mdd_unlink(const struct lu_env *env, struct md_object *pobj, /* XXX: this transfer to ma will be removed with LOD/OSP */ ma->ma_attr = *cattr; ma->ma_valid |= MA_INODE; - rc = mdd_finish_unlink(env, mdd_cobj, ma, mdd_pobj, lname, handle); + rc = mdd_finish_unlink(env, mdd_cobj, ma, handle); /* fetch updated nlink */ if (rc == 0) rc = mdd_la_get(env, mdd_cobj, cattr, BYPASS_CAPA); + if (!is_dir) + /* old files may not have link ea; ignore errors */ + mdd_links_del(env, mdd_cobj, mdo2fid(mdd_pobj), lname, handle); + /* if object is removed then we can't get its attrs, use last get */ if (cattr->la_nlink == 0) { ma->ma_attr = *cattr; @@ -2707,8 +2706,7 @@ static int mdd_rename(const struct lu_env *env, /* XXX: this transfer to ma will be removed with LOD/OSP */ ma->ma_attr = *tattr; ma->ma_valid |= MA_INODE; - rc = mdd_finish_unlink(env, mdd_tobj, ma, mdd_tpobj, ltname, - handle); + rc = mdd_finish_unlink(env, mdd_tobj, ma, handle); if (rc != 0) { CERROR("%s: Failed to unlink tobj " DFID": rc = %d\n", diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index 706a4db..9c95279 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -275,8 +275,7 @@ int mdd_unlink_sanity_check(const struct lu_env *env, struct mdd_object *pobj, struct mdd_object *cobj, const struct lu_attr *cattr); int mdd_finish_unlink(const struct lu_env *env, struct mdd_object *obj, - struct md_attr *ma, const struct mdd_object *pobj, - const struct lu_name *lname, struct thandle *th); + struct md_attr *ma, struct thandle *th); int mdd_is_root(struct mdd_device *mdd, const struct lu_fid *fid); int mdd_lookup(const struct lu_env *env, diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 21ca69b..5efd974 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -12190,23 +12190,6 @@ test_237() { } run_test 237 "Verify name_to_handle_at/open_by_handle_at syscalls" -# LU-4659 linkea consistency -test_238() { - touch $DIR/$tfile - ln $DIR/$tfile $DIR/$tfile.lnk - touch $DIR/$tfile.new - mv $DIR/$tfile.new $DIR/$tfile - local fid1=$(lfs path2fid $DIR/$tfile) - local fid2=$(lfs path2fid $DIR/$tfile.lnk) - local path1=$(lfs fid2path $FSNAME $fid1) - [ $tfile == $path1 ] || error "linkea inconsistent: $tfile $fid1 $path1" - local path2=$(lfs fid2path $FSNAME $fid2) - [ $tfile.lnk == $path2 ] || - error "linkea inconsistent: $tfile.lnk $fid2 $path2!" - rm -f $DIR/$tfile* -} -run_test 238 "Verify linkea consistency" - test_striped_dir() { local mdt_index=$1 local stripe_count