Message ID | 20181128032112.1152-1-suy.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: adjust order of unlocks in do_trimming() | expand |
On 28.11.18 г. 5:21 ч., Su Yue wrote: > In function do_trimming(), block_group->lock should be unlocked first. > > Fixes: 7fe1e6415026 ("Btrfs: rewrite btrfs_trim_block_group()") > Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> > --- > fs/btrfs/free-space-cache.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c > index 4ba0aedc878b..3731fa92df56 100644 > --- a/fs/btrfs/free-space-cache.c > +++ b/fs/btrfs/free-space-cache.c > @@ -3149,8 +3149,8 @@ static int do_trimming(struct btrfs_block_group_cache *block_group, > space_info->bytes_readonly += reserved_bytes; > block_group->reserved -= reserved_bytes; > space_info->bytes_reserved -= reserved_bytes; > - spin_unlock(&space_info->lock); > spin_unlock(&block_group->lock); > + spin_unlock(&space_info->lock); > } > > return ret; >
On Wed, Nov 28, 2018 at 11:21:12AM +0800, Su Yue wrote:
> In function do_trimming(), block_group->lock should be unlocked first.
Please also write why this is correct and if there are any bad
consequences of the current behaviour. Thanks.
On Wed, Nov 28, 2018 at 03:10:12PM +0100, David Sterba wrote: > On Wed, Nov 28, 2018 at 11:21:12AM +0800, Su Yue wrote: > > In function do_trimming(), block_group->lock should be unlocked first. > > Please also write why this is correct and if there are any bad > consequences of the current behaviour. Thanks. I've updated the changelog and added the patch to misc-next.
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 4ba0aedc878b..3731fa92df56 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -3149,8 +3149,8 @@ static int do_trimming(struct btrfs_block_group_cache *block_group, space_info->bytes_readonly += reserved_bytes; block_group->reserved -= reserved_bytes; space_info->bytes_reserved -= reserved_bytes; - spin_unlock(&space_info->lock); spin_unlock(&block_group->lock); + spin_unlock(&space_info->lock); } return ret;
In function do_trimming(), block_group->lock should be unlocked first. Fixes: 7fe1e6415026 ("Btrfs: rewrite btrfs_trim_block_group()") Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> --- fs/btrfs/free-space-cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)