Skip to content

Commit

Permalink
btrfs: check link counter overflow in link(2)
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Al Viro authored and root committed Mar 28, 2011
1 parent 9298679 commit c055e99
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4837,6 +4837,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
if (root->objectid != BTRFS_I(inode)->root->objectid)
return -EXDEV;

if (inode->i_nlink == ~0U)
return -EMLINK;

btrfs_inc_nlink(inode);
inode->i_ctime = CURRENT_TIME;

Expand Down

0 comments on commit c055e99

Please sign in to comment.