aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r--fs/ocfs2/namei.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 0673862c8bdd..0d3e939b1f56 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -56,6 +56,7 @@
56#include "journal.h" 56#include "journal.h"
57#include "namei.h" 57#include "namei.h"
58#include "suballoc.h" 58#include "suballoc.h"
59#include "super.h"
59#include "symlink.h" 60#include "symlink.h"
60#include "sysfile.h" 61#include "sysfile.h"
61#include "uptodate.h" 62#include "uptodate.h"
@@ -310,13 +311,6 @@ static int ocfs2_mknod(struct inode *dir,
310 /* get our super block */ 311 /* get our super block */
311 osb = OCFS2_SB(dir->i_sb); 312 osb = OCFS2_SB(dir->i_sb);
312 313
313 if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) {
314 mlog(ML_ERROR, "inode %llu has i_nlink of %u\n",
315 (unsigned long long)OCFS2_I(dir)->ip_blkno, dir->i_nlink);
316 status = -EMLINK;
317 goto leave;
318 }
319
320 handle = ocfs2_alloc_handle(osb); 314 handle = ocfs2_alloc_handle(osb);
321 if (handle == NULL) { 315 if (handle == NULL) {
322 status = -ENOMEM; 316 status = -ENOMEM;
@@ -331,6 +325,11 @@ static int ocfs2_mknod(struct inode *dir,
331 goto leave; 325 goto leave;
332 } 326 }
333 327
328 if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) {
329 status = -EMLINK;
330 goto leave;
331 }
332
334 dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data; 333 dirfe = (struct ocfs2_dinode *) parent_fe_bh->b_data;
335 if (!dirfe->i_links_count) { 334 if (!dirfe->i_links_count) {
336 /* can't make a file in a deleted directory. */ 335 /* can't make a file in a deleted directory. */
@@ -643,11 +642,6 @@ static int ocfs2_link(struct dentry *old_dentry,
643 goto bail; 642 goto bail;
644 } 643 }
645 644
646 if (inode->i_nlink >= OCFS2_LINK_MAX) {
647 err = -EMLINK;
648 goto bail;
649 }
650
651 handle = ocfs2_alloc_handle(osb); 645 handle = ocfs2_alloc_handle(osb);
652 if (handle == NULL) { 646 if (handle == NULL) {
653 err = -ENOMEM; 647 err = -ENOMEM;
@@ -661,6 +655,11 @@ static int ocfs2_link(struct dentry *old_dentry,
661 goto bail; 655 goto bail;
662 } 656 }
663 657
658 if (!dir->i_nlink) {
659 err = -ENOENT;
660 goto bail;
661 }
662
664 err = ocfs2_check_dir_for_entry(dir, dentry->d_name.name, 663 err = ocfs2_check_dir_for_entry(dir, dentry->d_name.name,
665 dentry->d_name.len); 664 dentry->d_name.len);
666 if (err) 665 if (err)
@@ -1964,13 +1963,8 @@ restart:
1964 } 1963 }
1965 num++; 1964 num++;
1966 1965
1967 /* XXX: questionable readahead stuff here */
1968 bh = ocfs2_bread(dir, b++, &err, 1); 1966 bh = ocfs2_bread(dir, b++, &err, 1);
1969 bh_use[ra_max] = bh; 1967 bh_use[ra_max] = bh;
1970#if 0 // ???
1971 if (bh)
1972 ll_rw_block(READ, 1, &bh);
1973#endif
1974 } 1968 }
1975 } 1969 }
1976 if ((bh = bh_use[ra_ptr++]) == NULL) 1970 if ((bh = bh_use[ra_ptr++]) == NULL)
@@ -1978,6 +1972,10 @@ restart:
1978 wait_on_buffer(bh); 1972 wait_on_buffer(bh);
1979 if (!buffer_uptodate(bh)) { 1973 if (!buffer_uptodate(bh)) {
1980 /* read error, skip block & hope for the best */ 1974 /* read error, skip block & hope for the best */
1975 ocfs2_error(dir->i_sb, "reading directory %llu, "
1976 "offset %lu\n",
1977 (unsigned long long)OCFS2_I(dir)->ip_blkno,
1978 block);
1981 brelse(bh); 1979 brelse(bh);
1982 goto next; 1980 goto next;
1983 } 1981 }