From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 1/3] gfs2: Remove duplicate i_nlink check from gfs2_link()
Date: Tue, 14 Mar 2023 13:18:27 +0000 [thread overview]
Message-ID: <20230314131829.18515-2-anprice@redhat.com> (raw)
In-Reply-To: <20230314131829.18515-1-anprice@redhat.com>
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 <anprice@redhat.com>
---
fs/gfs2/inode.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 1291b5ee3584..79eef9a0ebfc 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -992,9 +992,6 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
error = -EPERM;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
goto out_gunlock;
- error = -EINVAL;
- if (!ip->i_inode.i_nlink)
- goto out_gunlock;
error = -EMLINK;
if (ip->i_inode.i_nlink == (u32)-1)
goto out_gunlock;
--
2.39.2
next prev parent reply other threads:[~2023-03-14 13:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 13:18 [Cluster-devel] [PATCH 0/3] gfs2_(un)link cleanups Andrew Price
2023-03-14 13:18 ` Andrew Price [this message]
2023-03-14 13:18 ` [Cluster-devel] [PATCH 2/3] gfs2: Remove ghs[] from gfs2_link Andrew Price
2023-03-14 13:18 ` [Cluster-devel] [PATCH 3/3] gfs2: Remove ghs[] from gfs2_unlink Andrew Price
2023-03-27 12:43 ` [Cluster-devel] [PATCH 0/3] gfs2_(un)link cleanups Andreas Gruenbacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230314131829.18515-2-anprice@redhat.com \
--to=anprice@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).