* [PATCH] Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path
@ 2019-04-29 12:08 fdmanana
2019-04-30 14:02 ` Anand Jain
2019-05-09 9:26 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: fdmanana @ 2019-04-29 12:08 UTC (permalink / raw)
To: linux-btrfs
From: Filipe Manana <fdmanana@suse.com>
Currently when we fail to COW a path at btrfs_update_root() we end up
always aborting the transaction. However all the current callers of
btrfs_update_root() are able to deal with errors returned from it, many do
end up aborting the transaction themselves (directly or not, such as the
transaction commit path), other BUG_ON() or just gracefully cancel whatever
they were doing.
When syncing the fsync log, we call btrfs_update_root() through
tree-log.c:update_log_root(), and if it returns an -ENOSPC error, the log
sync code does not abort the transaction, instead it gracefully handles
the error and returns -EAGAIN to the fsync handler, so that it falls back
to a transaction commit. Any other error different from -ENOSPC, makes the
log sync code abort the transaction.
So remove the transaction abort from btrfs_update_log() when we fail to
COW a path to update the root item, so that if an -ENOSPC failure happens
we avoid aborting the current transaction and have a chance of the fsync
succeeding after falling back to a transaction commit.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203413
Fixes: 79787eaab46121 ("btrfs: replace many BUG_ONs with proper error handling")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
fs/btrfs/root-tree.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 893d12fbfda0..1a92ad546f91 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -132,10 +132,8 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
return -ENOMEM;
ret = btrfs_search_slot(trans, root, key, path, 0, 1);
- if (ret < 0) {
- btrfs_abort_transaction(trans, ret);
+ if (ret < 0)
goto out;
- }
if (ret != 0) {
btrfs_print_leaf(path->nodes[0]);
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path
2019-04-29 12:08 [PATCH] Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path fdmanana
@ 2019-04-30 14:02 ` Anand Jain
2019-05-09 9:26 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Anand Jain @ 2019-04-30 14:02 UTC (permalink / raw)
To: fdmanana; +Cc: linux-btrfs
On 29/4/19 8:08 PM, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> Currently when we fail to COW a path at btrfs_update_root() we end up
> always aborting the transaction. However all the current callers of
> btrfs_update_root() are able to deal with errors returned from it, many do
> end up aborting the transaction themselves (directly or not, such as the
> transaction commit path), other BUG_ON() or just gracefully cancel whatever
> they were doing.
>
> When syncing the fsync log, we call btrfs_update_root() through
> tree-log.c:update_log_root(), and if it returns an -ENOSPC error, the log
> sync code does not abort the transaction, instead it gracefully handles
> the error and returns -EAGAIN to the fsync handler, so that it falls back
> to a transaction commit. Any other error different from -ENOSPC, makes the
> log sync code abort the transaction.
>
> So remove the transaction abort from btrfs_update_log() when we fail to
> COW a path to update the root item, so that if an -ENOSPC failure happens
> we avoid aborting the current transaction and have a chance of the fsync
> succeeding after falling back to a transaction commit.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203413
> Fixes: 79787eaab46121 ("btrfs: replace many BUG_ONs with proper error handling")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
> ---
> fs/btrfs/root-tree.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
> index 893d12fbfda0..1a92ad546f91 100644
> --- a/fs/btrfs/root-tree.c
> +++ b/fs/btrfs/root-tree.c
> @@ -132,10 +132,8 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
> return -ENOMEM;
>
> ret = btrfs_search_slot(trans, root, key, path, 0, 1);
> - if (ret < 0) {
> - btrfs_abort_transaction(trans, ret);
> + if (ret < 0)
> goto out;
> - }
>
> if (ret != 0) {
> btrfs_print_leaf(path->nodes[0]);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path
2019-04-29 12:08 [PATCH] Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path fdmanana
2019-04-30 14:02 ` Anand Jain
@ 2019-05-09 9:26 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2019-05-09 9:26 UTC (permalink / raw)
To: fdmanana; +Cc: linux-btrfs
On Mon, Apr 29, 2019 at 01:08:14PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> Currently when we fail to COW a path at btrfs_update_root() we end up
> always aborting the transaction. However all the current callers of
> btrfs_update_root() are able to deal with errors returned from it, many do
> end up aborting the transaction themselves (directly or not, such as the
> transaction commit path), other BUG_ON() or just gracefully cancel whatever
> they were doing.
>
> When syncing the fsync log, we call btrfs_update_root() through
> tree-log.c:update_log_root(), and if it returns an -ENOSPC error, the log
> sync code does not abort the transaction, instead it gracefully handles
> the error and returns -EAGAIN to the fsync handler, so that it falls back
> to a transaction commit. Any other error different from -ENOSPC, makes the
> log sync code abort the transaction.
>
> So remove the transaction abort from btrfs_update_log() when we fail to
> COW a path to update the root item, so that if an -ENOSPC failure happens
> we avoid aborting the current transaction and have a chance of the fsync
> succeeding after falling back to a transaction commit.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203413
> Fixes: 79787eaab46121 ("btrfs: replace many BUG_ONs with proper error handling")
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-09 9:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29 12:08 [PATCH] Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path fdmanana
2019-04-30 14:02 ` Anand Jain
2019-05-09 9:26 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.