Re: [PATCH v7 3/8] nbd: clear queue limits on disconnect
"yu kuai" <[email protected]> Wed, 5 Aug 2026 16:35:40 +0800
| Newsgroups | org.kernel.vger.linux-block |
|---|---|
| Message-ID | <[email protected]> |
在 2026/8/5 14:58, Yang Erkun 写道: > An inactive nbd device may refuse any I/O operations. The nbd_config_put > function calls invalidate_disk, which sets the device capacity to zero > to reject all read and write I/O. For zero-sector flush I/O requests > from blkdev_issue_flush, if the write cache is disabled, the zero-sector > flush I/O immediately returns 0 in submit_bio_noacct. However, since > nbd_config_put does not clear the write cache state, an inactive nbd > device might still have the write cache enabled. In this situation, > zero-sector flush I/O will return -EIO because there is no active socket. > Additionally, BLK_FEAT_FUA and BLK_FEAT_ROTATIONAL flags may also remain > stale, resetting all of them ensures consistent behavior. > > The limits update uses queue_limits_commit_update() (the non-freezing > variant) because config_refs == 0 here means every fd is closed and recv > threads have drained, so no in-flight I/O can read q->limits concurrently. > > Signed-off-by: Yang Erkun<[email protected]> > --- > drivers/block/nbd.c | 43 ++++++++++++++++++++++++++----------------- > 1 file changed, 26 insertions(+), 17 deletions(-) Reviewed-by: Yu Kuai <[email protected]> -- Thanks, Kuai