btrfs: check link counter overflow in link(2)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
Al Viro 2011-03-04 17:15:18 +00:00 committed by root
parent 92986796d8
commit c055e99eea

View file

@ -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;