From: Liu Bo <bo.liu@linux.alibaba.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH] Btrfs: do not abort transaction when failing to insert hole extent
Date: Sat, 31 Mar 2018 06:11:55 +0800 [thread overview]
Message-ID: <1522447918-19147-1-git-send-email-bo.liu@linux.alibaba.com> (raw)
This is running in a typical write path, not inside a critical path
where we have to abort the running transaction, so it's OK to return
errors to callers and eventually to userspace.
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
---
fs/btrfs/inode.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c7b75dd..b9310f8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4939,16 +4939,13 @@ static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode,
ret = btrfs_drop_extents(trans, root, inode, offset, offset + len, 1);
if (ret) {
- btrfs_abort_transaction(trans, ret);
btrfs_end_transaction(trans);
return ret;
}
ret = btrfs_insert_file_extent(trans, root, btrfs_ino(BTRFS_I(inode)),
offset, 0, 0, len, 0, len, 0, 0, 0);
- if (ret)
- btrfs_abort_transaction(trans, ret);
- else
+ if (!ret)
btrfs_update_inode(trans, root, inode);
btrfs_end_transaction(trans);
return ret;
--
1.8.3.1
next reply other threads:[~2018-03-30 22:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-30 22:11 Liu Bo [this message]
2018-04-05 16:48 ` [PATCH] Btrfs: do not abort transaction when failing to insert hole extent David Sterba
2018-04-05 18:58 ` Liu Bo
2018-04-06 13:21 ` David Sterba
2018-04-06 17:43 ` Liu Bo
2018-04-10 1:23 ` Liu Bo
2018-04-10 12:12 ` David Sterba
2018-04-12 1:39 ` Liu Bo
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=1522447918-19147-1-git-send-email-bo.liu@linux.alibaba.com \
--to=bo.liu@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).