diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5440bab2363565e5c50399eb32b9f6e8ed103728..d5aa97310943ed6a6b75339411111e7b09f414d8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -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: