diff options
author | Justin Husted <sigstop@gmail.com> | 2019-10-03 21:56:01 -0700 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2019-10-18 16:23:39 -0400 |
commit | 8b6497b4e755cfe03968719637b2ab33d8c0f72f (patch) | |
tree | 897a692ef37e0124c922f537f01689b9fb77b399 /linux/workqueue.c | |
parent | 08ce726f9cefd0132e9c54e1e676cfc10a28a0ff (diff) |
Fix infinite looping behavior with readdir.
Also adds partial . and .. support, and implements ENOTDIR error.
The source of this problem was due to the off-by-one interface expected
by readdir. Each directory entry contains a pointer to next, so it
cannot be emitted to the user until the next entry is actually read.
Returning the current position + 1 is insufficient, because the user
will just retry cur + 1 as the start position to see if they've reached
the end of the directory.
Since directory entries are keyed by a 64-bit hash in bcachefs, the
result was that the user would call readdir over and over with what it
believed the next pointer to be until "cur + 1" reached some enormous
64-bit value related to the hash for the "lost+found" entry.
Diffstat (limited to 'linux/workqueue.c')
0 files changed, 0 insertions, 0 deletions