From: Theodore Ts'o <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org, Dave Jones <davej@redhat.com>,
Zheng Liu <gnehzuil.liu@gmail.com>
Subject: Re: [PATCH 2/4] ext4: Fix ext4_writepages() in presence of truncate
Date: Sat, 17 Aug 2013 10:08:11 -0400 [thread overview]
Message-ID: <20130817140811.GE30769@thunk.org> (raw)
In-Reply-To: <1375710744-29329-3-git-send-email-jack@suse.cz>
On Mon, Aug 05, 2013 at 03:52:22PM +0200, Jan Kara wrote:
> Inode size can arbitrarily change while writeback is in progress. When
> ext4_writepages() has prepared a long extent for mapping and truncate
> then reduces i_size, mpage_map_and_submit_buffers() will always map just
> one buffer in a page instead of all of them due to lblk < blocks check.
> So we end up not using all blocks we've allocated (thus leaking them)
> and also delalloc accounting goes wrong manifesting as a warning like:
>
> ext4_da_release_space:1333: ext4_da_release_space: ino 12, to_free 1
> with only 0 reserved data blocks
>
> Note that the problem can happen only when blocksize < pagesize because
> otherwise we have only a single buffer in the page.
>
> Fix the problem by removing the size check from the mapping loop. We
> have an extent allocated so we have to use it all before checking for
> i_size. We also rename add_page_bufs_to_extent() to
> mpage_process_page_bufs() and make that function submit the page for IO
> if all buffers (upto EOF) in it are mapped.
>
> Reported-by: Dave Jones <davej@redhat.com>
> Reported-by: Zheng Liu <gnehzuil.liu@gmail.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
Thanks, applied.
- Ted
next prev parent reply other threads:[~2013-08-17 14:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-05 13:52 [PATCH 0/4 v2] ext4: Fix races between writeback and truncate Jan Kara
2013-08-05 13:52 ` [PATCH 1/4] ext4: Move test whether extent to map can be extended to one place Jan Kara
2013-08-17 13:59 ` Theodore Ts'o
2013-08-05 13:52 ` [PATCH 2/4] ext4: Fix ext4_writepages() in presence of truncate Jan Kara
2013-08-17 14:08 ` Theodore Ts'o [this message]
2013-08-05 13:52 ` [PATCH 3/4] ext4: Simplify truncation code in ext4_setattr() Jan Kara
2013-08-17 14:08 ` Theodore Ts'o
2013-08-05 13:52 ` [PATCH 4/4] ext4: Fix lost truncate due to race with writeback Jan Kara
2013-08-17 14:12 ` Theodore Ts'o
2013-08-26 19:01 ` Dave Jones
2013-08-28 22:55 ` Theodore Ts'o
2013-08-28 23:01 ` Dave Jones
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=20130817140811.GE30769@thunk.org \
--to=tytso@mit.edu \
--cc=davej@redhat.com \
--cc=gnehzuil.liu@gmail.com \
--cc=jack@suse.cz \
--cc=linux-ext4@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.