From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 1/5] btrfs: use btrfs_ordered_update_i_size in clone_finish_inode_update
Date: Mon, 30 Dec 2019 16:31:14 -0500 [thread overview]
Message-ID: <20191230213118.7532-2-josef@toxicpanda.com> (raw)
In-Reply-To: <20191230213118.7532-1-josef@toxicpanda.com>
We were using btrfs_i_size_write(), which unconditionally jacks up
inode->disk_i_size. However since clone can operate on ranges we could
have pending ordered extents for a range prior to the start of our clone
operation and thus increase disk_i_size too far and have a hole with no
file extent.
Fix this by using the btrfs_ordered_update_i_size helper which will do
the right thing in the face of pending ordered extents outside of our
clone range.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
fs/btrfs/ioctl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 8ec61f3f0291..291dda3b6547 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3332,8 +3332,10 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
*/
if (endoff > destoff + olen)
endoff = destoff + olen;
- if (endoff > inode->i_size)
- btrfs_i_size_write(BTRFS_I(inode), endoff);
+ if (endoff > inode->i_size) {
+ i_size_write(inode, endoff);
+ btrfs_ordered_update_i_size(inode, endoff, NULL);
+ }
ret = btrfs_update_inode(trans, root, inode);
if (ret) {
--
2.23.0
next prev parent reply other threads:[~2019-12-30 21:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-30 21:31 [RFC][PATCH 0/5] btrfs: fix hole corruption issue with !NO_HOLES Josef Bacik
2019-12-30 21:31 ` Josef Bacik [this message]
2019-12-30 21:31 ` [PATCH 2/5] btrfs: introduce the inode->file_extent_tree Josef Bacik
2020-01-06 17:22 ` David Sterba
2020-01-06 19:29 ` Josef Bacik
2020-01-07 16:17 ` David Sterba
2020-01-07 16:45 ` Filipe Manana
2020-01-07 16:46 ` David Sterba
2019-12-30 21:31 ` [PATCH 3/5] btrfs: use the file extent tree infrastructure Josef Bacik
2019-12-30 21:31 ` [PATCH 4/5] btrfs: replace all uses of btrfs_ordered_update_i_size Josef Bacik
2019-12-30 21:31 ` [PATCH 5/5] btrfs: delete the ordered isize update code Josef Bacik
2019-12-31 12:25 ` [RFC][PATCH 0/5] btrfs: fix hole corruption issue with !NO_HOLES Qu Wenruo
2020-01-02 16:10 ` Josef Bacik
2020-01-07 19:42 [PATCH 0/5][v2] " Josef Bacik
2020-01-07 19:42 ` [PATCH 1/5] btrfs: use btrfs_ordered_update_i_size in clone_finish_inode_update Josef Bacik
2020-01-15 17:01 ` Filipe Manana
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=20191230213118.7532-2-josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=kernel-team@fb.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).