aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-01-28 15:34:27 -0500
committerChris Mason <chris.mason@oracle.com>2009-01-28 15:34:27 -0500
commit89f135d8b53bcccafd91a075366d2704ba257cf3 (patch)
tree8355edb91b7f0345ab7698dee0f0478f571aa090
parente4f722fa42537bcb0ff14322a57dc3870d093cab (diff)
Btrfs: fix readdir on 32 bit machines
After btrfs_readdir has gone through all the directory items, it sets the directory f_pos to the largest possible int. This way applications that mix readdir with creating new files don't end up in an endless loop finding the new directory items as they go. It was a workaround for a bug in git, but the assumption was that if git could make this looping mistake than it would be a common problem. The largest possible int chosen was INT_LIMIT(typeof(file->f_pos), and it is possible for that to be a larger number than 32 bit glibc expects to come out of readdir. This patches switches that to INT_LIMIT(off_t), which should keep applications happy on 32 and 64 bit machines. Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/inode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 288c2cdc7543..2bb65e9b1448 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3263,7 +3263,7 @@ skip:
3263 3263
3264 /* Reached end of directory/root. Bump pos past the last item. */ 3264 /* Reached end of directory/root. Bump pos past the last item. */
3265 if (key_type == BTRFS_DIR_INDEX_KEY) 3265 if (key_type == BTRFS_DIR_INDEX_KEY)
3266 filp->f_pos = INT_LIMIT(typeof(filp->f_pos)); 3266 filp->f_pos = INT_LIMIT(off_t);
3267 else 3267 else
3268 filp->f_pos++; 3268 filp->f_pos++;
3269nopos: 3269nopos: