io_uring: implement ->flush() sequence to handle ->files validity
The current scheme stashes away ->ring_fd and ->ring_file, and uses
that to check against whether or not ->files could have changed. This
works, but doesn't work so well for SQPOLL. If the application does
close the ring_fd, then we require that applications enter the kernel
to refresh our state.
Add an atomic sequence for the ->flush() count on the ring fd, and if
we get a mismatch between checking this sequence before and after
grabbing the ->files, then we fail the request.
This should offer the same protection that we currently have, with the
added benefit of being able to update the ->files automatically.
Signed-off-by: Jens Axboe <axboe@kernel.dk>