engines/io_uring: Fully clear out previous SQE contents.
authorAndres Freund <andres@anarazel.de>
Fri, 13 Sep 2019 19:10:10 +0000 (12:10 -0700)
committerAndres Freund <andres@anarazel.de>
Fri, 13 Sep 2019 19:18:23 +0000 (12:18 -0700)
commit34d6090ea96ddaa4e2a0f914939e2b8ff7008bec
tree59d7720d94a5af674dc5f46f9e7f2dafd56d330d
parent4c29a34fcc8cae333ec8b7af7657495745153b44
engines/io_uring: Fully clear out previous SQE contents.

Without this change SQEs can contain data set in previous
submissions. E.g. a WRITE following an fdatasync would have still have
IORING_FSYNC_DATASYNC set in sync_flags, which shares storage with the
WRITE's rw_flags. Which was not reset, causing all writes to be
synchronous. Similarly, an fsync following a READ/WRITE would not
reset off/addr/len, which causes errors, because the kernel's
io_prep_fsync returns an error if e.g. addr is not 0.

While this could also be fixed by resetting only the unused fields in
the respective branches, it seems less failure prone to start with a
zeroed out sqe.
engines/io_uring.c