public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/5] Btrfs: fix inode cache waiters hanging on path allocation failure
@ 2019-07-04 15:24 fdmanana
  2019-07-08  6:13 ` Nikolay Borisov
  2019-07-08  6:20 ` Nikolay Borisov
  0 siblings, 2 replies; 3+ messages in thread
From: fdmanana @ 2019-07-04 15:24 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

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")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/inode-map.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
index 05b8c9927f29..4820e05ea6bd 100644
--- a/fs/btrfs/inode-map.c
+++ b/fs/btrfs/inode-map.c
@@ -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;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/5] Btrfs: fix inode cache waiters hanging on path allocation failure
  2019-07-04 15:24 [PATCH 4/5] Btrfs: fix inode cache waiters hanging on path allocation failure fdmanana
@ 2019-07-08  6:13 ` Nikolay Borisov
  2019-07-08  6:20 ` Nikolay Borisov
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2019-07-08  6:13 UTC (permalink / raw)
  To: fdmanana, linux-btrfs



On 4.07.19 г. 18:24 ч., fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> 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")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>


> ---
>  fs/btrfs/inode-map.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
> index 05b8c9927f29..4820e05ea6bd 100644
> --- a/fs/btrfs/inode-map.c
> +++ b/fs/btrfs/inode-map.c
> @@ -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;
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/5] Btrfs: fix inode cache waiters hanging on path allocation failure
  2019-07-04 15:24 [PATCH 4/5] Btrfs: fix inode cache waiters hanging on path allocation failure fdmanana
  2019-07-08  6:13 ` Nikolay Borisov
@ 2019-07-08  6:20 ` Nikolay Borisov
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2019-07-08  6:20 UTC (permalink / raw)
  To: fdmanana, linux-btrfs



On 4.07.19 г. 18:24 ч., fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> 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")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  fs/btrfs/inode-map.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
> index 05b8c9927f29..4820e05ea6bd 100644
> --- a/fs/btrfs/inode-map.c
> +++ b/fs/btrfs/inode-map.c
> @@ -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;
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-08  6:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-04 15:24 [PATCH 4/5] Btrfs: fix inode cache waiters hanging on path allocation failure fdmanana
2019-07-08  6:13 ` Nikolay Borisov
2019-07-08  6:20 ` Nikolay Borisov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox