From: Jan Kara Subject: Re: [PATCH] ext4: fix data=journal fast mount/umount hang Date: Wed, 20 Mar 2013 14:38:11 +0100 Message-ID: <20130320133811.GE13294@quack.suse.cz> References: <1363783057-3874-1-git-send-email-tytso@mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Ext4 Developers List , Jan Kara , stable@vger.kernel.org To: Theodore Ts'o Return-path: Received: from cantor2.suse.de ([195.135.220.15]:35896 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750819Ab3CTNiN (ORCPT ); Wed, 20 Mar 2013 09:38:13 -0400 Content-Disposition: inline In-Reply-To: <1363783057-3874-1-git-send-email-tytso@mit.edu> Sender: linux-ext4-owner@vger.kernel.org List-ID: 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: > [] warn_slowpath_common+0x68/0x7d > [] ? __jbd2_log_start_commit+0xba/0xcd > [] warn_slowpath_fmt+0x2b/0x2f > [] __jbd2_log_start_commit+0xba/0xcd > [] jbd2_log_start_commit+0x24/0x34 > [] ext4_evict_inode+0x71/0x2e3 > [] evict+0x94/0x135 > [] iput+0x10a/0x110 > [] jbd2_journal_destroy+0x190/0x1ce > [] ? bit_waitqueue+0x50/0x50 > [] ext4_put_super+0x52/0x294 > [] generic_shutdown_super+0x48/0xb4 > [] kill_block_super+0x22/0x60 > [] deactivate_locked_super+0x22/0x49 > [] deactivate_super+0x30/0x33 > [] mntput_no_expire+0x107/0x10c > [] sys_umount+0x2cf/0x2e0 > [] sys_oldumount+0x12/0x14 > [] syscall_call+0x7/0xb > ---[ end trace 6a954cc790501c1f ]--- > jbd2_log_wait_commit: error: j_commit_request=-1289337090, tid=0 > > Signed-off-by: "Theodore Ts'o" > Cc: Jan Kara > Cc: stable@vger.kernel.org Looks good. You can add: Reviewed-by: Jan Kara 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 SUSE Labs, CR