]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Btrfs: fix inode cache waiters hanging on path allocation failure
authorFilipe Manana <fdmanana@suse.com>
Thu, 4 Jul 2019 15:24:44 +0000 (16:24 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:02 +0000 (14:59 +0200)
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>
fs/btrfs/inode-map.c

index c242ae434355cbebdc67aa9e13182a17c2f806e1..c692c8b6e3719978784cfe32bb24c8ea0c3ee7d6 100644 (file)
@@ -42,8 +42,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;