From nobody Mon Sep 17 00:00:00 2001 From: Tiger Yang Date: Thu, 31 Aug 2006 20:39:47 -0700 Subject: 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 Signed-off-by: Mark Fasheh --- fs/ocfs2/namei.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) ab8a63bfc71c8b66cb50149e7762a750ecf54af4 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 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 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) -- 1.3.3