summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode-map.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2019-07-04 11:24:44 -0400
committerDavid Sterba <dsterba@suse.com>2019-09-09 08:59:02 -0400
commit9d123a35d7e97bb2139747b16127c9b22b6a593e (patch)
treef84a216a61618bdd61f37557513d0e982b037a1d /fs/btrfs/inode-map.c
parenta68ebe0790fc88b4314d17984a2cf99ce2361901 (diff)
Btrfs: fix inode cache waiters hanging on path allocation failure
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>
Diffstat (limited to 'fs/btrfs/inode-map.c')
-rw-r--r--fs/btrfs/inode-map.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
index c242ae434355..c692c8b6e371 100644
--- a/fs/btrfs/inode-map.c
+++ b/fs/btrfs/inode-map.c
@@ -42,8 +42,10 @@ static int caching_kthread(void *data)
42 return 0; 42 return 0;
43 43
44 path = btrfs_alloc_path(); 44 path = btrfs_alloc_path();
45 if (!path) 45 if (!path) {
46 fail_caching_thread(root);
46 return -ENOMEM; 47 return -ENOMEM;
48 }
47 49
48 /* Since the commit root is read-only, we can safely skip locking. */ 50 /* Since the commit root is read-only, we can safely skip locking. */
49 path->skip_locking = 1; 51 path->skip_locking = 1;