diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2024-02-28 16:50:49 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-04-03 15:28:25 +0200 |
commit | 8b86779ade3a599f53e767a04e442eb2e774c123 (patch) | |
tree | 15f506edc236b72e29bf662937873e9ac4eb54e8 /fs | |
parent | 777ba18929b5092d26bbc5224a49a20b460d6c31 (diff) | |
download | linux-rpi-8b86779ade3a599f53e767a04e442eb2e774c123.tar.gz linux-rpi-8b86779ade3a599f53e767a04e442eb2e774c123.tar.bz2 linux-rpi-8b86779ade3a599f53e767a04e442eb2e774c123.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.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 9377c46f14c4..3e65cdc94631 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 59743813563e..23ab31b967a1 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -472,8 +472,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); |