I am using Linux aio (io_submit()
/ io_getevents()
) for file I/O. Since some operations do not have aio equilvalents (open()
, fsync()
, fallocate()
), I use a worker thread that may block without impacting the main thread. My question is, should I add close()
to this list?
All files are opened with O_DIRECT
on XFS, but I am interested in both the general answer to the question, and on the specific answer with regard to my choice of filesystem and open mode.
Note that using a worker thread for close()
is not trivial since close()
is often called in cleanup paths, which aren't good places to launch a worker thread request and wait for it. So I'm hoping that close()
is non-blocking in this scenario.
For this question, "blocking" means waiting on an I/O operation, or on some lock that may only be released when an I/O operation completes, but excluding page fault servicing.