FAILED: patch "[PATCH] btrfs: do not zero f_bavail if we have available space" failed to apply to 5.5-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6 Mon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Fri, 31 Jan 2020 09:31:05 -0500
Subject: [PATCH] btrfs: do not zero f_bavail if we have available space
There was some logic added a while ago to clear out f_bavail in statfs() if we did not have enough free metadata space to satisfy our global reserve. This was incorrect at the time, however didn't really pose a problem for normal file systems because we would often allocate chunks if we got this low on free metadata space, and thus wouldn't really hit this case unless we were actually full.
Fast forward to today and now we are much better about not allocating metadata chunks all of the time. Couple this with d792b0f19711 ("btrfs:
always reserve our entire size for the global reserve") which now means we'll easily have a larger global reserve than our free space, we are now more likely to trip over this while still having plenty of space.
Fix this by skipping this logic if the global rsv's space_info is not full. space_info->full is 0 unless we've attempted to allocate a chunk for that space_info and that has failed. If this happens then the space for the global reserve is definitely sacred and we need to report b_avail == 0, but before then we can just use our calculated b_avail.
fs/btrfs/super.c +9 -1
@@ -2135,7 +2135,15 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)*/ thresh =SZ_4M ; -if (!mixed && total_free_meta - thresh < block_rsv->size) +/* +* We only want to claim there's no available space if we can no longer +* allocate chunks for our metadata profile and our global reserve will +* not fit in the free metadata space. If we aren't ->full then we +* still can allocate chunks and thus are fine using the currently +* calculated f_bavail. +*/ +if (!mixed && block_rsv->space_info->full && + total_free_meta - thresh < block_rsv->size) buf->f_bavail =0 ; buf->f_type =BTRFS_SUPER_MAGIC ;
Quoted 8 lines · On 09. 02. 20, 12:33, [email protected] wrote:
The patch below does not apply to the 5.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
Quoted 8 lines
greg k-h
------------------ original commit in Linus's tree ------------------
From
d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6Mon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Fri, 31 Jan 2020 09:31:05 -0500
Subject: [PATCH] btrfs: do not zerof_bavailif we have available space
5.5.2 was already released with this patch:
commit 165387a9c90152f35976d82feca6eff5f0d5ac02
Author: Josef Bacik <[email protected]> Date: Fri Jan 31 09:31:05 2020 -0500
btrfs: do not zero f_bavail if we have available space
commit d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6 upstream.
It cannot be applied twice :).
thanks,
Signature · 2 lines
js suse labs
Greg KH
maintainerQuoted 20 lines · Jiri Slaby
Quoted 8 lines · On 09. 02. 20, 12:33, [email protected] wrote:
The patch below does not apply to the 5.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
Quoted 8 lines
greg k-h
------------------ original commit in Linus's tree ------------------
From
d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6Mon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Fri, 31 Jan 2020 09:31:05 -0500
Subject: [PATCH] btrfs: do not zerof_bavailif we have available space5.5.2 was already released with this patch:
commit165387a9c90152f35976d82feca6eff5f0d5ac02
Quoted 8 lines
Author: Josef Bacik <[email protected]> Date: Fri Jan 31 09:31:05 2020 -0500btrfs: do not zero
f_bavailif we have available spacecommit
d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6upstream.It cannot be applied twice :).
Oops, Sasha beat me too it, sorry for the noise :)
greg k-h
Sasha Levin
maintainerQuoted 24 lines · Greg KH
Quoted 23 lines · Jiri Slaby
Quoted 8 lines · On 09. 02. 20, 12:33, [email protected] wrote:
The patch below does not apply to the 5.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
Quoted 8 lines
greg k-h
------------------ original commit in Linus's tree ------------------
From
d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6Mon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Fri, 31 Jan 2020 09:31:05 -0500
Subject: [PATCH] btrfs: do not zerof_bavailif we have available space5.5.2 was already released with this patch:
commit165387a9c90152f35976d82feca6eff5f0d5ac02Author: Josef Bacik <[email protected]> Date: Fri Jan 31 09:31:05 2020 -0500
Quoted 7 lines
Quoted 5 lines
btrfs: do not zero
f_bavailif we have available spacecommit
d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6upstream.It cannot be applied twice :).
Oops, Sasha beat me too it, sorry for the noise :)
I've grabbed it for the fixes: tag, sorry :)
Signature · 2 lines
Thanks, Sasha
Greg KH
maintainerQuoted 27 lines · Sasha Levin
Quoted 26 lines · Greg KH
Quoted 25 lines · Jiri Slaby
Quoted 8 lines · On 09. 02. 20, 12:33, [email protected] wrote:
The patch below does not apply to the 5.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
Quoted 8 lines
greg k-h
------------------ original commit in Linus's tree ------------------
From
d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6Mon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Fri, 31 Jan 2020 09:31:05 -0500
Subject: [PATCH] btrfs: do not zerof_bavailif we have available space5.5.2 was already released with this patch:
commit165387a9c90152f35976d82feca6eff5f0d5ac02Author: Josef Bacik <[email protected]> Date: Fri Jan 31 09:31:05 2020 -0500btrfs: do not zero
f_bavailif we have available space
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
commit d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6 upstream.It cannot be applied twice :).
Oops, Sasha beat me too it, sorry for the noise :)
I've grabbed it for the fixes: tag, sorry :)
Not a problem, much rather see patches try to get applied more than once, than not at all :)
Dear Greg,
[email protected] - 09.02.20, 12:33:31 CET:
Quoted 4 lines
The patch below does not apply to the 5.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
I believe you tried to apply it twice, since it is already in 5.5.2.
Best,
Martin
Quoted 53 lines
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
d55966c4279bfc6a0cf0b32bf13f5df228a1eeb6Mon Sep 17 00:00:00 2001
From: Josef Bacik <[email protected]>
Date: Fri, 31 Jan 2020 09:31:05 -0500
Subject: [PATCH] btrfs: do not zerof_bavailif we have available spaceThere was some logic added a while ago to clear out
f_bavailinstatfs()if we did not have enough free metadata space to satisfy our global reserve. This was incorrect at the time, however didn't really pose a problem for normal file systems because we would often allocate chunks if we got this low on free metadata space, and thus wouldn't really hit this case unless we were actually full.Fast forward to today and now we are much better about not allocating metadata chunks all of the time. Couple this with
d792b0f19711("btrfs: always reserve our entire size for the global reserve") which now means we'll easily have a larger global reserve than our free space, we are now more likely to trip over this while still having plenty of space.Fix this by skipping this logic if the global rsv's
space_infois not full.space_info->fullis 0 unless we've attempted to allocate a chunk for thatspace_infoand that has failed. If this happens then the space for the global reserve is definitely sacred and we need to reportb_avail== 0, but before then we can just use our calculatedb_avail.Reported-by Martin Steigerwald <[email protected]>Fixes ca8a51b3a979 ("btrfs: statfs: report zero available if metadataare exhausted") CC: [email protected] # 4.5+
Reviewed-by Qu Wenruo <[email protected]>Tested-by Martin Steigerwald <[email protected]>Signed-off-by Josef Bacik <[email protected]>Reviewed-by David Sterba <[email protected]>Signed-off-by David Sterba <[email protected]>fs/btrfs/super.c +0
-0@@ -2135,7 +2135,15 @@ static int btrfs_statfs(struct dentry *dentry,struct kstatfs *buf) */
fs/btrfs/super.c +2
-1thresh =SZ_4M ; -if (!mixed && total_free_meta - thresh < block_rsv->size) +/* +* We only want to claim there's no available space if we can no
Quoted 1 line
longer + * allocate chunks for our metadata profile and our
global
Quoted 9 lines
reserve will + * not fit in the free metadata space. If we aren't
->full then we + * still can allocate chunks and thus are fine using
the currently + * calculatedf_bavail.fs/btrfs/super.c +3
-0+*/ +if (!mixed && block_rsv->space_info->full && + total_free_meta - thresh < block_rsv->size) buf->f_bavail =0 ; buf->f_type =BTRFS_SUPER_MAGIC ;
Signature · 1 line
Martin