* [PATCH] ext4: fix data=journal fast mount/umount hang
@ 2013-03-20 12:37 Theodore Ts'o
2013-03-20 13:38 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Theodore Ts'o @ 2013-03-20 12:37 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Theodore Ts'o, Jan Kara, stable
In data=journal mode, if we unmount the file system before a
transaction has a chance to complete, when the journal inode is being
evicted, we can end up calling into jbd2_log_wait_commit() for the
current transaction.
Arguably we should adjust ext4_should_journal_data() to return FALSE
for the journal inode, but the only place it matters is
ext4_evict_inode(), and so it's to save a bit of CPU time, and to make
the patch much more obviously correct by inspection(tm), we'll fix it
by explicitly not trying to waiting for a journal commit when we are
evicting the journal inode, since it's guaranteed to never succeed in
this case.
This can be easily replicated via:
mount -t ext4 -o data=journal /dev/vdb /vdb ; umount /vdb
------------[ cut here ]------------
WARNING: at /usr/projects/linux/ext4/fs/jbd2/journal.c:542 __jbd2_log_start_commit+0xba/0xcd()
Hardware name: Bochs
JBD2: bad log_start_commit: 3005630206 3005630206 0 0
Modules linked in:
Pid: 2909, comm: umount Not tainted 3.8.0-rc3 #1020
Call Trace:
[<c015c0ef>] warn_slowpath_common+0x68/0x7d
[<c02b7e7d>] ? __jbd2_log_start_commit+0xba/0xcd
[<c015c177>] warn_slowpath_fmt+0x2b/0x2f
[<c02b7e7d>] __jbd2_log_start_commit+0xba/0xcd
[<c02b8075>] jbd2_log_start_commit+0x24/0x34
[<c0279ed5>] ext4_evict_inode+0x71/0x2e3
[<c021f0ec>] evict+0x94/0x135
[<c021f9aa>] iput+0x10a/0x110
[<c02b7836>] jbd2_journal_destroy+0x190/0x1ce
[<c0175284>] ? bit_waitqueue+0x50/0x50
[<c028d23f>] ext4_put_super+0x52/0x294
[<c020efe3>] generic_shutdown_super+0x48/0xb4
[<c020f071>] kill_block_super+0x22/0x60
[<c020f3e0>] deactivate_locked_super+0x22/0x49
[<c020f5d6>] deactivate_super+0x30/0x33
[<c0222795>] mntput_no_expire+0x107/0x10c
[<c02233a7>] sys_umount+0x2cf/0x2e0
[<c02233ca>] sys_oldumount+0x12/0x14
[<c08096b8>] syscall_call+0x7/0xb
---[ end trace 6a954cc790501c1f ]---
jbd2_log_wait_commit: error: j_commit_request=-1289337090, tid=0
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Jan Kara <jack@suse.cz>
Cc: stable@vger.kernel.org
---
fs/ext4/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 15e0da1..0a6434c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -205,7 +205,8 @@ void ext4_evict_inode(struct inode *inode)
* don't use page cache.
*/
if (ext4_should_journal_data(inode) &&
- (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
+ (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
+ inode->i_ino != EXT4_JOURNAL_INO) {
journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
--
1.7.12.rc0.22.gcdd159b
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: fix data=journal fast mount/umount hang
2013-03-20 12:37 [PATCH] ext4: fix data=journal fast mount/umount hang Theodore Ts'o
@ 2013-03-20 13:38 ` Jan Kara
2013-03-20 13:44 ` Theodore Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2013-03-20 13:38 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Ext4 Developers List, Jan Kara, stable
On Wed 20-03-13 08:37:37, Ted Tso wrote:
> In data=journal mode, if we unmount the file system before a
> transaction has a chance to complete, when the journal inode is being
> evicted, we can end up calling into jbd2_log_wait_commit() for the
> current transaction.
>
> Arguably we should adjust ext4_should_journal_data() to return FALSE
> for the journal inode, but the only place it matters is
> ext4_evict_inode(), and so it's to save a bit of CPU time, and to make
> the patch much more obviously correct by inspection(tm), we'll fix it
> by explicitly not trying to waiting for a journal commit when we are
> evicting the journal inode, since it's guaranteed to never succeed in
> this case.
>
> This can be easily replicated via:
>
> mount -t ext4 -o data=journal /dev/vdb /vdb ; umount /vdb
>
> ------------[ cut here ]------------
> WARNING: at /usr/projects/linux/ext4/fs/jbd2/journal.c:542 __jbd2_log_start_commit+0xba/0xcd()
> Hardware name: Bochs
> JBD2: bad log_start_commit: 3005630206 3005630206 0 0
> Modules linked in:
> Pid: 2909, comm: umount Not tainted 3.8.0-rc3 #1020
> Call Trace:
> [<c015c0ef>] warn_slowpath_common+0x68/0x7d
> [<c02b7e7d>] ? __jbd2_log_start_commit+0xba/0xcd
> [<c015c177>] warn_slowpath_fmt+0x2b/0x2f
> [<c02b7e7d>] __jbd2_log_start_commit+0xba/0xcd
> [<c02b8075>] jbd2_log_start_commit+0x24/0x34
> [<c0279ed5>] ext4_evict_inode+0x71/0x2e3
> [<c021f0ec>] evict+0x94/0x135
> [<c021f9aa>] iput+0x10a/0x110
> [<c02b7836>] jbd2_journal_destroy+0x190/0x1ce
> [<c0175284>] ? bit_waitqueue+0x50/0x50
> [<c028d23f>] ext4_put_super+0x52/0x294
> [<c020efe3>] generic_shutdown_super+0x48/0xb4
> [<c020f071>] kill_block_super+0x22/0x60
> [<c020f3e0>] deactivate_locked_super+0x22/0x49
> [<c020f5d6>] deactivate_super+0x30/0x33
> [<c0222795>] mntput_no_expire+0x107/0x10c
> [<c02233a7>] sys_umount+0x2cf/0x2e0
> [<c02233ca>] sys_oldumount+0x12/0x14
> [<c08096b8>] syscall_call+0x7/0xb
> ---[ end trace 6a954cc790501c1f ]---
> jbd2_log_wait_commit: error: j_commit_request=-1289337090, tid=0
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> Cc: Jan Kara <jack@suse.cz>
> Cc: stable@vger.kernel.org
Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
I'll also push a similar fix to ext3.
Honza
> ---
> fs/ext4/inode.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 15e0da1..0a6434c 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -205,7 +205,8 @@ void ext4_evict_inode(struct inode *inode)
> * don't use page cache.
> */
> if (ext4_should_journal_data(inode) &&
> - (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
> + (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
> + inode->i_ino != EXT4_JOURNAL_INO) {
> journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
> tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
>
> --
> 1.7.12.rc0.22.gcdd159b
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: fix data=journal fast mount/umount hang
2013-03-20 13:38 ` Jan Kara
@ 2013-03-20 13:44 ` Theodore Ts'o
0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2013-03-20 13:44 UTC (permalink / raw)
To: Jan Kara; +Cc: Ext4 Developers List, stable
On Wed, Mar 20, 2013 at 02:38:11PM +0100, Jan Kara wrote:
> I'll also push a similar fix to ext3.
Great. I did make some minor adjustments to the commit description
for clarity's sake, and to fix a typo.
- Ted
>From ed4fe107ccba4424a9a074b060172eb390691ffa Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Wed, 20 Mar 2013 09:42:11 -0400
Subject: [PATCH] ext4: fix data=journal fast mount/umount hang
In data=journal mode, if we unmount the file system before a
transaction has a chance to complete, when the journal inode is being
evicted, we can end up calling into jbd2_log_wait_commit() for the
last transaction, after the journalling machinery has been shut down.
Arguably we should adjust ext4_should_journal_data() to return FALSE
for the journal inode, but the only place it matters is
ext4_evict_inode(), and so to save a bit of CPU time, and to make the
patch much more obviously correct by inspection(tm), we'll fix it by
explicitly not trying to waiting for a journal commit when we are
evicting the journal inode, since it's guaranteed to never succeed in
this case.
This can be easily replicated via:
mount -t ext4 -o data=journal /dev/vdb /vdb ; umount /vdb
------------[ cut here ]------------
WARNING: at /usr/projects/linux/ext4/fs/jbd2/journal.c:542 __jbd2_log_start_commit+0xba/0xcd()
Hardware name: Bochs
JBD2: bad log_start_commit: 3005630206 3005630206 0 0
Modules linked in:
Pid: 2909, comm: umount Not tainted 3.8.0-rc3 #1020
Call Trace:
[<c015c0ef>] warn_slowpath_common+0x68/0x7d
[<c02b7e7d>] ? __jbd2_log_start_commit+0xba/0xcd
[<c015c177>] warn_slowpath_fmt+0x2b/0x2f
[<c02b7e7d>] __jbd2_log_start_commit+0xba/0xcd
[<c02b8075>] jbd2_log_start_commit+0x24/0x34
[<c0279ed5>] ext4_evict_inode+0x71/0x2e3
[<c021f0ec>] evict+0x94/0x135
[<c021f9aa>] iput+0x10a/0x110
[<c02b7836>] jbd2_journal_destroy+0x190/0x1ce
[<c0175284>] ? bit_waitqueue+0x50/0x50
[<c028d23f>] ext4_put_super+0x52/0x294
[<c020efe3>] generic_shutdown_super+0x48/0xb4
[<c020f071>] kill_block_super+0x22/0x60
[<c020f3e0>] deactivate_locked_super+0x22/0x49
[<c020f5d6>] deactivate_super+0x30/0x33
[<c0222795>] mntput_no_expire+0x107/0x10c
[<c02233a7>] sys_umount+0x2cf/0x2e0
[<c02233ca>] sys_oldumount+0x12/0x14
[<c08096b8>] syscall_call+0x7/0xb
---[ end trace 6a954cc790501c1f ]---
jbd2_log_wait_commit: error: j_commit_request=-1289337090, tid=0
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: stable@vger.kernel.org
---
fs/ext4/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 15e0da1..0a6434c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -205,7 +205,8 @@ void ext4_evict_inode(struct inode *inode)
* don't use page cache.
*/
if (ext4_should_journal_data(inode) &&
- (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
+ (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
+ inode->i_ino != EXT4_JOURNAL_INO) {
journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
tid_t commit_tid = EXT4_I(inode)->i_datasync_tid;
--
1.7.12.rc0.22.gcdd159b
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-20 13:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-20 12:37 [PATCH] ext4: fix data=journal fast mount/umount hang Theodore Ts'o
2013-03-20 13:38 ` Jan Kara
2013-03-20 13:44 ` Theodore Ts'o
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).