Whamcloud - gitweb
LU-5510 scrub: ldiskfs_create_inode returns locked inode 87/13187/6
authorFan Yong <fan.yong@intel.com>
Thu, 13 Nov 2014 16:45:52 +0000 (00:45 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 8 Feb 2015 02:27:15 +0000 (02:27 +0000)
commit3c357081f5c0af79d76e2f556c14ca74ca47cf3b
treec01287431b0db6c256a903694daff4525aa42175
parentff0b34274d4f8754ebba0a5a812bd117cbec37b1
LU-5510 scrub: ldiskfs_create_inode returns locked inode

There was race condition between creating new inode and OI scrub:
the OI scrub may find the new created inode just after the creator
creating it but before setting the LMA EA. Originally, to resolve
such trouble, the creator will set the new created inode's state
as LDISKFS_STATE_LUSTRE_NOSCRUB. But such state is set after the
new inode unlocked. So the OI scrub still has some chance to find
the new created inode with neither LDISKFS_STATE_LUSTRE_NOSCRUB
nor LMA EA.

Be as improvement, this patch makes the ldiskfs_create_inode() to
return the new created inode with lock. The caller can set more
state (not only for LFSCK, but also for other purposes in future)
on the new created inode before unlock it.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Idc1a8fbd3701f7e431ef4b7858cfdf4674d74add
Reviewed-on: http://review.whamcloud.com/13187
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
ldiskfs/kernel_patches/patches/rhel6.3/ext4-osd-iop-common.patch
ldiskfs/kernel_patches/patches/sles11sp2/ext4-osd-iop-common.patch
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_oi.c