linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: don't do async reclaim during log replay V2
@ 2014-09-18 15:27 Josef Bacik
  2014-10-23  8:44 ` Miao Xie
  0 siblings, 1 reply; 5+ messages in thread
From: Josef Bacik @ 2014-09-18 15:27 UTC (permalink / raw)
  To: linux-btrfs

Trying to reproduce a log enospc bug I hit a panic in the async reclaim code
during log replay.  This is because we use fs_info->fs_root as our root for
shrinking and such.  Technically we can use whatever root we want, but let's
just not allow async reclaim while we're doing log replay.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
V1->V2: use fs_info->log_root_recovering instead, didn't notice this existed
before.

 fs/btrfs/extent-tree.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 28a27d5..44d0497 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4513,7 +4513,13 @@ again:
 		space_info->flush = 1;
 	} else if (!ret && space_info->flags & BTRFS_BLOCK_GROUP_METADATA) {
 		used += orig_bytes;
-		if (need_do_async_reclaim(space_info, root->fs_info, used) &&
+		/*
+		 * We will do the space reservation dance during log replay,
+		 * which means we won't have fs_info->fs_root set, so don't do
+		 * the async reclaim as we will panic.
+		 */
+		if (!root->fs_info->log_root_recovering &&
+		    need_do_async_reclaim(space_info, root->fs_info, used) &&
 		    !work_busy(&root->fs_info->async_reclaim_work))
 			queue_work(system_unbound_wq,
 				   &root->fs_info->async_reclaim_work);
-- 
1.8.3.1


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

* Re: [PATCH] Btrfs: don't do async reclaim during log replay V2
  2014-09-18 15:27 [PATCH] Btrfs: don't do async reclaim during log replay V2 Josef Bacik
@ 2014-10-23  8:44 ` Miao Xie
  2014-10-29  9:10   ` Miao Xie
  2014-11-06 14:39   ` Josef Bacik
  0 siblings, 2 replies; 5+ messages in thread
From: Miao Xie @ 2014-10-23  8:44 UTC (permalink / raw)
  To: Josef Bacik, linux-btrfs

On Thu, 18 Sep 2014 11:27:17 -0400, Josef Bacik wrote:
> Trying to reproduce a log enospc bug I hit a panic in the async reclaim code
> during log replay.  This is because we use fs_info->fs_root as our root for
> shrinking and such.  Technically we can use whatever root we want, but let's
> just not allow async reclaim while we're doing log replay.  Thanks,

Why not move the code of fs_root initialization to the front of log replay?
I think it is better than the fix way in this patch because the async reclaimer
can help us do some work.

Thanks
Miao

> 
> Signed-off-by: Josef Bacik <jbacik@fb.com>
> ---
> V1->V2: use fs_info->log_root_recovering instead, didn't notice this existed
> before.
> 
>  fs/btrfs/extent-tree.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 28a27d5..44d0497 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -4513,7 +4513,13 @@ again:
>  		space_info->flush = 1;
>  	} else if (!ret && space_info->flags & BTRFS_BLOCK_GROUP_METADATA) {
>  		used += orig_bytes;
> -		if (need_do_async_reclaim(space_info, root->fs_info, used) &&
> +		/*
> +		 * We will do the space reservation dance during log replay,
> +		 * which means we won't have fs_info->fs_root set, so don't do
> +		 * the async reclaim as we will panic.
> +		 */
> +		if (!root->fs_info->log_root_recovering &&
> +		    need_do_async_reclaim(space_info, root->fs_info, used) &&
>  		    !work_busy(&root->fs_info->async_reclaim_work))
>  			queue_work(system_unbound_wq,
>  				   &root->fs_info->async_reclaim_work);
> 


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

* Re: [PATCH] Btrfs: don't do async reclaim during log replay V2
  2014-10-23  8:44 ` Miao Xie
@ 2014-10-29  9:10   ` Miao Xie
  2014-11-06 14:39   ` Josef Bacik
  1 sibling, 0 replies; 5+ messages in thread
From: Miao Xie @ 2014-10-29  9:10 UTC (permalink / raw)
  To: Josef Bacik, linux-btrfs

Ping..

On Thu, 23 Oct 2014 16:44:54 +0800, Miao Xie wrote:
> On Thu, 18 Sep 2014 11:27:17 -0400, Josef Bacik wrote:
>> Trying to reproduce a log enospc bug I hit a panic in the async reclaim code
>> during log replay.  This is because we use fs_info->fs_root as our root for
>> shrinking and such.  Technically we can use whatever root we want, but let's
>> just not allow async reclaim while we're doing log replay.  Thanks,
> 
> Why not move the code of fs_root initialization to the front of log replay?
> I think it is better than the fix way in this patch because the async reclaimer
> can help us do some work.
> 
> Thanks
> Miao
> 
>>
>> Signed-off-by: Josef Bacik <jbacik@fb.com>
>> ---
>> V1->V2: use fs_info->log_root_recovering instead, didn't notice this existed
>> before.
>>
>>  fs/btrfs/extent-tree.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
>> index 28a27d5..44d0497 100644
>> --- a/fs/btrfs/extent-tree.c
>> +++ b/fs/btrfs/extent-tree.c
>> @@ -4513,7 +4513,13 @@ again:
>>  		space_info->flush = 1;
>>  	} else if (!ret && space_info->flags & BTRFS_BLOCK_GROUP_METADATA) {
>>  		used += orig_bytes;
>> -		if (need_do_async_reclaim(space_info, root->fs_info, used) &&
>> +		/*
>> +		 * We will do the space reservation dance during log replay,
>> +		 * which means we won't have fs_info->fs_root set, so don't do
>> +		 * the async reclaim as we will panic.
>> +		 */
>> +		if (!root->fs_info->log_root_recovering &&
>> +		    need_do_async_reclaim(space_info, root->fs_info, used) &&
>>  		    !work_busy(&root->fs_info->async_reclaim_work))
>>  			queue_work(system_unbound_wq,
>>  				   &root->fs_info->async_reclaim_work);
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


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

* Re: [PATCH] Btrfs: don't do async reclaim during log replay V2
  2014-10-23  8:44 ` Miao Xie
  2014-10-29  9:10   ` Miao Xie
@ 2014-11-06 14:39   ` Josef Bacik
  2014-11-07  1:18     ` Miao Xie
  1 sibling, 1 reply; 5+ messages in thread
From: Josef Bacik @ 2014-11-06 14:39 UTC (permalink / raw)
  To: miaox, linux-btrfs

On 10/23/2014 04:44 AM, Miao Xie wrote:
> On Thu, 18 Sep 2014 11:27:17 -0400, Josef Bacik wrote:
>> Trying to reproduce a log enospc bug I hit a panic in the async reclaim code
>> during log replay.  This is because we use fs_info->fs_root as our root for
>> shrinking and such.  Technically we can use whatever root we want, but let's
>> just not allow async reclaim while we're doing log replay.  Thanks,
>
> Why not move the code of fs_root initialization to the front of log replay?
> I think it is better than the fix way in this patch because the async reclaimer
> can help us do some work.
>

Because this is simpler.  We could move the initialization forward, but 
then say somebody comes and adds some other dependency to the async 
reclaim stuff in the future and doesn't think about log replay and 
suddenly some poor sap's box panics on mount.  Log replay is a known 
quantity, we don't have to worry about enospc, so lets make it as simple 
as possible.  Thanks,

Josef


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

* Re: [PATCH] Btrfs: don't do async reclaim during log replay V2
  2014-11-06 14:39   ` Josef Bacik
@ 2014-11-07  1:18     ` Miao Xie
  0 siblings, 0 replies; 5+ messages in thread
From: Miao Xie @ 2014-11-07  1:18 UTC (permalink / raw)
  To: Josef Bacik, linux-btrfs

On Thu, 6 Nov 2014 09:39:19 -0500, Josef Bacik wrote:
> On 10/23/2014 04:44 AM, Miao Xie wrote:
>> On Thu, 18 Sep 2014 11:27:17 -0400, Josef Bacik wrote:
>>> Trying to reproduce a log enospc bug I hit a panic in the async reclaim code
>>> during log replay.  This is because we use fs_info->fs_root as our root for
>>> shrinking and such.  Technically we can use whatever root we want, but let's
>>> just not allow async reclaim while we're doing log replay.  Thanks,
>>
>> Why not move the code of fs_root initialization to the front of log replay?
>> I think it is better than the fix way in this patch because the async reclaimer
>> can help us do some work.
>>
> 
> Because this is simpler.  We could move the initialization forward, but then say somebody comes and adds some other dependency to the async reclaim stuff in the future and doesn't think about log replay and suddenly some poor sap's box panics on mount.  Log replay is a known quantity, we don't have to worry about enospc, so lets make it as simple as possible.  Thanks,

Yes, you are right.

So this patch looks good.

Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>


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

end of thread, other threads:[~2014-11-07  1:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-18 15:27 [PATCH] Btrfs: don't do async reclaim during log replay V2 Josef Bacik
2014-10-23  8:44 ` Miao Xie
2014-10-29  9:10   ` Miao Xie
2014-11-06 14:39   ` Josef Bacik
2014-11-07  1:18     ` Miao Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).