From: Guixin Liu Date: Wed, 13 Nov 2024 10:18:39 +0000 (+0800) Subject: nvmet: report ns's vwc not present X-Git-Tag: v6.13-rc1~211^2~11^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=609e60a3a9f4053b420d3ece565dee273bfdc2e8;p=thirdparty%2Fkernel%2Flinux.git nvmet: report ns's vwc not present Currently, we report that controller has vwc even though the ns may not have vwc. Report ns's vwc not present when not buffered_io or backdev doesn't have vwc. Signed-off-by: Guixin Liu Reviewed-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Signed-off-by: Keith Busch --- diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index 0a9fdc5331861..934b401fbc2ff 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c @@ -934,6 +934,13 @@ static void nvmet_execute_id_cs_indep(struct nvmet_req *req) id->nsattr |= NVME_NS_ATTR_RO; if (req->ns->bdev && !bdev_nonrot(req->ns->bdev)) id->nsfeat |= NVME_NS_ROTATIONAL; + /* + * We need flush command to flush the file's metadata, + * so report supporting vwc if backend is file, even + * though buffered_io is disable. + */ + if (req->ns->bdev && !bdev_write_cache(req->ns->bdev)) + id->nsfeat |= NVME_NS_VWC_NOT_PRESENT; status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); kfree(id);