From: Niu Yawei Date: Sat, 5 Nov 2011 05:21:12 +0000 (-0700) Subject: LU-543 mdd: fix rename changelog X-Git-Tag: 2.1.2-RC0~22 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=8fdd606d8f9b885afa21320095a023728ba3fceb;p=fs%2Flustre-release.git LU-543 mdd: fix rename changelog Current rename changelog stores source fid in both CL_RENAME & CL_EXT records, which is redundant, and the 'tfid' in CL_EXT is never been used. Actually, we'd store target fid in the CL_EXT record, then application could detect the fid unlinked by rename in changelog. Signed-off-by: Niu Yawei Change-Id: I0c616f813657a2faefa60a707f4fc1d9dc971b39 Reviewed-on: http://review.whamcloud.com/1652 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Mikhail Pershin Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 7491ff3..14c0ed8 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -2247,9 +2247,16 @@ cleanup_unlocked: if (rc == 0) rc = mdd_changelog_ns_store(env, mdd, CL_RENAME, 0, mdd_tobj, mdd_spobj, lf, lsname, handle); - if (rc == 0) + if (rc == 0) { + struct lu_fid zero_fid; + fid_zero(&zero_fid); + /* If the rename target exist, The CL_EXT record should save + * the target fid as tfid, otherwise, use zero fid. LU-543 */ rc = mdd_changelog_ns_store(env, mdd, CL_EXT, 0, mdd_tobj, - mdd_tpobj, lf, ltname, handle); + mdd_tpobj, + mdd_tobj ? NULL : &zero_fid, + ltname, handle); + } mdd_trans_stop(env, mdd, rc, handle); if (mdd_sobj)