Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1245377
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | "Leonid V. Fedorenchik" <Leonid.Fedorenchik@paragon-software.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] ext4: use private version of page_zero_new_buffers() for data=journal mode |
| Date | Tue, 13 Oct 2015 08:40:01 +0200 |
| Message-ID | <qj1pD-6O2-7@gated-at.bofh.it> (permalink) |
| References | <qgZ8C-Hx-29@gated-at.bofh.it> <qhxah-7Kb-1@gated-at.bofh.it> |
| X-Original-To | Theodore Ts'o <tytso@mit.edu> |
| X-Greylist | delayed 1448 seconds by postgrey-1.27 at vger.kernel.org; Tue, 13 Oct 2015 02:30:48 EDT |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1444716787; bh=BFHQNjxxIvvXKP/w8dmq6W+H19HknJ1xntzRNhrUhV0=; h=Date:From:To:CC:Subject:In-Reply-To:References; b=h4lOOlJUa82BmwRyADRrRfnceXGp5MFuBwIXIh8QZAgVme9xUabZscBchh29ORl15 RldcpmuDwHTwrOKBuzm3Z2Uk0s/GZZxOzE+7jrz1NRXlhu7jLKg1Gqs9Adxaic/TIr 2dtdIp+mXOR+P6ht3A9voypRciORatRGsZEK0OaY= |
| Organization | Paragon Software Group |
| X-Mailer | Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset="US-ASCII" |
| Content-Transfer-Encoding | 7bit |
| X-Originating-IP | [172.30.116.218] |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 100 |
| X-Original-Cc | Ext4 Developers List <linux-ext4@vger.kernel.org>, "Linux Kernel Developers List" <linux-kernel@vger.kernel.org>, <dave.hansen@intel.com>, <torvalds@linux-foundation.org>, <akpm@linux-foundation.org> |
| X-Original-Date | Tue, 13 Oct 2015 09:06:45 +0300 |
| X-Original-Message-ID | <20151013090645.58575d09@paragon-software.com> |
| X-Original-References | <20151007154303.GC24678@thunk.org> <1444363269-25956-1-git-send-email-tytso@mit.edu> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1245377 |
Show key headers only | View raw
On Fri, 9 Oct 2015 00:01:09 -0400
Theodore Ts'o <tytso@mit.edu> wrote:
> If there is a error while copying data from userspace into the page
> cache during a write(2) system call, in data=journal mode, in
> ext4_journalled_write_end() were using page_zero_new_buffers() from
> fs/buffer.c. Unfortunately, this sets the buffer dirty flag, which is
> no good if journalling is enabled. This is a long-standing bug that
> goes back for years and years in ext3, but a combination of (a)
> data=journal not being very common, (b) in many case it only results
> in a warning message. and (c) only very rarely causes the kernel hang,
> means that we only really noticed this as a problem when commit
> 998ef75ddb caused this failure to happen frequently enough to cause
> generic/208 to fail when run in data=journal mode.
>
> The fix is to have our own version of this function that doesn't call
> mark_dirty_buffer(), since we will end up calling
> ext4_handle_dirty_metadata() on the buffer head(s) in questions very
> shortly afterwards in ext4_journalled_write_end().
>
> Thanks to Dave Hansen and Linus Torvalds for helping to identify the
> root cause of the problem.
>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
> fs/ext4/inode.c | 34 +++++++++++++++++++++++++++++++++-
> 1 file changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index ae52e32..0a589bb 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -1181,6 +1181,38 @@ errout:
> return ret ? ret : copied;
> }
>
> +/*
> + * This is a private version of page_zero_new_buffers() which doesn't
> + * set the buffer to be dirty, since in data=journalled mode we need
> + * to call ext4_handle_dirty_metadata() instad.
Small typo: s/instad/instead/
> + */
> +static void zero_new_buffers(struct page *page, unsigned from, unsigned to)
> +{
> + unsigned int block_start = 0, block_end;
> + struct buffer_head *head, *bh;
> +
> + bh = head = page_buffers(page);
> + do {
> + block_end = block_start + bh->b_size;
> + if (buffer_new(bh)) {
> + if (block_end > from && block_start < to) {
> + if (!PageUptodate(page)) {
> + unsigned start, size;
> +
> + start = max(from, block_start);
> + size = min(to, block_end) - start;
> +
> + zero_user(page, start, size);
> + set_buffer_uptodate(bh);
> + }
> + clear_buffer_new(bh);
> + }
> + }
> + block_start = block_end;
> + bh = bh->b_this_page;
> + } while (bh != head);
> +}
> +
> static int ext4_journalled_write_end(struct file *file,
> struct address_space *mapping,
> loff_t pos, unsigned len, unsigned copied,
> @@ -1207,7 +1239,7 @@ static int ext4_journalled_write_end(struct file *file,
> if (copied < len) {
> if (!PageUptodate(page))
> copied = 0;
> - page_zero_new_buffers(page, from+copied, to);
> + zero_new_buffers(page, from+copied, to);
> }
>
> ret = ext4_walk_page_buffers(handle, page_buffers(page), from,
--
Best regards,
Leonid Fedorenchik
Software Engineer
Paragon Software Group
Skype: leonid.fedorenchik
http://www.paragon-software.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [REGRESSION] 998ef75ddb and aio-dio-invalidate-failure w/ data=journal Theodore Ts'o <tytso@mit.edu> - 2015-10-07 05:40 +0200
Re: [REGRESSION] 998ef75ddb and aio-dio-invalidate-failure w/ data=journal Linus Torvalds <torvalds@linux-foundation.org> - 2015-10-07 09:40 +0200
Re: [REGRESSION] 998ef75ddb and aio-dio-invalidate-failure w/ data=journal Theodore Ts'o <tytso@mit.edu> - 2015-10-07 17:50 +0200
[PATCH] ext4: use private version of page_zero_new_buffers() for data=journal mode Theodore Ts'o <tytso@mit.edu> - 2015-10-09 06:10 +0200
Re: [PATCH] ext4: use private version of page_zero_new_buffers() for data=journal mode "Leonid V. Fedorenchik" <Leonid.Fedorenchik@paragon-software.com> - 2015-10-13 08:40 +0200
Re: [PATCH] ext4: use private version of page_zero_new_buffers() for data=journal mode Jan Kara <jack@suse.cz> - 2015-10-15 13:20 +0200
csiph-web