summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2024-02-28 16:50:49 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-03 15:11:16 +0200
commit3a30f16b25e9c20cf1361c200e84df118327445f (patch)
treeebe942dd5e96b8840e42f0ea162234d6ca4a569e /fs
parenta32defba237891d95741b0f2bd70c78cae2d3cc4 (diff)
downloadlinux-stable-3a30f16b25e9c20cf1361c200e84df118327445f.tar.gz
linux-stable-3a30f16b25e9c20cf1361c200e84df118327445f.tar.bz2
linux-stable-3a30f16b25e9c20cf1361c200e84df118327445f.zip
fuse: don't unhash root
[ Upstream commit b1fe686a765e6c0d71811d825b5a1585a202b777 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/fuse/fuse_i.h1
-rw-r--r--fs/fuse/inode.c7
2 files changed, 5 insertions, 3 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 1df83eebda92..b5c241e16964 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -939,7 +939,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 2a6d44f91729..b676c72c62ad 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -469,8 +469,11 @@ retry:
} 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);