public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: check the right variable in btrfs_del_dir_entries_in_log
@ 2020-08-10 21:31 Josef Bacik
  2020-08-11 10:14 ` Filipe Manana
  2020-08-19 16:22 ` David Sterba
  0 siblings, 2 replies; 7+ messages in thread
From: Josef Bacik @ 2020-08-10 21:31 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

With my new locking code dbench is so much faster that I tripped over a
transaction abort from ENOSPC.  This turned out to be because
btrfs_del_dir_entries_in_log was checking for ret == -ENOSPC, but this
function sets err on error, and returns err.  So instead of properly
marking the inode as needing a full commit, we were returning -ENOSPC
and aborting in __btrfs_unlink_inode.  Fix this by checking the proper
variable so that we return the correct thing in the case of ENOSPC.

Fixes: 4a500fd178c8 ("Btrfs: Metadata ENOSPC handling for tree log")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/tree-log.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index e0ab3c906119..bc9ed31502ec 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3449,11 +3449,11 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
 	btrfs_free_path(path);
 out_unlock:
 	mutex_unlock(&dir->log_mutex);
-	if (ret == -ENOSPC) {
+	if (err == -ENOSPC) {
 		btrfs_set_log_full_commit(trans);
-		ret = 0;
-	} else if (ret < 0)
-		btrfs_abort_transaction(trans, ret);
+		err = 0;
+	} else if (err < 0 && err != -ENOENT)
+		btrfs_abort_transaction(trans, err);
 
 	btrfs_end_log_trans(root);
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-21 10:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-10 21:31 [PATCH] btrfs: check the right variable in btrfs_del_dir_entries_in_log Josef Bacik
2020-08-11 10:14 ` Filipe Manana
2020-08-11 14:27   ` Josef Bacik
2020-08-11 14:38     ` Filipe Manana
2020-08-19 16:22 ` David Sterba
2020-08-20 10:29   ` Filipe Manana
2020-08-21 10:21     ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox