diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2006-08-09 11:45:07 -0700 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-09-20 15:52:08 -0700 |
commit | a663e30513d7ecc77dd71d474e7646bf78c0ba62 (patch) | |
tree | ac37a5d33b62cce82df4e35a816f73f4631e339a /fs/ocfs2/namei.c | |
parent | 471e3f57286da7ce8820ad42c77d5f5f49d56a41 (diff) | |
download | kernel_samsung_crespo-a663e30513d7ecc77dd71d474e7646bf78c0ba62.zip kernel_samsung_crespo-a663e30513d7ecc77dd71d474e7646bf78c0ba62.tar.gz kernel_samsung_crespo-a663e30513d7ecc77dd71d474e7646bf78c0ba62.tar.bz2 |
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>
Diffstat (limited to 'fs/ocfs2/namei.c')
-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 0673862..d8161a7 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -310,13 +310,6 @@ static int ocfs2_mknod(struct inode *dir, /* get our super block */ osb = OCFS2_SB(dir->i_sb); - if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) { - mlog(ML_ERROR, "inode %llu has i_nlink of %u\n", - (unsigned long long)OCFS2_I(dir)->ip_blkno, dir->i_nlink); - status = -EMLINK; - goto leave; - } - handle = ocfs2_alloc_handle(osb); if (handle == NULL) { status = -ENOMEM; @@ -331,6 +324,11 @@ static int ocfs2_mknod(struct inode *dir, goto leave; } + if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) { + status = -EMLINK; + goto leave; + } + dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data; if (!dirfe->i_links_count) { /* can't make a file in a deleted directory. */ |