Skip to content

Commit

Permalink
btrfs: fix missing last-entry in readdir(3)
Browse files Browse the repository at this point in the history
parent 49313cdac7b34c9f7ecbb1780cfc648b1c082cd7 (v2.6.32-1-g49313cd)
commit ff48c08e1c05c67e8348ab6f8a24de8034e0e34d
Author: Jan Engelhardt <jengelh@medozas.de>
Date:   Wed Dec 9 22:57:36 2009 +0100

Btrfs: fix missing last-entry in readdir(3)

When one does a 32-bit readdir(3), the last entry of a directory is
missing. This is however not due to passing a large value to filldir,
but it seems to have to do with glibc doing telldir or something
quirky. In any case, this patch fixes it in practice.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Jan Engelhardt authored and Chris Mason committed Jan 18, 2010
1 parent 3a1abec commit 406266a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3995,7 +3995,11 @@ static int btrfs_real_readdir(struct file *filp, void *dirent,

/* Reached end of directory/root. Bump pos past the last item. */
if (key_type == BTRFS_DIR_INDEX_KEY)
filp->f_pos = INT_LIMIT(off_t);
/*
* 32-bit glibc will use getdents64, but then strtol -
* so the last number we can serve is this.
*/
filp->f_pos = 0x7fffffff;
else
filp->f_pos++;
nopos:
Expand Down

0 comments on commit 406266a

Please sign in to comment.