All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <wfg@mail.ustc.edu.cn>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Jeff Mahoney <jeffm@suse.com>,
	reiserfs-dev@namesys.com, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] reiserfs: don't drop PG_dirty when releasing sub-page-sized dirty file
Date: Tue, 23 Oct 2007 19:56:20 +0800	[thread overview]
Message-ID: <393140585.27414@ustc.edu.cn> (raw)
Message-ID: <20071023115620.GA5678@mail.ustc.edu.cn> (raw)
In-Reply-To: <1193134027.7406.1.camel@twins>

On Tue, Oct 23, 2007 at 12:07:07PM +0200, Peter Zijlstra wrote:
> [ adding reiserfs devs to the CC ]

Thank you.

This fix is kind of crude - even when it fixed Maxim's problem, and
survived my stress testing of a lot of patching and kernel compiling.
I'd be glad to see better solutions.

Fengguang
---

reiserfs: don't drop PG_dirty when releasing sub-page-sized dirty file

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 accumulate dirty sub-page-size files until umount time.
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>
Cc: Jeff Mahoney <jeffm@suse.com>
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);
-			}
 		}
 	}
 }


  reply	other threads:[~2007-10-23 11:56 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
2007-10-22 10:55         ` Fengguang Wu
2007-10-22 10:55           ` Fengguang Wu
2007-10-22 10:58             ` Maxim Levitsky
2007-10-22 11:19               ` Fengguang Wu
2007-10-22 11:19                 ` Fengguang Wu
2007-10-22 12:21                   ` Maxim Levitsky
2007-10-22 12:37                     ` Fengguang Wu
2007-10-22 12:37                       ` Fengguang Wu
2007-10-22 13:05                         ` Maxim Levitsky
2007-10-22 13:10                           ` Fengguang Wu
2007-10-22 13:10                             ` Fengguang Wu
2007-10-22 13:28                               ` Maxim Levitsky
2007-10-22 13:41                             ` Fengguang Wu
2007-10-22 13:41                               ` Fengguang Wu
2007-10-31 15:22                                 ` Torsten Kaiser
2007-11-01  7:57                                   ` Fengguang Wu
2007-11-01  7:57                                     ` Fengguang Wu
2007-11-01 18:20                                       ` Torsten Kaiser
2007-11-01 19:00                                         ` Torsten Kaiser
2007-11-02  2:21                                           ` writeout stalls " Fengguang Wu
2007-11-02  2:21                                             ` Fengguang Wu
2007-11-02  7:50                                               ` Torsten Kaiser
2007-11-02 10:15                                             ` Peter Zijlstra
2007-11-02 10:33                                               ` Fengguang Wu
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
2007-11-06  9:17                                                 ` Fengguang Wu
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
2007-11-02  1:54                                         ` Fengguang Wu
2007-11-02  1:54                                           ` Fengguang Wu
2007-11-02  7:42                                             ` Torsten Kaiser
2007-11-02  7:52                                               ` Fengguang Wu
2007-11-02  7:52                                                 ` Fengguang Wu
2007-11-02 17:47                                                   ` Torsten Kaiser
2007-10-23  7:55                     ` [PATCH] reiserfs: don't drop PG_dirty when releasing sub-page-sized dirty file Fengguang Wu
2007-10-23  7:55                       ` Fengguang Wu
2007-10-23 10:07                         ` Peter Zijlstra
2007-10-23 11:56                           ` Fengguang Wu [this message]
2007-10-23 11:56                             ` Fengguang Wu
2007-10-23 14:10                               ` Chris Mason
2007-10-23 14:40                                 ` Fengguang Wu
2007-10-23 14:40                                   ` Fengguang Wu
2007-10-23 10:17                         ` Maxim Levitsky
2007-10-23 14:41                           ` Fengguang Wu
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=393140585.27414@ustc.edu.cn \
    --to=wfg@mail.ustc.edu.cn \
    --cc=akpm@linux-foundation.org \
    --cc=jeffm@suse.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximlevitsky@gmail.com \
    --cc=peterz@infradead.org \
    --cc=reiserfs-dev@namesys.com \
    /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.