提交 a663e305 编写于 作者: M Mark Fasheh

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: NMark Fasheh <mark.fasheh@oracle.com>
上级 471e3f57
...@@ -310,13 +310,6 @@ static int ocfs2_mknod(struct inode *dir, ...@@ -310,13 +310,6 @@ static int ocfs2_mknod(struct inode *dir,
/* get our super block */ /* get our super block */
osb = OCFS2_SB(dir->i_sb); 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); handle = ocfs2_alloc_handle(osb);
if (handle == NULL) { if (handle == NULL) {
status = -ENOMEM; status = -ENOMEM;
...@@ -331,6 +324,11 @@ static int ocfs2_mknod(struct inode *dir, ...@@ -331,6 +324,11 @@ static int ocfs2_mknod(struct inode *dir,
goto leave; 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; dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data;
if (!dirfe->i_links_count) { if (!dirfe->i_links_count) {
/* can't make a file in a deleted directory. */ /* can't make a file in a deleted directory. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册