io_uring: share fixed_file_refs b/w multiple rsrcs
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 18 Nov 2020 19:57:26 +0000 (19:57 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 9 Dec 2020 19:04:01 +0000 (12:04 -0700)
commit36f72fe2792c4304f1203a44a6a7178e49b447f7
tree89c307e276bef985b803920bb2c744f8a16e2570
parentc98de08c990e190fc7cc3aaf8079b4a0674c6425
io_uring: share fixed_file_refs b/w multiple rsrcs

Double fixed files for splice/tee are done in a nasty way, it takes 2
ref_node refs, and during the second time it blindly overrides
req->fixed_file_refs hoping that it haven't changed. That works because
all that is done under iouring_lock in a single go but is error-prone.

Bind everything explicitly to a single ref_node and take only one ref,
with current ref_node ordering it's guaranteed to keep all files valid
awhile the request is inflight.

That's mainly a cleanup + preparation for generic resource handling,
but also saves pcpu_ref get/put for splice/tee with 2 fixed files.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c