mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
io_uring-5.9-2020-09-04
-----BEGIN PGP SIGNATURE----- iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAl9SWN8QHGF4Ym9lQGtl cm5lbC5kawAKCRD301j7KXHgpvtbD/4yI5dkopv6E2RHVuupFWmGlGoxLhPecnAZ UHbKU+LA/tzWWMA7gZuwzzDEK1QWT/KmctpGTI22SXUKQCtjGzO/qnRMfyJ34TdQ l4leYdw/QzUOHZG7dKVYUACHiaSxzQSallNuX1I9eM084KSXH3DgUkrwMLoew/8n WJHKN+oRhcppnLVDekaLXbZEI9idTnY+gs/Dg8TNsxNSeO6y51OOlKltaNfL+npQ dwlgMoolBYWHFozqgVyzIV7sU7fQ9QGppwBIfqBb1jEe9JU2ZymtlcDgfxUVpKcg W8/PCoVT60AGiMdjV0EBoQO09r+nvwAcRQUSlWJU7Dn/pcZmFoaJkyse+SnD0Dac cLTKhnhgMJSI4Zt3yQidFSNhz0Ouw15J8k7OTftn81zhtkHzPBgGnA7R6b7UUQsZ 5lJvlZh5aFPNBFp9A0do5+f5/lUMhHkxDpFVmZo+ywPtoNHJeDL2+jzzFawJ8kqv IoFvVL8hl4DzqN+vShsJ40jH93+oITF/Jlq6kY8ILKtu42i5qAxpP0wUwycrN6Pz /YNTKPveCoPU7zaFDvMfbc7U56Ke6ma+lmtTn6q6JOWFvUAYh7SUY4JGzEMpxfxK QVyFMwXnCKhB66ZypJIFdbT4zqkTXmhxvu/Oz5txDv/uoytqT1o+zLHb3USi4Lw8 89NyvBc0aQ== =NLOn -----END PGP SIGNATURE----- Merge tag 'io_uring-5.9-2020-09-04' of git://git.kernel.dk/linux-block Pull io_uring fixes from Jens Axboe: - EAGAIN with O_NONBLOCK retry fix - Two small fixes for registered files (Jiufei) * tag 'io_uring-5.9-2020-09-04' of git://git.kernel.dk/linux-block: io_uring: no read/write-retry on -EAGAIN error and O_NONBLOCK marked file io_uring: set table->files[i] to NULL when io_sqe_file_register failed io_uring: fix removing the wrong file in __io_sqe_files_update()
This commit is contained in:
commit
d849ca483d
@ -2300,8 +2300,11 @@ end_req:
|
||||
static bool io_rw_reissue(struct io_kiocb *req, long res)
|
||||
{
|
||||
#ifdef CONFIG_BLOCK
|
||||
umode_t mode = file_inode(req->file)->i_mode;
|
||||
int ret;
|
||||
|
||||
if (!S_ISBLK(mode) && !S_ISREG(mode))
|
||||
return false;
|
||||
if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker())
|
||||
return false;
|
||||
|
||||
@ -3146,6 +3149,9 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
|
||||
/* IOPOLL retry should happen for io-wq threads */
|
||||
if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL))
|
||||
goto done;
|
||||
/* no retry on NONBLOCK marked file */
|
||||
if (req->file->f_flags & O_NONBLOCK)
|
||||
goto done;
|
||||
/* some cases will consume bytes even on error returns */
|
||||
iov_iter_revert(iter, iov_count - iov_iter_count(iter));
|
||||
ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
|
||||
@ -3287,10 +3293,14 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
|
||||
*/
|
||||
if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT))
|
||||
ret2 = -EAGAIN;
|
||||
/* no retry on NONBLOCK marked file */
|
||||
if (ret2 == -EAGAIN && (req->file->f_flags & O_NONBLOCK))
|
||||
goto done;
|
||||
if (!force_nonblock || ret2 != -EAGAIN) {
|
||||
/* IOPOLL retry should happen for io-wq threads */
|
||||
if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN)
|
||||
goto copy_iov;
|
||||
done:
|
||||
kiocb_done(kiocb, ret2, cs);
|
||||
} else {
|
||||
copy_iov:
|
||||
@ -7324,7 +7334,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
|
||||
table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT];
|
||||
index = i & IORING_FILE_TABLE_MASK;
|
||||
if (table->files[index]) {
|
||||
file = io_file_from_index(ctx, index);
|
||||
file = table->files[index];
|
||||
err = io_queue_file_removal(data, file);
|
||||
if (err)
|
||||
break;
|
||||
@ -7353,6 +7363,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx,
|
||||
table->files[index] = file;
|
||||
err = io_sqe_file_register(ctx, file, i);
|
||||
if (err) {
|
||||
table->files[index] = NULL;
|
||||
fput(file);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user