Skip to content

Commit

Permalink
fuse: don't unhash root
Browse files Browse the repository at this point in the history
[ Upstream commit b1fe686 ]

The root inode is assumed to be always hashed.  Do not unhash the root
inode even if it is marked BAD.

Fixes: 5d069db ("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>
  • Loading branch information
Miklos Szeredi authored and gregkh committed Apr 3, 2024
1 parent a32defb commit 3a30f16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion fs/fuse/fuse_i.h
Expand Up @@ -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);
}

Expand Down
7 changes: 5 additions & 2 deletions fs/fuse/inode.c
Expand Up @@ -469,8 +469,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);
Expand Down

0 comments on commit 3a30f16

Please sign in to comment.