Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab95a420 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Greg Kroah-Hartman
Browse files

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: default avatarMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent c180d65d
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -792,7 +792,6 @@ static inline u64 fuse_get_attr_version(struct fuse_conn *fc)

static inline void fuse_make_bad(struct inode *inode)
{
	remove_inode_hash(inode);
	set_bit(FUSE_I_BAD, &get_fuse_inode(inode)->state);
}

+5 −2
Original line number Diff line number Diff line
@@ -313,9 +313,12 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
	} else if ((inode->i_mode ^ attr->mode) & S_IFMT) {
		/* Inode has changed type, any I/O on the old should fail */
		fuse_make_bad(inode);
		if (inode != d_inode(sb->s_root)) {
			remove_inode_hash(inode);
			iput(inode);
			goto retry;
		}
	}

	fi = get_fuse_inode(inode);
	spin_lock(&fi->lock);