The patch titled Subject: ocfs2: should reclaim the inode if '__ocfs2_mknod_locked' returns an error has been added to the -mm tree. Its filename is ocfs2-should-reclaim-the-inode-if-__ocfs2_mknod_locked-returns-an-error.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/ocfs2-should-reclaim-the-inode-if-__ocfs2_mknod_locked-returns-an-error.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/ocfs2-should-reclaim-the-inode-if-__ocfs2_mknod_locked-returns-an-error.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 *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: alex chen <alex.chen@xxxxxxxxxx> Subject: ocfs2: should reclaim the inode if '__ocfs2_mknod_locked' returns an error In ocfs2_mknod_locked if '__ocfs2_mknod_locke d' returns an error, we should reclaim the inode successfully claimed above, otherwise, the inode never be reused. The case is described below: ocfs2_mknod ocfs2_mknod_locked ocfs2_claim_new_inode Successfully claim the inode __ocfs2_mknod_locked ocfs2_journal_access_di Failed because of -ENOMEM or other reasons, the inode lockres has not been initialized yet. iput(inode) ocfs2_evict_inode ocfs2_delete_inode ocfs2_inode_lock ocfs2_inode_lock_full_nested __ocfs2_cluster_lock Return -EINVAL because of the inode lockres has not been initialized. So the following operations are not performed ocfs2_wipe_inode ocfs2_remove_inode ocfs2_free_dinode ocfs2_free_suballoc_bits Signed-off-by: Alex Chen <alex.chen@xxxxxxxxxx> Reviewed-by: Joseph Qi <joseph.qi@xxxxxxxxxx> Cc: Mark Fasheh <mfasheh@xxxxxxx> Cc: Joel Becker <jlbec@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/ocfs2/namei.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff -puN fs/ocfs2/namei.c~ocfs2-should-reclaim-the-inode-if-__ocfs2_mknod_locked-returns-an-error fs/ocfs2/namei.c --- a/fs/ocfs2/namei.c~ocfs2-should-reclaim-the-inode-if-__ocfs2_mknod_locked-returns-an-error +++ a/fs/ocfs2/namei.c @@ -655,9 +655,18 @@ static int ocfs2_mknod_locked(struct ocf return status; } - return __ocfs2_mknod_locked(dir, inode, dev, new_fe_bh, + status = __ocfs2_mknod_locked(dir, inode, dev, new_fe_bh, parent_fe_bh, handle, inode_ac, fe_blkno, suballoc_loc, suballoc_bit); + if (status < 0) { + u64 bg_blkno = ocfs2_which_suballoc_group(fe_blkno, suballoc_bit); + int tmp = ocfs2_free_suballoc_bits(handle, inode_ac->ac_inode, + inode_ac->ac_bh, suballoc_bit, bg_blkno, 1); + if (tmp) + mlog_errno(tmp); + } + + return status; } static int ocfs2_mkdir(struct inode *dir, _ Patches currently in -mm which might be from alex.chen@xxxxxxxxxx are ocfs2-should-reclaim-the-inode-if-__ocfs2_mknod_locked-returns-an-error.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