summaryrefslogtreecommitdiff
path: root/fs/ocfs2/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r--fs/ocfs2/namei.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index f95f3654ee68..2545e7402efe 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -378,8 +378,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
}
inode = new_inode(dir->i_sb);
- if (IS_ERR(inode)) {
- status = PTR_ERR(inode);
+ if (!inode) {
+ status = -ENOMEM;
mlog(ML_ERROR, "new_inode failed!\n");
goto leave;
}
@@ -491,8 +491,10 @@ leave:
brelse(*new_fe_bh);
*new_fe_bh = NULL;
}
- if (inode)
+ if (inode) {
+ clear_nlink(inode);
iput(inode);
+ }
}
mlog_exit(status);