Re: [PATCH] Btrfs: remove ourselves from the cluster list under lock

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

 



On 	thu, 22 Aug 2013 17:04:59 -0400, Josef Bacik wrote:
> A user was reporting weird warnings from btrfs_put_delayed_ref() and I noticed
> that we were doing this list_del_init() on our head ref outside of
> delayed_refs->lock.  This is a problem if we have people still on the list, we
> could end up modifying old pointers and such.  Fix this by removing us from the
> list before we do our run_delayed_ref on our head ref.  Thanks,

Looks good.

Reviewed-by: Miao Xie <miaox@xxxxxxxxxxxxxx>

> 
> Signed-off-by: Josef Bacik <jbacik@xxxxxxxxxxxx>
> ---
>  fs/btrfs/extent-tree.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 4c89566..95c6539 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2440,6 +2440,8 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
>  			default:
>  				WARN_ON(1);
>  			}
> +		} else {
> +			list_del_init(&locked_ref->cluster);
>  		}
>  		spin_unlock(&delayed_refs->lock);
>  
> @@ -2462,7 +2464,6 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
>  		 * list before we release it.
>  		 */
>  		if (btrfs_delayed_ref_is_head(ref)) {
> -			list_del_init(&locked_ref->cluster);
>  			btrfs_delayed_ref_unlock(locked_ref);
>  			locked_ref = NULL;
>  		}
> 

--
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