From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 1/5] btrfs: abort transaction if we don't find extref in btrfs_del_inode_extref()
Date: Wed, 19 Jun 2024 19:08:54 +0200 [thread overview]
Message-ID: <6ff867fb978d8d3447747e20fa5b002dd0c985ce.1718816796.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1718816796.git.dsterba@suse.com>
When an extended ref is deleted we do a sanity check right before
removing the item, if we can't find it then handle the error. This is
done by btrfs_handle_fs_error() but this is from the time before we had
the transaction abort infrastructure, so switch to that. The end result
is the same, the error is reported and switched to read-only. We newly
return the -ENOENT error code as this better represents what happened.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/inode-item.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index 84a94d19b22c..316756ff08ac 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -141,8 +141,8 @@ static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
extref = btrfs_find_name_in_ext_backref(path->nodes[0], path->slots[0],
ref_objectid, name);
if (!extref) {
- btrfs_handle_fs_error(root->fs_info, -ENOENT, NULL);
- ret = -EROFS;
+ btrfs_abort_transaction(trans, -ENOENT);
+ ret = -ENOENT;
goto out;
}
--
2.45.0
next prev parent reply other threads:[~2024-06-19 17:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 17:08 [PATCH 0/5] Error handling fixes David Sterba
2024-06-19 17:08 ` David Sterba [this message]
2024-06-19 17:09 ` [PATCH 2/5] btrfs: only print error message when checking item size in print_extent_item() David Sterba
2024-06-19 17:09 ` [PATCH 3/5] btrfs: abort transaction on errors in btrfs_free_chunk() David Sterba
2024-06-19 17:09 ` [PATCH 4/5] btrfs: qgroup: preallocate memory before adding a relation David Sterba
2024-06-20 1:59 ` Qu Wenruo
2024-06-20 17:40 ` David Sterba
2024-06-20 17:46 ` [PATCH v2] " David Sterba
2024-06-20 22:22 ` Qu Wenruo
2024-06-19 17:09 ` [PATCH 5/5] btrfs: qgroup: warn about inconsistent qgroups when relation update fails David Sterba
2024-06-20 21:28 ` Boris Burkov
2024-06-20 22:34 ` Qu Wenruo
2024-06-19 23:21 ` [PATCH 0/5] Error handling fixes Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6ff867fb978d8d3447747e20fa5b002dd0c985ce.1718816796.git.dsterba@suse.com \
--to=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox