Whamcloud - gitweb
LU-7447 lfsck: correct nlink attr for new created dir 69/17269/5
authorFan Yong <fan.yong@intel.com>
Sat, 3 Oct 2015 07:49:46 +0000 (15:49 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 2 Dec 2015 03:55:21 +0000 (03:55 +0000)
commit5434d9402f6deb46f25bcf4c92726711b9d77d00
tree280141e0d766de0f1e6165380d31b7e94ba95894
parent7023698133970372031a16beac276e5e3e64cfbe
LU-7447 lfsck: correct nlink attr for new created dir

For new created directory object, there are three main operations:
1) insert dot entry
2) insert dotdot entry
3) ref_add on the directory object.

Sometimes, the 3rd step maybe ahead of 1st, sometimes maybe between
1st and 2nd. Usually, the developers would think that such order is
not important. But in fact, such assumption isn't true, because the
ldiskfs will set the new created directory object's nlink attr as 2
when inserting dotdot entry. Then if ref_add() is called after ".."
inserted, the empty directory object's nlink attr is 3.

To avoid above trouble and make the OSD API to be order-independent,
we will make the osd-ldiskfs to backup the new created dir object's
nlink attr before calling ldiskfs_add_dot_dotdot(), then restore it
after ldiskfs_add_dot_dotdot() called.

On the other hand, this patch also adds some missed logic for lfsck
declaring to insert dot/dotdot entries, remove some redundant logic.

Add e2fsck check for on-disk consistency verification after LFSCK.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I065f683388417f3e23d47471c065419bd9bfcb19
Reviewed-on: http://review.whamcloud.com/17269
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/lfsck/lfsck_lib.c
lustre/lfsck/lfsck_namespace.c
lustre/osd-ldiskfs/osd_handler.c
lustre/tests/sanity-lfsck.sh