aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index ac133ea91c4b..b08b5a84cf0a 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -61,6 +61,8 @@ kmem_zone_t *xfs_inode_zone;
61 61
62STATIC int xfs_iflush_int(xfs_inode_t *, xfs_buf_t *); 62STATIC int xfs_iflush_int(xfs_inode_t *, xfs_buf_t *);
63 63
64STATIC int xfs_iunlink_remove(xfs_trans_t *, xfs_inode_t *);
65
64/* 66/*
65 * helper function to extract extent size hint from inode 67 * helper function to extract extent size hint from inode
66 */ 68 */
@@ -1118,7 +1120,7 @@ xfs_bumplink(
1118{ 1120{
1119 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); 1121 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG);
1120 1122
1121 ASSERT(ip->i_d.di_nlink > 0); 1123 ASSERT(ip->i_d.di_nlink > 0 || (VFS_I(ip)->i_state & I_LINKABLE));
1122 ip->i_d.di_nlink++; 1124 ip->i_d.di_nlink++;
1123 inc_nlink(VFS_I(ip)); 1125 inc_nlink(VFS_I(ip));
1124 if ((ip->i_d.di_version == 1) && 1126 if ((ip->i_d.di_version == 1) &&
@@ -1504,6 +1506,12 @@ xfs_link(
1504 1506
1505 xfs_bmap_init(&free_list, &first_block); 1507 xfs_bmap_init(&free_list, &first_block);
1506 1508
1509 if (sip->i_d.di_nlink == 0) {
1510 error = xfs_iunlink_remove(tp, sip);
1511 if (error)
1512 goto abort_return;
1513 }
1514
1507 error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino, 1515 error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino,
1508 &first_block, &free_list, resblks); 1516 &first_block, &free_list, resblks);
1509 if (error) 1517 if (error)