• Andrew Price's avatar
    gfs2: Remove duplicate i_nlink check from gfs2_link() · 8dc14966
    Andrew Price authored
    
    
    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: default avatarAndrew Price <anprice@redhat.com>
    Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
    8dc14966
inode.c 51.9 KB