Re: [PATCH 2/2] btrfs: fix locking when we put back a delayed ref that's too new

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 20, 2016 at 01:28:28PM -0500, jeffm@xxxxxxxx wrote:
> From: Jeff Mahoney <jeffm@xxxxxxxx>
> 
> In __btrfs_run_delayed_refs, when we put back a delayed ref that's too
> new, we have already dropped the lock on locked_ref when we set
> ->processing = 0.
> 
> This patch keeps the lock to cover that assignment.
> 
> Fixes: d7df2c796d7 (Btrfs: attach delayed ref updates to delayed ref heads)
> Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx>
> ---
>  fs/btrfs/extent-tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index d74adf1..930ac8e 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2526,11 +2526,11 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
>  		if (ref && ref->seq &&
>  		    btrfs_check_delayed_seq(fs_info, delayed_refs, ref->seq)) {
>  			spin_unlock(&locked_ref->lock);
> -			btrfs_delayed_ref_unlock(locked_ref);
>  			spin_lock(&delayed_refs->lock);
>  			locked_ref->processing = 0;
>  			delayed_refs->num_heads_ready++;
>  			spin_unlock(&delayed_refs->lock);
> +			btrfs_delayed_ref_unlock(locked_ref);

I don't think that this would end up a deadlock as we use mutex_try_lock
for head->mutex everywhere, but I'd rather have it cleaned up.

Reviewed-by: Liu Bo <bo.li.liu@xxxxxxxxxx>

Thanks,

-liubo
>  			locked_ref = NULL;
>  			cond_resched();
>  			count++;
> -- 
> 1.8.5.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux