Skip to content

Commit 609e60a

Browse files
guixinliu1995keithbusch
authored andcommitted
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 8a825d2 commit 609e60a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/nvme/target/admin-cmd.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,13 @@ static void nvmet_execute_id_cs_indep(struct nvmet_req *req)
934934
id->nsattr |= NVME_NS_ATTR_RO;
935935
if (req->ns->bdev && !bdev_nonrot(req->ns->bdev))
936936
id->nsfeat |= NVME_NS_ROTATIONAL;
937+
/*
938+
* We need flush command to flush the file's metadata,
939+
* so report supporting vwc if backend is file, even
940+
* though buffered_io is disable.
941+
*/
942+
if (req->ns->bdev && !bdev_write_cache(req->ns->bdev))
943+
id->nsfeat |= NVME_NS_VWC_NOT_PRESENT;
937944

938945
status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
939946
kfree(id);

0 commit comments

Comments
 (0)