Whamcloud - gitweb
LU-5518 lfsck: recover orphans from backend lost+found 36/11536/25
authorFan Yong <fan.yong@intel.com>
Wed, 27 Aug 2014 15:38:30 +0000 (23:38 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 30 Oct 2014 02:13:47 +0000 (02:13 +0000)
commitad6dd123cc475e8babcc1b8698fc4d1963841832
tree0161ce78fb6e1cf6bc6bce5b478c23fd7eebed37
parent9ff2d957982160103b5d885c9a532ad45bdf8d4d
LU-5518 lfsck: recover orphans from backend lost+found

Some local filesystem consistency verification tools, such as
e2fsck for ldiskfs, will add the orphan objects under backend
special /lost+found directory. Such directory is invisible to
clients. The namespace LFSCK will scan such directory, and for
the objects that were visible to clients originally (according
to the FID), the namespace LFSCK will move them back to the
normal namespace (according to the linkEA) or to the global
visible .lustre/lost+found/MDTxxxx/ directory.

The namespace LFSCK will insert the orphan (that is under the
backend /lost+found directory) FID into the namespace LFSCK
tracing file for further processing (via the subsequent namespace
LFSCK second-stage scanning). At the same time, remove the orphan
name entry from backend /lost+found directory. There is an interval
between the orphan name entry removed from the backend /lost+found
directory and the orphan FID in the LFSCK tracing file handled. In
such interval, the LFSCK can be reset, then all the FIDs recorded
in the namespace LFSCK tracing file will be dropped. To guarantee
that the orphans can be found when LFSCK run next time without
e2fsck again, when remove the orphan name entry, the LFSCK will
set the orphan's ctime attribute as 1. Since normal applications
cannot change the object's ctime attribute as 1. Then when LFSCK
run next time, it can record the object (that ctime is 1) in the
namespace LFSCK tracing file during the first-stage scanning. Once
the FID in the LFSCK tracing file has been handled successfully,
then the object's ctime attribute will be changed to normal time.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I2f8e23801a868f2c99c630face4bbfe08ece8844
Reviewed-on: http://review.whamcloud.com/11536
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/fid/fid_lib.c
lustre/include/lustre_fid.h
lustre/lfsck/lfsck_engine.c
lustre/lfsck/lfsck_internal.h
lustre/lfsck/lfsck_layout.c
lustre/lfsck/lfsck_namespace.c
lustre/osd-ldiskfs/osd_scrub.c
lustre/tests/sanity-lfsck.sh