diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2006-08-09 14:45:07 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-09-20 18:52:08 -0400 |
commit | a663e30513d7ecc77dd71d474e7646bf78c0ba62 (patch) | |
tree | ac37a5d33b62cce82df4e35a816f73f4631e339a | |
parent | 471e3f57286da7ce8820ad42c77d5f5f49d56a41 (diff) |
ocfs2: move nlink check in ocfs2_mknod()
The dir nlink check in ocfs2_mknod() was being done outside of the cluster
lock, which means we could have been checking against a stale version of the
inode. Fix this by doing the check after the cluster lock instead.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
-rw-r--r-- | fs/ocfs2/namei.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 0673862c8bdd..d8161a77c370 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -310,13 +310,6 @@ static int ocfs2_mknod(struct inode *dir, | |||
310 | /* get our super block */ | 310 | /* get our super block */ |
311 | osb = OCFS2_SB(dir->i_sb); | 311 | osb = OCFS2_SB(dir->i_sb); |
312 | 312 | ||
313 | if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) { | ||
314 | mlog(ML_ERROR, "inode %llu has i_nlink of %u\n", | ||
315 | (unsigned long long)OCFS2_I(dir)->ip_blkno, dir->i_nlink); | ||
316 | status = -EMLINK; | ||
317 | goto leave; | ||
318 | } | ||
319 | |||
320 | handle = ocfs2_alloc_handle(osb); | 313 | handle = ocfs2_alloc_handle(osb); |
321 | if (handle == NULL) { | 314 | if (handle == NULL) { |
322 | status = -ENOMEM; | 315 | status = -ENOMEM; |
@@ -331,6 +324,11 @@ static int ocfs2_mknod(struct inode *dir, | |||
331 | goto leave; | 324 | goto leave; |
332 | } | 325 | } |
333 | 326 | ||
327 | if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) { | ||
328 | status = -EMLINK; | ||
329 | goto leave; | ||
330 | } | ||
331 | |||
334 | dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data; | 332 | dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data; |
335 | if (!dirfe->i_links_count) { | 333 | if (!dirfe->i_links_count) { |
336 | /* can't make a file in a deleted directory. */ | 334 | /* can't make a file in a deleted directory. */ |