diff options
author | Zach Brown <zab@redhat.com> | 2013-07-11 16:19:42 -0700 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-08-09 19:34:56 -0400 |
commit | db62efbbf883c099d44b0fafe18f8ad8f0396892 (patch) | |
tree | dacc595d4b9e32b1736c01efea0580ba6a153903 /drivers | |
parent | cfad392b22163eba71d882950e17d2c4d43b2bad (diff) |
btrfs: don't loop on large offsets in readdir
When btrfs readdir() hits the last entry it sets the readdir offset to a
huge value to stop buggy apps from breaking when the same name is
returned by readdir() with concurrent rename()s.
But unconditionally setting the offset to INT_MAX causes readdir() to
loop returning any entries with offsets past INT_MAX. It only takes a
few hours of constant file creation and removal to create entries past
INT_MAX.
So let's set the huge offset to LLONG_MAX if the last entry has already
overflowed 32bit loff_t. Without large offsets behaviour is identical.
With large offsets 64bit apps will work and 32bit apps will be no more
broken than they currently are if they see large offsets.
Signed-off-by: Zach Brown <zab@redhat.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'drivers')
0 files changed, 0 insertions, 0 deletions