• Z
    btrfs: don't loop on large offsets in readdir · db62efbb
    Zach Brown 提交于
    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: NZach Brown <zab@redhat.com>
    Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
    Signed-off-by: NChris Mason <chris.mason@fusionio.com>
    db62efbb
inode.c 231.1 KB