Skip to content

Commit e643692

Browse files
committed
ext3: 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 log_wait_commit() for the last transaction, after the journalling machinery has been shut down. That triggers the WARN_ONCE in __log_start_commit(). Arguably we should adjust ext3_should_journal_data() to return FALSE for the journal inode, but the only place it matters is ext3_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 ext3 -o data=journal /dev/vdb /vdb ; umount /vdb This is a port of ext4 fix from Ted Ts'o. Signed-off-by: Jan Kara <[email protected]>
1 parent c288d29 commit e643692

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ext3/inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ void ext3_evict_inode (struct inode *inode)
218218
*/
219219
if (inode->i_nlink && ext3_should_journal_data(inode) &&
220220
EXT3_SB(inode->i_sb)->s_journal &&
221-
(S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
221+
(S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
222+
inode->i_ino != EXT3_JOURNAL_INO) {
222223
tid_t commit_tid = atomic_read(&ei->i_datasync_tid);
223224
journal_t *journal = EXT3_SB(inode->i_sb)->s_journal;
224225

0 commit comments

Comments
 (0)