[axboe-block:for-5.16/io_uring 78/79] fs/io_uring.c:5577:6: warning: variable 'rw' set but not used

From: kernel test robot
Date: Sat Oct 16 2021 - 18:45:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-5.16/io_uring
head: 785d7baa96560c726b68d591a233532f1a203743
commit: 7070f9ad7468e52c5bd36c6270aa4c6466f6bbf3 [78/79] io_uring: arm poll for non-nowait files
config: i386-randconfig-r022-20211016 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project a49f5386ce6b091da66ea7c3a1d9a588d53becf7)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=7070f9ad7468e52c5bd36c6270aa4c6466f6bbf3
git remote add axboe-block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
git fetch --no-tags axboe-block for-5.16/io_uring
git checkout 7070f9ad7468e52c5bd36c6270aa4c6466f6bbf3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

fs/io_uring.c:1489:61: warning: parameter 'locked' set but not used [-Wunused-but-set-parameter]
static void io_queue_async_work(struct io_kiocb *req, bool *locked)
^
>> fs/io_uring.c:5577:6: warning: variable 'rw' set but not used [-Wunused-but-set-variable]
int rw;
^
2 warnings generated.


vim +/rw +5577 fs/io_uring.c

59b735aeeb0f23 Olivier Langlois 2021-06-22 5569
59b735aeeb0f23 Olivier Langlois 2021-06-22 5570 static int io_arm_poll_handler(struct io_kiocb *req)
d7718a9d25a614 Jens Axboe 2020-02-14 5571 {
d7718a9d25a614 Jens Axboe 2020-02-14 5572 const struct io_op_def *def = &io_op_defs[req->opcode];
d7718a9d25a614 Jens Axboe 2020-02-14 5573 struct io_ring_ctx *ctx = req->ctx;
d7718a9d25a614 Jens Axboe 2020-02-14 5574 struct async_poll *apoll;
d7718a9d25a614 Jens Axboe 2020-02-14 5575 struct io_poll_table ipt;
b2d9c3da77115b Pavel Begunkov 2021-06-26 5576 __poll_t ret, mask = EPOLLONESHOT | POLLERR | POLLPRI;
9dab14b81807a4 Jens Axboe 2020-08-25 @5577 int rw;
d7718a9d25a614 Jens Axboe 2020-02-14 5578
d7718a9d25a614 Jens Axboe 2020-02-14 5579 if (!req->file || !file_can_poll(req->file))
59b735aeeb0f23 Olivier Langlois 2021-06-22 5580 return IO_APOLL_ABORTED;
24c74678634b3c Pavel Begunkov 2020-06-21 5581 if (req->flags & REQ_F_POLLED)
59b735aeeb0f23 Olivier Langlois 2021-06-22 5582 return IO_APOLL_ABORTED;
b2d9c3da77115b Pavel Begunkov 2021-06-26 5583 if (!def->pollin && !def->pollout)
b2d9c3da77115b Pavel Begunkov 2021-06-26 5584 return IO_APOLL_ABORTED;
b2d9c3da77115b Pavel Begunkov 2021-06-26 5585
b2d9c3da77115b Pavel Begunkov 2021-06-26 5586 if (def->pollin) {
9dab14b81807a4 Jens Axboe 2020-08-25 5587 rw = READ;
b2d9c3da77115b Pavel Begunkov 2021-06-26 5588 mask |= POLLIN | POLLRDNORM;
b2d9c3da77115b Pavel Begunkov 2021-06-26 5589
b2d9c3da77115b Pavel Begunkov 2021-06-26 5590 /* If reading from MSG_ERRQUEUE using recvmsg, ignore POLLIN */
b2d9c3da77115b Pavel Begunkov 2021-06-26 5591 if ((req->opcode == IORING_OP_RECVMSG) &&
b2d9c3da77115b Pavel Begunkov 2021-06-26 5592 (req->sr_msg.msg_flags & MSG_ERRQUEUE))
b2d9c3da77115b Pavel Begunkov 2021-06-26 5593 mask &= ~POLLIN;
b2d9c3da77115b Pavel Begunkov 2021-06-26 5594 } else {
9dab14b81807a4 Jens Axboe 2020-08-25 5595 rw = WRITE;
b2d9c3da77115b Pavel Begunkov 2021-06-26 5596 mask |= POLLOUT | POLLWRNORM;
b2d9c3da77115b Pavel Begunkov 2021-06-26 5597 }
b2d9c3da77115b Pavel Begunkov 2021-06-26 5598
d7718a9d25a614 Jens Axboe 2020-02-14 5599 apoll = kmalloc(sizeof(*apoll), GFP_ATOMIC);
d7718a9d25a614 Jens Axboe 2020-02-14 5600 if (unlikely(!apoll))
59b735aeeb0f23 Olivier Langlois 2021-06-22 5601 return IO_APOLL_ABORTED;
807abcb0883439 Jens Axboe 2020-07-17 5602 apoll->double_poll = NULL;
d7718a9d25a614 Jens Axboe 2020-02-14 5603 req->apoll = apoll;
b2d9c3da77115b Pavel Begunkov 2021-06-26 5604 req->flags |= REQ_F_POLLED;
d7718a9d25a614 Jens Axboe 2020-02-14 5605 ipt.pt._qproc = io_async_queue_proc;
48dcd38d73c22b Pavel Begunkov 2021-08-15 5606 io_req_set_refcount(req);
d7718a9d25a614 Jens Axboe 2020-02-14 5607
d7718a9d25a614 Jens Axboe 2020-02-14 5608 ret = __io_arm_poll_handler(req, &apoll->poll, &ipt, mask,
d7718a9d25a614 Jens Axboe 2020-02-14 5609 io_async_wake);
79ebeaee8a21a0 Jens Axboe 2021-08-10 5610 spin_unlock(&ctx->completion_lock);
41a5169c23ebe8 Hao Xu 2021-08-12 5611 if (ret || ipt.error)
41a5169c23ebe8 Hao Xu 2021-08-12 5612 return ret ? IO_APOLL_READY : IO_APOLL_ABORTED;
41a5169c23ebe8 Hao Xu 2021-08-12 5613
236daeae3616b1 Olivier Langlois 2021-05-31 5614 trace_io_uring_poll_arm(ctx, req, req->opcode, req->user_data,
236daeae3616b1 Olivier Langlois 2021-05-31 5615 mask, apoll->poll.events);
59b735aeeb0f23 Olivier Langlois 2021-06-22 5616 return IO_APOLL_OK;
d7718a9d25a614 Jens Axboe 2020-02-14 5617 }
d7718a9d25a614 Jens Axboe 2020-02-14 5618

:::::: The code at line 5577 was first introduced by commit
:::::: 9dab14b81807a40dab8e464ec87043935c562c2c io_uring: don't use poll handler if file can't be nonblocking read/written

:::::: TO: Jens Axboe <axboe@xxxxxxxxx>
:::::: CC: Jens Axboe <axboe@xxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip