summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/namei.c
diff options
context:
space:
mode:
authorTiger Yang <tiger.yang@oracle.com>2006-08-31 20:39:47 -0700
committerMark Fasheh <mark.fasheh@oracle.com>2006-09-20 15:52:27 -0700
commit0f62de2c9ca60a35f63122e7ea992cee8aae4bef (patch)
tree31af0006aedea3a22e463198b5c4a00ca893bf1c /fs/ocfs2/namei.c
parenta663e30513d7ecc77dd71d474e7646bf78c0ba62 (diff)
downloadop-kernel-dev-0f62de2c9ca60a35f63122e7ea992cee8aae4bef.zip
op-kernel-dev-0f62de2c9ca60a35f63122e7ea992cee8aae4bef.tar.gz
ocfs2: Fix directory link count checks in ocfs2_link()
Remove the redundant "i_nlink >= OCFS2_LINK_MAX" check and adds an unlinked directory check in ocfs2_link(). Signed-off-by: Tiger Yang <tiger.yang@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r--fs/ocfs2/namei.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index d8161a7..2412647 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -641,11 +641,6 @@ static int ocfs2_link(struct dentry *old_dentry,
goto bail;
}
- if (inode->i_nlink >= OCFS2_LINK_MAX) {
- err = -EMLINK;
- goto bail;
- }
-
handle = ocfs2_alloc_handle(osb);
if (handle == NULL) {
err = -ENOMEM;
@@ -659,6 +654,11 @@ static int ocfs2_link(struct dentry *old_dentry,
goto bail;
}
+ if (!dir->i_nlink) {
+ err = -ENOENT;
+ goto bail;
+ }
+
err = ocfs2_check_dir_for_entry(dir, dentry->d_name.name,
dentry->d_name.len);
if (err)
OpenPOWER on IntegriCloud