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

Commit cbbc34ab authored by Filipe Manana's avatar Filipe Manana Committed by Greg Kroah-Hartman
Browse files

Btrfs: fix inode cache waiters hanging on path allocation failure



[ Upstream commit 9d123a35d7e97bb2139747b16127c9b22b6a593e ]

If the caching thread fails to allocate a path, it returns without waking
up any cache waiters, leaving them hang forever. Fix this by following the
same approach as when we fail to start the caching thread: print an error
message, disable inode caching and make the wakers fallback to non-caching
mode behaviour (calling btrfs_find_free_objectid()).

Fixes: 581bb050 ("Btrfs: Cache free inode numbers in memory")
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent b34203a5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -41,8 +41,10 @@ static int caching_kthread(void *data)
		return 0;

	path = btrfs_alloc_path();
	if (!path)
	if (!path) {
		fail_caching_thread(root);
		return -ENOMEM;
	}

	/* Since the commit root is read-only, we can safely skip locking. */
	path->skip_locking = 1;