diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2024-02-28 18:50:49 +0300 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2024-03-05 15:40:43 +0300 |
commit | b1fe686a765e6c0d71811d825b5a1585a202b777 (patch) | |
tree | ba7fa8269beb3a7cd4085e64187eada7fb91c372 /fs/fuse | |
parent | 68ca1b49e430f6534d0774a94147a823e3b8b26e (diff) | |
download | linux-b1fe686a765e6c0d71811d825b5a1585a202b777.tar.xz |
fuse: don't unhash root
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>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/fuse_i.h | 1 | ||||
-rw-r--r-- | 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 0186df5fc9ea..065b84efb663 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -475,8 +475,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); |