[Ocfs2-devel] a patch for ocfs2_link
Tiger Yang
tiger.yang at oracle.com
Thu Aug 31 19:27:32 PDT 2006
This patch remove the redundant "i_nlink >= OCFS2_LINK_MAX" check
and add an unlinked directory check.
Singed-off-by: mfasheh
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 0673862..719a8d2 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -643,11 +643,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;
@@ -661,6 +656,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)
-------------- next part --------------
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 0673862..719a8d2 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -643,11 +643,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;
@@ -661,6 +656,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)
More information about the Ocfs2-devel
mailing list