Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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()

+12 -1
+12 -1
fs/io_uring.c
··· 2300 2300 static bool io_rw_reissue(struct io_kiocb *req, long res) 2301 2301 { 2302 2302 #ifdef CONFIG_BLOCK 2303 + umode_t mode = file_inode(req->file)->i_mode; 2303 2304 int ret; 2304 2305 2306 + if (!S_ISBLK(mode) && !S_ISREG(mode)) 2307 + return false; 2305 2308 if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker()) 2306 2309 return false; 2307 2310 ··· 3149 3146 /* IOPOLL retry should happen for io-wq threads */ 3150 3147 if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL)) 3151 3148 goto done; 3149 + /* no retry on NONBLOCK marked file */ 3150 + if (req->file->f_flags & O_NONBLOCK) 3151 + goto done; 3152 3152 /* some cases will consume bytes even on error returns */ 3153 3153 iov_iter_revert(iter, iov_count - iov_iter_count(iter)); 3154 3154 ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false); ··· 3293 3287 */ 3294 3288 if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT)) 3295 3289 ret2 = -EAGAIN; 3290 + /* no retry on NONBLOCK marked file */ 3291 + if (ret2 == -EAGAIN && (req->file->f_flags & O_NONBLOCK)) 3292 + goto done; 3296 3293 if (!force_nonblock || ret2 != -EAGAIN) { 3297 3294 /* IOPOLL retry should happen for io-wq threads */ 3298 3295 if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN) 3299 3296 goto copy_iov; 3297 + done: 3300 3298 kiocb_done(kiocb, ret2, cs); 3301 3299 } else { 3302 3300 copy_iov: ··· 7334 7324 table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT]; 7335 7325 index = i & IORING_FILE_TABLE_MASK; 7336 7326 if (table->files[index]) { 7337 - file = io_file_from_index(ctx, index); 7327 + file = table->files[index]; 7338 7328 err = io_queue_file_removal(data, file); 7339 7329 if (err) 7340 7330 break; ··· 7363 7353 table->files[index] = file; 7364 7354 err = io_sqe_file_register(ctx, file, i); 7365 7355 if (err) { 7356 + table->files[index] = NULL; 7366 7357 fput(file); 7367 7358 break; 7368 7359 }