From: Nathan Scott Date: Tue, 27 Jun 2006 06:13:46 +0000 (+1000) Subject: [XFS] Remove a race condition where a linked inode could BUG_ON in X-Git-Tag: upstream/snapshot3+hdmi~39524^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97dfd70c8958a634157e0b35711cca01ff6f959b;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git [XFS] Remove a race condition where a linked inode could BUG_ON in d_instantiate, due to fast transaction committal removing the last remaining reference before we were all done. SGI-PV: 953287 SGI-Modid: xfs-linux-melb:xfs-kern:26347a Signed-off-by: Nathan Scott --- diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index b3b4645..d918002 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c @@ -422,10 +422,12 @@ xfs_vn_link( tdvp = vn_from_inode(dir); vp = vn_from_inode(ip); + VN_HOLD(vp); error = bhv_vop_link(tdvp, vp, dentry, NULL); - if (likely(!error)) { + if (unlikely(error)) { + VN_RELE(vp); + } else { VMODIFY(tdvp); - VN_HOLD(vp); xfs_validate_fields(ip, &vattr); d_instantiate(dentry, ip); }