X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdfs%2Fdir.c;h=fb171ad262954aa98fd9734d67321d2c8ddaadef;hb=8bb299c93313daad5d14e4b08b0a672eda144214;hp=0c0fe1c0cd148e3c181579ab61a17a8bbe41d9cc;hpb=9937b22dc3b00aa886cb9e0c7c7a2b71083f03af;p=fs%2Flustre-release.git diff --git a/lustre/obdfs/dir.c b/lustre/obdfs/dir.c index 0c0fe1c..fb171ad 100644 --- a/lustre/obdfs/dir.c +++ b/lustre/obdfs/dir.c @@ -47,14 +47,21 @@ static ssize_t obdfs_dir_read (struct file * filp, char * buf, { return -EISDIR; } +#endif - -int ext2_check_dir_entry (const char * function, struct inode * dir, +int obdfs_check_dir_entry (const char * function, struct inode * dir, struct ext2_dir_entry_2 * de, - struct buffer_head * bh, + struct page * page, unsigned long offset) { const char * error_msg = NULL; + return 1; + + ENTRY; + if ( !de ) { + error_msg = "null de passed"; + return 1; + } if (le16_to_cpu(de->rec_len) < EXT2_DIR_REC_LEN(1)) error_msg = "rec_len is smaller than minimal"; @@ -62,22 +69,25 @@ int ext2_check_dir_entry (const char * function, struct inode * dir, error_msg = "rec_len % 4 != 0"; else if (le16_to_cpu(de->rec_len) < EXT2_DIR_REC_LEN(de->name_len)) error_msg = "rec_len is too small for name_len"; - else if (dir && ((char *) de - bh->b_data) + le16_to_cpu(de->rec_len) > + else if (dir && ((char *) de - (char *)page_address(page)) + le16_to_cpu(de->rec_len) > dir->i_sb->s_blocksize) error_msg = "directory entry across blocks"; - else if (dir && le32_to_cpu(de->inode) > le32_to_cpu(dir->i_sb->u.ext2_sb.s_es->s_inodes_count)) - error_msg = "inode out of bounds"; +#if 0 /* this one doesn't yet work for OBDFS */ + else +if (dir && le32_to_cpu(de->inode) > le32_to_cpu(dir->i_sb->u.ext2_sb.s_es->s_inodes_count)) + error_msg = "inode out of bounds"; +#endif if (error_msg != NULL) ext2_error (dir->i_sb, function, "bad entry in directory #%lu: %s - " "offset=%lu, inode=%lu, rec_len=%d, name_len=%d", dir->i_ino, error_msg, offset, (unsigned long) le32_to_cpu(de->inode), le16_to_cpu(de->rec_len), de->name_len); + EXIT; return error_msg == NULL ? 1 : 0; } -#endif int obdfs_readdir(struct file * filp, void * dirent, filldir_t filldir) { @@ -97,7 +107,9 @@ int obdfs_readdir(struct file * filp, void * dirent, filldir_t filldir) offset = filp->f_pos & (PAGE_SIZE - 1); while (!error && !stored && filp->f_pos < inode->i_size) { - page = obdfs_getpage(inode, offset, 0, NOLOCK); + IDEBUG(inode); + page = obdfs_getpage(inode, offset, 0, LOCKED); + PDEBUG(page, "readdir"); if (!page) { ext2_error (sb, "ext2_readdir", "directory #%lu contains a hole at offset %lu", @@ -172,6 +184,7 @@ revalidate: filp->f_pos += le16_to_cpu(de->rec_len); } offset = 0; + UnlockPage(page); page_cache_release(page); } UPDATE_ATIME(inode);