-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow repeated readdir offsets #581
Conversation
POSIX allows seeking an open directory handle, which in FUSE means the `offset` can be any offset we've previously returned. This is pretty annoying for us to implement since we're streaming directory entries from S3 with ListObjects, which can't resume from an arbitrary index, and can't fit its continuation tokens into a 64-bit offset anyway. So we're probably never going to truly support seeking a directory handle. But there's a special case we've seen come up a couple of times (awslabs#477, awslabs#520): some applications read one page of directory entries and then seek back to 0 and do it again. I don't fully understand _why_ they do this, but it's common enough that it's worth special casing. This change makes open directory handles remember their most recent response so that they can repeat it if asked for the same offset again. It's not too complicated other than needing to make sure we do readdirplus correctly (managing the lookup counts for entries that are being returned a second time). I've tested this by running the PHP example from awslabs#477, which now works. Signed-off-by: James Bornholt <bornholt@amazon.com>
e08ab0f
to
6f6efb7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I was hoping we might add support for this scenario soon.
I have just one concern on the repeated reply sizes matching, see comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a CHANGELOG.md
entry would be worth adding since it'll be a 'bug fix' / 'new feature' to be able to support languages which use readdir in this way!
Signed-off-by: James Bornholt <bornholt@amazon.com>
Signed-off-by: James Bornholt <bornholt@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description of change
POSIX allows seeking an open directory handle, which in FUSE means the
offset
can be any offset we've previously returned. This is prettyannoying for us to implement since we're streaming directory entries
from S3 with ListObjects, which can't resume from an arbitrary index,
and can't fit its continuation tokens into a 64-bit offset anyway. So
we're probably never going to truly support seeking a directory handle.
But there's a special case we've seen come up a couple of times (#477, #520):
some applications read one page of directory entries and then seek back
to 0 and do it again. I don't fully understand why they do this, but
it's common enough that it's worth special casing.
This change makes open directory handles remember their most recent
response so that they can repeat it if asked for the same offset again.
It's not too complicated other than needing to make sure we do
readdirplus correctly (managing the lookup counts for entries that are
being returned a second time).
I've tested this by running the PHP example from #477, which now works.
Related issues: fixes #477, fixes #520.
Does this change impact existing behavior?
No, it allows a case to succeed that previously failed.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).