[Ocfs2-devel] [patch 8/8] ocfs2: manually do the iput once ocfs2_add_entry failed in ocfs2_symlink and ocfs2_mknod
Mark Fasheh
mfasheh at suse.de
Thu Jun 12 16:01:23 PDT 2014
On Mon, Jun 09, 2014 at 01:04:07PM -0700, Andrew Morton wrote:
> From: jiangyiwen <jiangyiwen at huawei.com>
> Subject: ocfs2: manually do the iput once ocfs2_add_entry failed in ocfs2_symlink and ocfs2_mknod
>
> When the call to ocfs2_add_entry() failed in ocfs2_symlink() and
> ocfs2_mknod(), iput() will not be called during dput(dentry) because no
> d_instantiate(), and this will lead to umount hung.
>
> Signed-off-by: jiangyiwen <jiangyiwen at huawei.com>
> Cc: Mark Fasheh <mfasheh at suse.com>
> Cc: Joel Becker <jlbec at evilplan.org>
> Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Any time we're cutting and pasting code, we have to ask ourselves whether we
should be making that code into it's own function.
Please do that with this patch. I would recommend a descriptive name so we
know what the purpose of the function is:
static void ocfs2_cleanup_add_entry_failure(struct ocfs2_super *osb, struct ocfs2_dentry_lock *dl)
{
ocfs2_simple_drop_lockres(osb, &dl->dl_lockres);
ocfs2_lock_res_free(&dl->dl_lockres);
BUG_ON(dl->dl_count != 1);
spin_lock(&dentry_attach_lock);
dentry->d_fsdata = NULL;
spin_unlock(&dentry_attach_lock);
kfree(dl);
iput(inode);
}
Also, can't you replace 4 of those lines with a call to
ocfs2_drop_dentry_lock()?
Thanks,
--Mark
--
Mark Fasheh
More information about the Ocfs2-devel
mailing list