The patch titled ext3: make sure inode is deleted from orphan list after truncate has been added to the -mm tree. Its filename is ext3-make-sure-inode-is-deleted-from-orphan-list-after-truncate.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: ext3: make sure inode is deleted from orphan list after truncate From: Jan Kara <jack@xxxxxxx> As Ted pointed out, it can happen that ext3_truncate() returns without removing inode from orphan list. This way we could in some rare cases (like when we get ENOMEM from an allocation in ext3_truncate called because of failed ext3_write_begin) leave the inode on orphan list and that triggers assertion failure on umount. So make ext3_truncate() always remove inode from in-memory orphan list. Cc: Theodore Ts'o <tytso@xxxxxxx> Signed-off-by: Jan Kara <jack@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/ext3/inode.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff -puN fs/ext3/inode.c~ext3-make-sure-inode-is-deleted-from-orphan-list-after-truncate fs/ext3/inode.c --- a/fs/ext3/inode.c~ext3-make-sure-inode-is-deleted-from-orphan-list-after-truncate +++ a/fs/ext3/inode.c @@ -2374,7 +2374,7 @@ void ext3_truncate(struct inode *inode) struct page *page; if (!ext3_can_truncate(inode)) - return; + goto out_notrans; if (inode->i_size == 0 && ext3_should_writeback_data(inode)) ei->i_state |= EXT3_STATE_FLUSH_ON_CLOSE; @@ -2390,7 +2390,7 @@ void ext3_truncate(struct inode *inode) page = grab_cache_page(mapping, inode->i_size >> PAGE_CACHE_SHIFT); if (!page) - return; + goto out_notrans; } handle = start_transaction(inode); @@ -2401,7 +2401,7 @@ void ext3_truncate(struct inode *inode) unlock_page(page); page_cache_release(page); } - return; /* AKPM: return what? */ + goto out_notrans; } last_block = (inode->i_size + blocksize-1) @@ -2525,6 +2525,14 @@ out_stop: ext3_orphan_del(handle, inode); ext3_journal_stop(handle); + return; +out_notrans: + /* + * Delete the inode from orphan list so that it doesn't stay there + * forever and trigger assertion on umount. + */ + if (inode->i_nlink) + ext3_orphan_del(NULL, inode); } static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb, @@ -3122,12 +3130,6 @@ int ext3_setattr(struct dentry *dentry, rc = inode_setattr(inode, attr); - /* If inode_setattr's call to ext3_truncate failed to get a - * transaction handle at all, we need to clean up the in-core - * orphan list manually. */ - if (inode->i_nlink) - ext3_orphan_del(NULL, inode); - if (!rc && (ia_valid & ATTR_MODE)) rc = ext3_acl_chmod(inode); _ Patches currently in -mm which might be from jack@xxxxxxx are origin.patch jbd-fix-race-in-buffer-processing-in-commit-code.patch linux-next.patch jbd2-clean-up-jbd2_journal_try_to_free_buffers.patch vfs-split-generic_forget_inode-so-that-hugetlbfs-does-not-have-to-copy-it.patch mm-remove-__invalidate_mapping_pages-variant.patch writeback-skip-new-or-to-be-freed-inodes.patch ext2-do-not-update-mtime-of-a-moved-directory.patch ext3-fix-chain-verification-in-ext3_get_blocks.patch jbd-clean-up-journal_try_to_free_buffers.patch ext3-make-sure-inode-is-deleted-from-orphan-list-after-truncate.patch isofs-let-mode-and-dmode-mount-options-override-rock-ridge-mode-setting.patch isofs-fix-setting-of-uid-and-gid-to-0.patch isofs-cleanup-mount-option-processing.patch reiser4-update-names-of-quota-methods.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html