Skip to content

Commit 8dc1496

Browse files
andypriceAndreas Gruenbacher
authored andcommitted
gfs2: Remove duplicate i_nlink check from gfs2_link()
The duplication is: struct gfs2_inode *ip = GFS2_I(inode); [...] error = -ENOENT; if (inode->i_nlink == 0) goto out_gunlock; [...] error = -EINVAL; if (!ip->i_inode.i_nlink) goto out_gunlock; The second check is removed. ENOENT is the correct error code for attempts to link a deleted inode (ref: link(2)). If we support O_TMPFILE in future the check will need to be updated with an exception for inodes flagged I_LINKABLE so sorting out this duplication now will make it a slightly cleaner change. Signed-off-by: Andrew Price <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 1e760fa commit 8dc1496

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

fs/gfs2/inode.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -992,9 +992,6 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
992992
error = -EPERM;
993993
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
994994
goto out_gunlock;
995-
error = -EINVAL;
996-
if (!ip->i_inode.i_nlink)
997-
goto out_gunlock;
998995
error = -EMLINK;
999996
if (ip->i_inode.i_nlink == (u32)-1)
1000997
goto out_gunlock;

0 commit comments

Comments
 (0)