]> err.no Git - linux-2.6/commitdiff
[XFS] Remove a race condition where a linked inode could BUG_ON in
authorNathan Scott <nathans@sgi.com>
Tue, 27 Jun 2006 06:13:46 +0000 (16:13 +1000)
committerNathan Scott <nathans@sgi.com>
Tue, 27 Jun 2006 06:13:46 +0000 (16:13 +1000)
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 <nathans@sgi.com>
fs/xfs/linux-2.6/xfs_iops.c

index b3b46457f151501625aed646cc6393463b73f7dc..d9180020de6328fa8dbbeb17f68027805d368fae 100644 (file)
@@ -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);
        }