Skip to content

Commit

Permalink
ocfs2: use OCFS2_INODE_SKIP_ORPHAN_DIR in ocfs2_mknod error path
Browse files Browse the repository at this point in the history
Mark the inode with flag OCFS2_INODE_SKIP_ORPHAN_DIR in ocfs2_mknod, so we
can kill the inode in case of error.

[ Fixed up comment style -Mark ]

Signed-off-by: Li Dongyang <lidongyang@novell.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
  • Loading branch information
Li Dongyang authored and Mark Fasheh committed Apr 23, 2010
1 parent ab41fdc commit 062d340
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions fs/ocfs2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,6 @@ static int ocfs2_mknod(struct inode *dir,

ocfs2_free_dir_lookup_result(&lookup);

if ((status < 0) && inode) {
clear_nlink(inode);
iput(inode);
}

if (inode_ac)
ocfs2_free_alloc_context(inode_ac);

Expand All @@ -459,6 +454,17 @@ static int ocfs2_mknod(struct inode *dir,
if (meta_ac)
ocfs2_free_alloc_context(meta_ac);

/*
* We should call iput after the i_mutex of the bitmap been
* unlocked in ocfs2_free_alloc_context, or the
* ocfs2_delete_inode will mutex_lock again.
*/
if ((status < 0) && inode) {
OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SKIP_ORPHAN_DIR;
clear_nlink(inode);
iput(inode);
}

mlog_exit(status);

return status;
Expand Down

0 comments on commit 062d340

Please sign in to comment.