Re: problems with readdir in isofs in recent kernels

From: Oliver Mueschke (o@mueschke.de)
Date: Tue May 02 2000 - 02:39:39 EST


On Mon, May 01, 2000 at 05:25:47PM +0200, Robert Schiele wrote:
> I have experienced problems with readdir in isofs in recent kernels. I found
> that sometimes on large directories not all entries appear - no read errors do
> occur. If I remount the disc, the missing entries are present. I tried this

since there have been requests to repost the patch, here it comes:

diff -u --recursive --new-file linux-2.3.99-pre7-pre1/fs/isofs/dir.c linux-2.3.99-pre7-pre1-isofspatch/fs/isofs/dir.c
--- linux-2.3.99-pre7-pre1/fs/isofs/dir.c Sun Feb 27 05:33:06 2000
+++ linux-2.3.99-pre7-pre1-isofspatch/fs/isofs/dir.c Tue May 2 09:18:15 2000
@@ -133,12 +133,28 @@
                        block, offset, filp->f_pos);
                 printk("inode->i_size = %x\n",inode->i_size);
 #endif
+ /* Next directory_record on next CDROM sector */
+ if (offset >= bufsize) {
+#ifdef DEBUG
+ printk("offset >= bufsize\n");
+#endif
+ brelse(bh);
+ offset = 0;
+ block = isofs_bmap(inode, (filp->f_pos) >> bufbits);
+ if (!block)
+ return 0;
+ bh = breada(inode->i_dev, block, bufsize, filp->f_pos, inode->i_size);
+ if (!bh)
+ return 0;
+ continue;
+ }
+
                 de = (struct iso_directory_record *) (bh->b_data + offset);
                 if(first_de) inode_number = (block << bufbits) + (offset & (bufsize - 1));
 
                 de_len = *(unsigned char *) de;
 #ifdef DEBUG
- printk("de_len = %ld\n", de_len);
+ printk("de_len = %d\n", de_len);
 #endif
             
 
@@ -146,16 +162,11 @@
                    CDROM sector. If we are at the end of the directory, we
                    kick out of the while loop. */
 
- if ((de_len == 0) || (offset >= bufsize) ) {
+ if (de_len == 0) {
                         brelse(bh);
- if (de_len == 0) {
- filp->f_pos = ((filp->f_pos & ~(ISOFS_BLOCK_SIZE - 1))
- + ISOFS_BLOCK_SIZE);
- offset = 0;
- } else {
- offset -= bufsize;
- filp->f_pos += offset;
- }
+ filp->f_pos = ((filp->f_pos & ~(ISOFS_BLOCK_SIZE - 1))
+ + ISOFS_BLOCK_SIZE);
+ offset = 0;
 
                         if (filp->f_pos >= inode->i_size)
                                 return 0;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:09 EST