From: Miklos Szeredi <mszeredi@redhat.com>
Cc: linux-fsdevel@vger.kernel.org,
Bernd Schubert <bernd.schubert@fastmail.fm>,
Amir Goldstein <amir73il@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH 3/4] fuse: don't unhash root
Date: Wed, 28 Feb 2024 17:02:08 +0100 [thread overview]
Message-ID: <20240228160213.1988854-3-mszeredi@redhat.com> (raw)
In-Reply-To: <20240228160213.1988854-1-mszeredi@redhat.com>
The root inode is assumed to be always hashed. Do not unhash the root
inode even if it is marked BAD.
Fixes: 5d069dbe8aaf ("fuse: fix bad inode")
Cc: <stable@vger.kernel.org> # v5.11
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
fs/fuse/fuse_i.h | 1 -
fs/fuse/inode.c | 7 +++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 7bd3552b1e80..4ef6087f0e5c 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -994,7 +994,6 @@ static inline bool fuse_stale_inode(const struct inode *inode, int generation,
static inline void fuse_make_bad(struct inode *inode)
{
- remove_inode_hash(inode);
set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state);
}
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index c26a84439934..aa0614e8791c 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -475,8 +475,11 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
} else if (fuse_stale_inode(inode, generation, attr)) {
/* nodeid was reused, any I/O on the old inode should fail */
fuse_make_bad(inode);
- iput(inode);
- goto retry;
+ if (inode != d_inode(sb->s_root)) {
+ remove_inode_hash(inode);
+ iput(inode);
+ goto retry;
+ }
}
fi = get_fuse_inode(inode);
spin_lock(&fi->lock);
--
2.43.2
next prev parent reply other threads:[~2024-02-28 16:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 16:02 [PATCH 1/4] fuse: replace remaining make_bad_inode() with fuse_make_bad() Miklos Szeredi
2024-02-28 16:02 ` [PATCH 2/4] fuse: fix root lookup with nonzero generation Miklos Szeredi
2024-02-28 16:02 ` Miklos Szeredi [this message]
2024-02-28 16:33 ` [PATCH 3/4] fuse: don't unhash root Bernd Schubert
2024-02-28 19:24 ` Miklos Szeredi
2024-02-28 16:02 ` [PATCH 4/4] fuse: use FUSE_ROOT_ID in fuse_get_root_inode() Miklos Szeredi
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=20240228160213.1988854-3-mszeredi@redhat.com \
--to=mszeredi@redhat.com \
--cc=amir73il@gmail.com \
--cc=bernd.schubert@fastmail.fm \
--cc=linux-fsdevel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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).