* [PATCH] Btrfs: fix missing i_size update
@ 2013-01-30 19:28 Josef Bacik
2013-01-30 19:36 ` Filipe Brandenburger
0 siblings, 1 reply; 3+ messages in thread
From: Josef Bacik @ 2013-01-30 19:28 UTC (permalink / raw)
To: linux-btrfs
If we have an ordered extent before the ordered extent we are currently
completing that is after the current disk_i_size we will put our i_size
update into that ordered extent so that we do not expose stale data. The
problem is that if our disk i_size is updated past the previous ordered
extent we won't update the i_size with the pending i_size update. So check
the pending i_size update and if its above the current disk i_size we need
to go ahead and try to update. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
fs/btrfs/ordered-data.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index cbd4838..c447e4c 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -895,9 +895,16 @@ int btrfs_ordered_update_i_size(struct inode *inode, u64 offset,
* if the disk i_size is already at the inode->i_size, or
* this ordered extent is inside the disk i_size, we're done
*/
- if (disk_i_size == i_size || offset <= disk_i_size) {
+ if (disk_i_size == i_size)
+ goto out;
+
+ /*
+ * We still need to update disk_i_size if outstanding_isize is greater
+ * than disk_i_size.
+ */
+ if (offset <= disk_i_size &&
+ (!ordered || ordered->outstanding_isize < disk_i_size))
goto out;
- }
/*
* walk backward from this ordered extent to disk_i_size.
--
1.7.7.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: fix missing i_size update
2013-01-30 19:28 [PATCH] Btrfs: fix missing i_size update Josef Bacik
@ 2013-01-30 19:36 ` Filipe Brandenburger
2013-01-30 20:07 ` Josef Bacik
0 siblings, 1 reply; 3+ messages in thread
From: Filipe Brandenburger @ 2013-01-30 19:36 UTC (permalink / raw)
To: Josef Bacik; +Cc: linux-btrfs
On Wed, Jan 30, 2013 at 11:28 AM, Josef Bacik <jbacik@fusionio.com> wrote:
> + /*
> + * We still need to update disk_i_size if outstanding_isize is greater
> + * than disk_i_size.
> + */
> + if (offset <= disk_i_size &&
> + (!ordered || ordered->outstanding_isize < disk_i_size))
"<=" for the comparison? "ordered->outstanding_isize <= disk_i_size"
Cheers,
Filipe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: fix missing i_size update
2013-01-30 19:36 ` Filipe Brandenburger
@ 2013-01-30 20:07 ` Josef Bacik
0 siblings, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2013-01-30 20:07 UTC (permalink / raw)
To: Filipe Brandenburger; +Cc: Josef Bacik, linux-btrfs
On Wed, Jan 30, 2013 at 12:36:22PM -0700, Filipe Brandenburger wrote:
> On Wed, Jan 30, 2013 at 11:28 AM, Josef Bacik <jbacik@fusionio.com> wrote:
> > + /*
> > + * We still need to update disk_i_size if outstanding_isize is greater
> > + * than disk_i_size.
> > + */
> > + if (offset <= disk_i_size &&
> > + (!ordered || ordered->outstanding_isize < disk_i_size))
>
> "<=" for the comparison? "ordered->outstanding_isize <= disk_i_size"
>
Yeah good point. Thanks,
Josef
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-30 20:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-30 19:28 [PATCH] Btrfs: fix missing i_size update Josef Bacik
2013-01-30 19:36 ` Filipe Brandenburger
2013-01-30 20:07 ` Josef Bacik
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).