Skip to content

Commit e80774a

Browse files
committed
nvme: handle absence of PI support in IO commands
The PI feature is not always available, thus do not try to use it if it is not available. Signed-off-by: Daniel Wagner <[email protected]>
1 parent c33059a commit e80774a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

nvme.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7262,9 +7262,10 @@ static int init_pi_tags(struct nvme_transport_handle *hdl,
72627262
return -ENOMEM;
72637263

72647264
err = nvme_identify_csi_ns(hdl, nsid, NVME_CSI_NVM, 0, nvm_ns);
7265+
if (err)
7266+
return -ENAVAIL;
72657267

7266-
if (!err)
7267-
get_pif_sts(ns, nvm_ns, &pif, &sts);
7268+
get_pif_sts(ns, nvm_ns, &pif, &sts);
72687269

72697270
if (invalid_tags(lbst, ilbrt, sts, pif))
72707271
return -EINVAL;
@@ -7379,7 +7380,7 @@ static int write_zeroes(int argc, char **argv,
73797380
cfg.block_count, control, cfg.dspec, 0, 0);
73807381
err = init_pi_tags(hdl, &cmd, cfg.nsid, cfg.ilbrt, cfg.lbst,
73817382
cfg.lbat, cfg.lbatm);
7382-
if (err)
7383+
if (err != 0 && err != -ENAVAIL)
73837384
return err;
73847385
err = nvme_submit_io_passthru(hdl, &cmd);
73857386
if (err < 0)
@@ -7719,7 +7720,7 @@ static int copy_cmd(int argc, char **argv, struct command *acmd, struct plugin *
77197720
cfg.fua, cfg.lr, 0, cfg.dspec, copy->f0);
77207721
err = init_pi_tags(hdl, &cmd, cfg.nsid, cfg.ilbrt, cfg.lbst, cfg.lbat,
77217722
cfg.lbatm);
7722-
if (err)
7723+
if (err != 0 && err != -ENAVAIL)
77237724
return err;
77247725
err = nvme_submit_io_passthru(hdl, &cmd);
77257726
if (err < 0)
@@ -8561,7 +8562,7 @@ static int verify_cmd(int argc, char **argv, struct command *acmd, struct plugin
85618562
cfg.block_count, control, 0, NULL, 0, NULL, 0);
85628563
err = init_pi_tags(hdl, &cmd, cfg.nsid, cfg.ilbrt, cfg.lbst,
85638564
cfg.lbat, cfg.lbatm);
8564-
if (err)
8565+
if (err != 0 && err != -ENAVAIL)
85658566
return err;
85668567
err = nvme_submit_io_passthru(hdl, &cmd);
85678568
if (err < 0)

0 commit comments

Comments
 (0)