Whamcloud - gitweb
LU-3336 lfsck: namespace visible lost+found directory 05/8305/19
authorFan Yong <fan.yong@intel.com>
Wed, 12 Feb 2014 19:35:18 +0000 (03:35 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 27 Feb 2014 15:28:59 +0000 (15:28 +0000)
commit76f0977b7ea5d46836cb459deb7b9ad9e781d585
tree7e492cc5ea582a3290ecef0876505e428fe0c29b
parent32a11dbd310b44d2a6e084c48310f21ef6649145
LU-3336 lfsck: namespace visible lost+found directory

The LFSCK will create the lost MDT-objects under a namespace visible
directory, then the admin can future handle those orphans with human
knowledge later.

The directory is named as "lost+found" under ".lustre", which is not
the same as backend (for ldiskfs case) "/lost+found". The latter one
is invisible from Lustre namespace. Under ".lustre/lost+found/", the
LFSCK will create sub-directory "MDTxxxx" for each MDT. (xxxx is the
MDT number)

The ".lustre/lost+found" uses special FID:

enum dot_lustre_oid {
        FID_OID_DOT_LUSTRE      = 1UL,
        FID_OID_DOT_LUSTRE_OBF  = 2UL,
        FID_OID_DOT_LUSTRE_LPF  = 3UL,
};

const struct lu_fid LU_LPF_FID = { .f_seq = FID_SEQ_DOT_LUSTRE,
                                   .f_oid = FID_OID_DOT_LUSTRE_LPF,
                                   .f_ver = 0x0000000000000000 };

Both ".lustre" and its child "lost+found" reside on the MDT0. As for
the "lost+found"'s children "MDTxxxx" uses normal FID and resides on
the corresponding MDT. The orphans will be linked under the "MDTxxx"
by the LFSCK on such MDT when it find the orphans.

The ".lustre/lost+found" is created by the MDT0 when mdd_prepare().
The ".lustre/lost+found/MDTxxxx" is created by the LFSCK on related
MDT when it needs to process orphans. (create on demand)

The permission for ".lustre/lost+found" is "r-x------" for root user.
Only the LFSCK can create sub-directories "MDTxxxx" under it. All the
other modifications are denied.

The permission for ".lustre/lost+found/MDTxxxx" is "rwx------" for
root user. Any modification is the same as operated on normal file.

The lost+found mechanism is not only for LFSCK phase II but also for
other LFSCK orphan handling. Since it is visible to Lustre namespace,
the admin can operate the orphans as other normal files easily.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Idd37c87c2517175022127a2a605ebb3ddf1f223a
Reviewed-on: http://review.whamcloud.com/8305
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>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/fid/fid_lib.c
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_fid.h
lustre/lfsck/lfsck_bookmark.c
lustre/lfsck/lfsck_internal.h
lustre/lfsck/lfsck_lib.c
lustre/mdd/mdd_device.c
lustre/mdd/mdd_dir.c
lustre/mdd/mdd_internal.h
lustre/osd-ldiskfs/osd_scrub.c
lustre/osd-zfs/osd_index.c