[PATCH v4 11/11] scsi: add support for user-meta interface
Anuj Gupta
anuj20.g at samsung.com
Thu Oct 17 04:39:23 PDT 2024
> +/*
> + * Can't check reftag alone or apptag alone
> + */
> +static bool sd_prot_flags_valid(struct scsi_cmnd *scmd)
> +{
> + struct request *rq = scsi_cmd_to_rq(scmd);
> + struct bio *bio = rq->bio;
> +
> + if (bio_integrity_flagged(bio, BIP_CHECK_REFTAG) &&
> + !bio_integrity_flagged(bio, BIP_CHECK_APPTAG))
> + return false;
> + if (!bio_integrity_flagged(bio, BIP_CHECK_REFTAG) &&
> + bio_integrity_flagged(bio, BIP_CHECK_APPTAG))
> + return false;
> + return true;
> +}
> +
Martin, Christoph, and all,
This snippet prevents a scenario where a apptag check is specified without
a reftag check and vice-versa, which is not possible for scsi[1]. But for
block layer generated integrity apptag check (BIP_CHECK_APPTAG) is not
specified. When scsi drive is formatted with type1/2 PI, block layer would
specify refcheck but not appcheck. Hence, these I/O's would fail. Do you
see how we can handle this?
[1] https://lore.kernel.org/linux-block/yq1ttgz5l6d.fsf@ca-mkp.ca.oracle.com/
More information about the Linux-nvme
mailing list