X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosd-ldiskfs%2Fosd_handler.c;h=b656a797365fcf7ecb255bd850526b1b6f71da02;hp=0c5a07d6c62d98124c4637d4c00e78164aa323b9;hb=11220ac2f0d1245e14306f116f1c262662037740;hpb=4c3902d190dbdd3b5c5b2d95fa43fdde0ecf20ad diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 0c5a07d..b656a79 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -2809,17 +2809,15 @@ static int osd_object_ref_add(const struct lu_env *env, * This also has to properly handle the case of inodes with nlink == 0 * in case they are being linked into the PENDING directory */ -#ifdef I_LINKABLE - /* This is necessary to increment from i_nlink == 0 */ - spin_lock(&inode->i_lock); - inode->i_state |= I_LINKABLE; - spin_unlock(&inode->i_lock); -#endif - spin_lock(&obj->oo_guard); - ldiskfs_inc_count(oh->ot_handle, inode); - if (!S_ISDIR(inode->i_mode)) - LASSERT(inode->i_nlink <= LDISKFS_LINK_MAX); + if (unlikely(inode->i_nlink == 0)) + /* inc_nlink from 0 may cause WARN_ON */ + set_nlink(inode, 1); + else { + ldiskfs_inc_count(oh->ot_handle, inode); + if (!S_ISDIR(inode->i_mode)) + LASSERT(inode->i_nlink <= LDISKFS_LINK_MAX); + } spin_unlock(&obj->oo_guard); ll_dirty_inode(inode, I_DIRTY_DATASYNC);