Implemented io-uring Op<Statx> and applied to read_uring and fs::try_exists#8080
Implemented io-uring Op<Statx> and applied to read_uring and fs::try_exists#8080asder8215 wants to merge 8 commits intotokio-rs:masterfrom
Op<Statx> and applied to read_uring and fs::try_exists#8080Conversation
ff8130b to
dd9a2c3
Compare
|
The compilation error is probably related to whether the build is using gnu or musl libc. See rust-lang/rust#154981 with similar issue. |
dd9a2c3 to
b474ac9
Compare
| // status as specified by man: | ||
| // https://man7.org/linux/man-pages/man2/statx.2.html | ||
| let statx_op = opcode::Statx::new( | ||
| types::Fd(file.as_raw_fd()), |
There was a problem hiding this comment.
Does something guarantee that the File won't be dropped during the io uring call ?
It this happens the kernel will try to use a closed fd or worse - a reused fd.
IMO it should use an OwnedFd here.
There was a problem hiding this comment.
I might need a bit more clarity to understand what you're seeing.
Op::file_metadata doesn't own File, it takes a reference to it. Wouldn't Rust's borrow checker prohibit this file.as_raw_fd() from being invalid since &File has to live for as long as the caller's File?
Moreover, I would assume that the statx syscall populates the buffer with the file metadata once, and doesn't need access to the fd/path after invocation (correct me if I'm wrong though)?
b474ac9 to
4e5c5d3
Compare
…hutdown, stating multiple files, ELOOP, ENAMETOOLONG, EACCES
4e5c5d3 to
0d20ca6
Compare
…statx is supported on 1.25+ musl, and MSRV that uses 1.25 on all *-linux-musl platforms is 1.93
…ble on Linux <5.1, changed stat permission denied test case to check raw os error code instead
…ble on Linux <5.1, removed stat permission denied test case since it doesn't work on Linux 4.19

Motivation
This builds up on vrtgs PR in their attempt of implementing
Statxfor io-uring and apply it tofs::try_exists. I usedlibcinstead oflinux-raw-sysfor theStatximplementation, tried to preserve more of how the original code (prior to vrtgs' changes) looked in certain files. There are some inlining done for the metadata functions forStatxbecause I thought the body of the code in these functions were pretty small and didn't seem to involve generics (let me know if I should remove that). Some other review comments mentioned in review of vrtgs' PR is addressed such as safety comments, inlining for thetry_exists_uring, avoiding usingCStringliterals, etc.To note, this is my first time contributing to Tokio, so let me know if there's anything that I'm doing incorrectly or if I missed something as per procedure here. Let me know if I should also squash some commits as well.
ccing @Daksh14 since I got to working on this PR per him sharing vrtgs' PR with me.