On 11/21/18 2:15 AM, Benny Halevy wrote:
quoted
+int iomap_dio_iopoll(struct kiocb *kiocb, bool spin)
+{
+ struct iomap_dio *dio = kiocb->private;
+ struct request_queue *q = READ_ONCE(dio->last_queue);
+
+ if (!q || dio->cookie == BLK_QC_T_NONE)
+ return 0;
+ return blk_poll(q, READ_ONCE(dio->cookie), spin);
How about:
blk_qc_t cookie = READ_ONCE(dio->cookie);
if (!q || cookie == BLK_QC_T_NONE)
return 0;
return blk_poll(q, cookie, spin);
Is there a chance the dio->cookie in the if () condition
will be stale?
I've rewritten this one, more importantly it needs to guard against
submission by ensuring that 'dio' is valid.
--
Jens Axboe