On 5/24/22 12:20, Stefan Hajnoczi wrote:
Maybe it's safe to run it without a lock because it runs after
virtio_set_status(vdev, 0) but I'd rather play it safe and protect s->rq
with a lock.
What does the lock protect?
A lock can prevent s->rq or req->vq corruption but it cannot prevent
request leaks. This loop's job is to free all requests so there is no
leak. If a lock is necessary then this code is already broken in a more
fundamental way because it can leak.
Yes, you're right. This particular list is always accessed in the
iothread (if any) and blk_drain() is enough. virtio-blk should already
not need aio_context_{acquire,release}.
It's worth a comment, though!
Paolo