From: Peter Zijlstra <peterz@infradead.org>
To: Fengguang Wu <wfg@mail.ustc.edu.cn>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>,
linux-kernel@vger.kernel.org,
Fengguang Wu <fengguang.wu@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jeff Mahoney <jeffm@suse.com>,
reiserfs-dev@namesys.com
Subject: Re: [PATCH] reiserfs: don't drop PG_dirty when releasing sub-page-sized dirty file
Date: Tue, 23 Oct 2007 12:07:07 +0200 [thread overview]
Message-ID: <1193134027.7406.1.camel@twins> (raw)
In-Reply-To: <393126119.26275@ustc.edu.cn>
[ adding reiserfs devs to the CC ]
On Tue, 2007-10-23 at 15:55 +0800, Fengguang Wu wrote:
> This is not a new problem in 2.6.23-git17.
> 2.6.22/2.6.23 is buggy in the same way.
>
> Reiserfs could leave newly created sub-page-size files in dirty state
> for ever. They cannot be synced to disk by pdflush routines or
> explicit `sync' commands. Only `umount' can do the trick.
>
> The direct cause is: the dirty page's PG_dirty is wrongly _cleared_.
> Call trace:
> [<ffffffff8027e920>] cancel_dirty_page+0xd0/0xf0
> [<ffffffff8816d470>] :reiserfs:reiserfs_cut_from_item+0x660/0x710
> [<ffffffff8816d791>] :reiserfs:reiserfs_do_truncate+0x271/0x530
> [<ffffffff8815872d>] :reiserfs:reiserfs_truncate_file+0xfd/0x3b0
> [<ffffffff8815d3d0>] :reiserfs:reiserfs_file_release+0x1e0/0x340
> [<ffffffff802a187c>] __fput+0xcc/0x1b0
> [<ffffffff802a1ba6>] fput+0x16/0x20
> [<ffffffff8029e676>] filp_close+0x56/0x90
> [<ffffffff8029fe0d>] sys_close+0xad/0x110
> [<ffffffff8020c41e>] system_call+0x7e/0x83
>
> Fix the bug by removing the cancel_dirty_page() call. Tests show that
> it causes no bad behaviors on various write sizes.
>
>
> === for the patient ===
> Here are more detailed demonstrations of the problem.
>
> 1) the page has both PG_dirty(D)/PAGECACHE_TAG_DIRTY(d) after being written to;
> and then only PAGECACHE_TAG_DIRTY(d) remains after the file is closed.
>
> ------------------------------ screen 0 ------------------------------
> [T0] root /home/wfg# cat > /test/tiny
> [T1] hi
> [T2] root /home/wfg#
>
> ------------------------------ screen 1 ------------------------------
> [T1] root /home/wfg# echo /test/tiny > /proc/filecache
> [T1] root /home/wfg# cat /proc/filecache
> # file /test/tiny
> # flags R:referenced A:active M:mmap U:uptodate D:dirty W:writeback O:owner B:buffer d:dirty w:writeback
> # idx len state refcnt
> 0 1 ___UD__Bd_ 2
> [T2] root /home/wfg# cat /proc/filecache
> # file /test/tiny
> # flags R:referenced A:active M:mmap U:uptodate D:dirty W:writeback O:owner B:buffer d:dirty w:writeback
> # idx len state refcnt
> 0 1 ___U___Bd_ 2
>
> 2) note the non-zero 'cancelled_write_bytes' after /tmp/hi is copied.
>
> ------------------------------ screen 0 ------------------------------
> [T0] root /home/wfg# echo hi > /tmp/hi
> [T1] root /home/wfg# cp /tmp/hi /dev/stdin /test
> [T2] hi
> [T3] root /home/wfg#
>
> ------------------------------ screen 1 ------------------------------
> [T1] root /proc/4397# cd /proc/`pidof cp`
> [T1] root /proc/4713# cat io
> rchar: 8396
> wchar: 3
> syscr: 20
> syscw: 1
> read_bytes: 0
> write_bytes: 20480
> cancelled_write_bytes: 4096
> [T2] root /proc/4713# cat io
> rchar: 8399
> wchar: 6
> syscr: 21
> syscw: 2
> read_bytes: 0
> write_bytes: 24576
> cancelled_write_bytes: 4096
>
> //Question: the 'write_bytes' is a bit more than expected ;-)
>
> Cc: Maxim Levitsky <maximlevitsky@gmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
> ---
> fs/reiserfs/stree.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> --- linux-2.6.24-git17.orig/fs/reiserfs/stree.c
> +++ linux-2.6.24-git17/fs/reiserfs/stree.c
> @@ -1458,9 +1458,6 @@ static void unmap_buffers(struct page *p
> }
> bh = next;
> } while (bh != head);
> - if (PAGE_SIZE == bh->b_size) {
> - cancel_dirty_page(page, PAGE_CACHE_SIZE);
> - }
> }
> }
> }
>
next prev parent reply other threads:[~2007-10-23 10:07 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-22 6:22 100% iowait on one of cpus in current -git Maxim Levitsky
2007-10-22 9:11 ` Paolo Ornati
2007-10-22 9:43 ` Maxim Levitsky
2007-10-22 9:41 ` Peter Zijlstra
2007-10-22 9:59 ` Maxim Levitsky
2007-10-22 10:22 ` Peter Zijlstra
2007-10-22 10:40 ` Maxim Levitsky
[not found] ` <20071022105525.GA6732@mail.ustc.edu.cn>
2007-10-22 10:55 ` Fengguang Wu
2007-10-22 10:58 ` Maxim Levitsky
[not found] ` <20071022111907.GA21640@mail.ustc.edu.cn>
2007-10-22 11:19 ` Fengguang Wu
2007-10-22 12:21 ` Maxim Levitsky
[not found] ` <20071022123707.GA4240@mail.ustc.edu.cn>
2007-10-22 12:37 ` Fengguang Wu
2007-10-22 13:05 ` Maxim Levitsky
[not found] ` <20071022131045.GA5357@mail.ustc.edu.cn>
2007-10-22 13:10 ` Fengguang Wu
2007-10-22 13:28 ` Maxim Levitsky
[not found] ` <20071022134113.GA5644@mail.ustc.edu.cn>
2007-10-22 13:41 ` Fengguang Wu
2007-10-31 15:22 ` Torsten Kaiser
[not found] ` <E1InUvi-0002gG-47@localhost>
2007-11-01 7:57 ` Fengguang Wu
2007-11-01 18:20 ` Torsten Kaiser
2007-11-01 19:00 ` Torsten Kaiser
[not found] ` <E1InmAI-0003ME-2i@localhost>
2007-11-02 2:21 ` writeout stalls " Fengguang Wu
2007-11-02 7:50 ` Torsten Kaiser
2007-11-02 10:15 ` Peter Zijlstra
[not found] ` <E1IntqD-0001dK-OE@localhost>
2007-11-02 10:33 ` Fengguang Wu
2007-11-05 23:57 ` Andrew Morton
2007-11-06 10:20 ` Peter Zijlstra
2007-11-06 16:25 ` Patch tags [was writeout stalls in current -git] Jonathan Corbet
2007-11-06 17:03 ` Balbir Singh
2007-11-06 23:26 ` Adrian Bunk
2007-11-09 16:10 ` Jonathan Corbet
2007-11-09 16:19 ` Adrian Bunk
2007-11-02 19:22 ` writeout stalls in current -git Torsten Kaiser
2007-11-02 20:43 ` David Chinner
2007-11-02 21:02 ` Torsten Kaiser
2007-11-04 11:19 ` Torsten Kaiser
2007-11-05 1:45 ` David Chinner
2007-11-05 7:01 ` Torsten Kaiser
2007-11-05 18:27 ` Torsten Kaiser
2007-11-06 4:25 ` David Chinner
2007-11-06 7:10 ` Torsten Kaiser
2007-11-06 19:01 ` Peter Zijlstra
2007-11-06 20:26 ` Torsten Kaiser
[not found] ` <E1IpKZ4-0004je-Lb@localhost>
2007-11-06 9:17 ` Fengguang Wu
2007-11-06 21:53 ` Torsten Kaiser
2007-11-06 23:31 ` David Chinner
2007-11-07 2:13 ` David Chinner
2007-11-07 7:15 ` Torsten Kaiser
2007-11-08 0:38 ` David Chinner
2007-11-20 13:16 ` Damien Wyart
2007-11-20 21:09 ` David Chinner
[not found] ` <E1Inljm-0002DW-CL@localhost>
2007-11-02 1:54 ` Fengguang Wu
2007-11-02 7:42 ` Torsten Kaiser
[not found] ` <E1InrKN-0000MK-G5@localhost>
2007-11-02 7:52 ` Fengguang Wu
2007-11-02 17:47 ` Torsten Kaiser
[not found] ` <20071023075513.GA7196@mail.ustc.edu.cn>
2007-10-23 7:55 ` [PATCH] reiserfs: don't drop PG_dirty when releasing sub-page-sized dirty file Fengguang Wu
2007-10-23 10:07 ` Peter Zijlstra [this message]
[not found] ` <20071023115620.GA5678@mail.ustc.edu.cn>
2007-10-23 11:56 ` Fengguang Wu
2007-10-23 14:10 ` Chris Mason
[not found] ` <20071023144014.GA6174@mail.ustc.edu.cn>
2007-10-23 14:40 ` Fengguang Wu
2007-10-23 10:17 ` Maxim Levitsky
[not found] ` <20071023144139.GB6174@mail.ustc.edu.cn>
2007-10-23 14:41 ` Fengguang Wu
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=1193134027.7406.1.camel@twins \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@gmail.com \
--cc=jeffm@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
--cc=reiserfs-dev@namesys.com \
--cc=wfg@mail.ustc.edu.cn \
/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