Skip to content

Commit

Permalink
ocfs2: move nlink check in ocfs2_mknod()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Fasheh committed Sep 20, 2006
1 parent 471e3f5 commit a663e30
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions fs/ocfs2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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. */
Expand Down

0 comments on commit a663e30

Please sign in to comment.