• J
    io_uring: fix sporadic double CQE entry for close · f809fef1
    Jens Axboe 提交于
    to #26323588
    
    commit 1a417f4e618e05fba29ba222f1e8555c302376ce upstream.
    
    We punt close to async for the final fput(), but we log the completion
    even before that even in that case. We rely on the request not having
    a files table assigned to detect what the final async close should do.
    However, if we punt the async queue to __io_queue_sqe(), we'll get
    ->files assigned and this makes io_close_finish() think it should both
    close the filp again (which does no harm) AND log a new CQE event for
    this request. This causes duplicate CQEs.
    
    Queue the request up for async manually so we don't grab files
    needlessly and trigger this condition.
    Signed-off-by: NJens Axboe <axboe@kernel.dk>
    Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
    Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
    f809fef1
io_uring.c 165.8 KB