diff options
author | Filipe Manana <fdmanana@suse.com> | 2019-07-04 16:24:44 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-27 14:46:46 +0100 |
commit | 510cd98350463b841fdc01065eac4cec180ba9d5 (patch) | |
tree | a4da26b09ff4ac7f665002375276eb56d2e9d619 /fs | |
parent | 2162f5aae4a7feb883739ca92054715f8151bd7a (diff) |
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: 581bb050941b4f ("Btrfs: Cache free inode numbers in memory")
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode-map.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index b1c3a4ec76c8..2ae32451fb5b 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c @@ -55,8 +55,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; |