-
Notifications
You must be signed in to change notification settings - Fork 263
Function "dir_read" in PAL layer doesn't handle the case where offset > 0 #469
Comments
Imho this functions does not need to handle offset other than 0 - it's unclear what would offset in stream of directory entries mean (bytes, entries, ?). |
Large directories may not be able to read in one pass, so offset is important. That said, we should have well-defined units for what offset is in terms of. |
I like the current semantics of directory read - a non-seekable stream of directory entries. |
Closing. IMO @boryspoplawski is right, seeking on directories doesn't make too much sense and the bugs related to this were a result of something else, as Borys noted. |
I don't agree with this: I would prefer to have minimally stateful PAL abstractions, including handles without implicit cursors. Otherwise, this can create problems for checkpoint/migrate/restore. But I also don't want to deal with this right now, so I'm ok leaving this on the back-burner. But maybe we don't want this closed? |
I closed it because I thought your previous comment was based on a wrong assumption (that you can't read large directories without seeking), but if what you want is to list directories by explicit seeking instead of by keeping a state in the PAL handle then we can continue discussion. From my side: I think both solutions need to snapshot the whole directory listing on |
As much as I agree that having stateless API is desired, I don't think it is doable in this case. Main issue is that we cannot do a full directory snapshot (at either open or first directory read), because it might contain too many entries to cache. If there is no snapshot, how to interpret an offset? Actual content of directory might change at any time. Besides, giving an ability to ask for arbitrary off means we have to implement it somehow - open and read directory each time Pal's readdir is called? |
Pawel will look more into this, but for now I'm assigning Priority 2 since this doesn't look like blocking any workloads. |
The function y "dir_read" takes the offset as an argument but doesn't handle the case that offset > 0.
Currently we return -PAL_ERROR_INVAL when offset > 0. Eventually we need to add handling logic.
The text was updated successfully, but these errors were encountered: