OSDN Git Service

Revert "ext2_readdir() filp->f_pos fix"
authorWilly Tarreau <w@1wt.eu>
Sun, 24 Feb 2008 20:26:45 +0000 (21:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 24 Feb 2008 20:37:40 +0000 (21:37 +0100)
This reverts commit c30306fb287323591c854a0982d9fa5351859b45.

This backported fix caused some lockups to people while reading
directories.

Cc: dann frazier <dannf@hp.com>
fs/ext2/dir.c

index ce27575..9aa3d1b 100644 (file)
@@ -240,7 +240,7 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
        loff_t pos = filp->f_pos;
        struct inode *inode = filp->f_dentry->d_inode;
        struct super_block *sb = inode->i_sb;
-       unsigned int offset = pos & ~PAGE_CACHE_MASK;
+       unsigned offset = pos & ~PAGE_CACHE_MASK;
        unsigned long n = pos >> PAGE_CACHE_SHIFT;
        unsigned long npages = dir_pages(inode);
        unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
@@ -260,10 +260,6 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
                struct page *page = ext2_get_page(inode, n);
 
                if (IS_ERR(page)) {
-                       ext2_error(sb, __FUNCTION__,
-                                  "bad page in #%lu",
-                                  inode->i_ino);
-                       filp->f_pos += PAGE_CACHE_SIZE - offset;
                        ret = -EIO;
                        goto done;
                }
@@ -290,12 +286,12 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
                                        ext2_put_page(page);
                                        goto done;
                                }
-                       filp->f_pos += le16_to_cpu(de->rec_len);
                        }
                ext2_put_page(page);
        }
 
 done:
+       filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
        filp->f_version = inode->i_version;
        UPDATE_ATIME(inode);
        return ret;