Commit 0031275
io_uring: call req_set_fail_links() on short send[msg]()/recv[msg]() with MSG_WAITALL
Without that it's not safe to use them in a linked combination with
others.
Now combinations like IORING_OP_SENDMSG followed by IORING_OP_SPLICE
should be possible.
We already handle short reads and writes for the following opcodes:
- IORING_OP_READV
- IORING_OP_READ_FIXED
- IORING_OP_READ
- IORING_OP_WRITEV
- IORING_OP_WRITE_FIXED
- IORING_OP_WRITE
- IORING_OP_SPLICE
- IORING_OP_TEE
Now we have it for these as well:
- IORING_OP_SENDMSG
- IORING_OP_SEND
- IORING_OP_RECVMSG
- IORING_OP_RECV
For IORING_OP_RECVMSG we also check for the MSG_TRUNC and MSG_CTRUNC
flags in order to call req_set_fail_links().
There might be applications arround depending on the behavior
that even short send[msg]()/recv[msg]() retuns continue an
IOSQE_IO_LINK chain.
It's very unlikely that such applications pass in MSG_WAITALL,
which is only defined in 'man 2 recvmsg', but not in 'man 2 sendmsg'.
It's expected that the low level sock_sendmsg() call just ignores
MSG_WAITALL, as MSG_ZEROCOPY is also ignored without explicitly set
SO_ZEROCOPY.
We also expect the caller to know about the implicit truncation to
MAX_RW_COUNT, which we don't detect.
cc: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/c4e1a4cc0d905314f4d5dc567e65a7b09621aab3.1615908477.git.metze@samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 00ddff4 commit 0031275
1 file changed
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4386 | 4386 | | |
4387 | 4387 | | |
4388 | 4388 | | |
| 4389 | + | |
4389 | 4390 | | |
4390 | 4391 | | |
4391 | 4392 | | |
| |||
4406 | 4407 | | |
4407 | 4408 | | |
4408 | 4409 | | |
| 4410 | + | |
| 4411 | + | |
| 4412 | + | |
4409 | 4413 | | |
4410 | 4414 | | |
4411 | 4415 | | |
| |||
4416 | 4420 | | |
4417 | 4421 | | |
4418 | 4422 | | |
4419 | | - | |
| 4423 | + | |
4420 | 4424 | | |
4421 | 4425 | | |
4422 | 4426 | | |
| |||
4429 | 4433 | | |
4430 | 4434 | | |
4431 | 4435 | | |
| 4436 | + | |
4432 | 4437 | | |
4433 | 4438 | | |
4434 | 4439 | | |
| |||
4450 | 4455 | | |
4451 | 4456 | | |
4452 | 4457 | | |
| 4458 | + | |
| 4459 | + | |
| 4460 | + | |
4453 | 4461 | | |
4454 | 4462 | | |
4455 | 4463 | | |
4456 | 4464 | | |
4457 | 4465 | | |
4458 | 4466 | | |
4459 | 4467 | | |
4460 | | - | |
| 4468 | + | |
4461 | 4469 | | |
4462 | 4470 | | |
4463 | 4471 | | |
| |||
4609 | 4617 | | |
4610 | 4618 | | |
4611 | 4619 | | |
| 4620 | + | |
4612 | 4621 | | |
4613 | 4622 | | |
4614 | 4623 | | |
| |||
4640 | 4649 | | |
4641 | 4650 | | |
4642 | 4651 | | |
| 4652 | + | |
| 4653 | + | |
| 4654 | + | |
4643 | 4655 | | |
4644 | 4656 | | |
4645 | 4657 | | |
| |||
4653 | 4665 | | |
4654 | 4666 | | |
4655 | 4667 | | |
4656 | | - | |
| 4668 | + | |
4657 | 4669 | | |
4658 | 4670 | | |
4659 | 4671 | | |
| |||
4668 | 4680 | | |
4669 | 4681 | | |
4670 | 4682 | | |
| 4683 | + | |
4671 | 4684 | | |
4672 | 4685 | | |
4673 | 4686 | | |
| |||
4699 | 4712 | | |
4700 | 4713 | | |
4701 | 4714 | | |
| 4715 | + | |
| 4716 | + | |
| 4717 | + | |
4702 | 4718 | | |
4703 | 4719 | | |
4704 | 4720 | | |
| |||
4707 | 4723 | | |
4708 | 4724 | | |
4709 | 4725 | | |
4710 | | - | |
| 4726 | + | |
4711 | 4727 | | |
4712 | 4728 | | |
4713 | 4729 | | |
| |||
0 commit comments