diff options
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r-- | fs/ocfs2/namei.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index a57b751d4f40..702f0c30cda4 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -333,6 +333,13 @@ static int ocfs2_mknod(struct inode *dir, | |||
333 | /* get our super block */ | 333 | /* get our super block */ |
334 | osb = OCFS2_SB(dir->i_sb); | 334 | osb = OCFS2_SB(dir->i_sb); |
335 | 335 | ||
336 | status = ocfs2_meta_lock(dir, NULL, &parent_fe_bh, 1); | ||
337 | if (status < 0) { | ||
338 | if (status != -ENOENT) | ||
339 | mlog_errno(status); | ||
340 | return status; | ||
341 | } | ||
342 | |||
336 | handle = ocfs2_alloc_handle(osb); | 343 | handle = ocfs2_alloc_handle(osb); |
337 | if (handle == NULL) { | 344 | if (handle == NULL) { |
338 | status = -ENOMEM; | 345 | status = -ENOMEM; |
@@ -340,13 +347,6 @@ static int ocfs2_mknod(struct inode *dir, | |||
340 | goto leave; | 347 | goto leave; |
341 | } | 348 | } |
342 | 349 | ||
343 | status = ocfs2_meta_lock(dir, handle, &parent_fe_bh, 1); | ||
344 | if (status < 0) { | ||
345 | if (status != -ENOENT) | ||
346 | mlog_errno(status); | ||
347 | goto leave; | ||
348 | } | ||
349 | |||
350 | if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) { | 350 | if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) { |
351 | status = -EMLINK; | 351 | status = -EMLINK; |
352 | goto leave; | 352 | goto leave; |
@@ -455,6 +455,8 @@ leave: | |||
455 | if (handle) | 455 | if (handle) |
456 | ocfs2_commit_trans(handle); | 456 | ocfs2_commit_trans(handle); |
457 | 457 | ||
458 | ocfs2_meta_unlock(dir, 1); | ||
459 | |||
458 | if (status == -ENOSPC) | 460 | if (status == -ENOSPC) |
459 | mlog(0, "Disk is full\n"); | 461 | mlog(0, "Disk is full\n"); |
460 | 462 | ||