public inbox for [email protected]
 help / color / mirror / Atom feed
From: Anuj Gupta <[email protected]>
To: "Martin K. Petersen" <[email protected]>
Cc: [email protected], [email protected], [email protected],
	[email protected], [email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected],
	[email protected], [email protected]
Subject: Re: [PATCH v4 11/11] scsi: add support for user-meta interface
Date: Mon, 28 Oct 2024 13:06:10 +0530	[thread overview]
Message-ID: <20241028073610.GB18956@green245> (raw)
In-Reply-To: <[email protected]>

[-- Attachment #1: Type: text/plain, Size: 2102 bytes --]

On Mon, Oct 21, 2024 at 09:58:57PM -0400, Martin K. Petersen wrote:
> 
> Anuj,
> 
> > +/*
> > + * 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;
> > +}
> 
> This breaks reading the partition table.
> 
> The BIP_CHECK_* flags should really only control DIX in the SCSI case.
> Filling out *PROTECT is left as an exercise for the SCSI disk driver.
> It's the only way we can sanely deal with this. Especially given ATO,
> GRD_CHK, REF_CHK, and APP_CHK. It just gets too complicated.
> 
> You should just drop sd_prot_flags_valid() and things work fine. And
> then with BIP_CHECK_* introduced we can drop BIP_CTRL_NOCHECK.

So I will keep the fine grained userspace/bip flags (which we have in
this version). And drop the sd_prot_flags_valid() and BIP_CTRL_NOCHECK
like below [1]. Hope that looks fine

[1]

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index ca4bc0ac76ad..0913bd43f48a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -814,14 +814,14 @@ static unsigned char sd_setup_protect_cmnd(struct scsi_cmnd *scmd,
 		if (bio_integrity_flagged(bio, BIP_IP_CHECKSUM))
 			scmd->prot_flags |= SCSI_PROT_IP_CHECKSUM;
 
-		if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false)
+		if (bio_integrity_flagged(bio, BIP_CHECK_GUARD)
 			scmd->prot_flags |= SCSI_PROT_GUARD_CHECK;
 	}
 
 	if (dif != T10_PI_TYPE3_PROTECTION) {	/* DIX/DIF Type 0, 1, 2 */
 		scmd->prot_flags |= SCSI_PROT_REF_INCREMENT;
 
-		if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false)
+		if (bio_integrity_flagged(bio, BIP_CHECK_REFTAG))
 			scmd->prot_flags |= SCSI_PROT_REF_CHECK;
 	}
 
-- 
2.25.1
> 
> -- 
> Martin K. Petersen	Oracle Linux Engineering
> 

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2024-10-28  8:50 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20241016113705epcas5p1edc284b347de99bc34802b0b0c5e1b27@epcas5p1.samsung.com>
2024-10-16 11:29 ` [PATCH v4 00/11] Read/Write with meta/integrity Anuj Gupta
     [not found]   ` <CGME20241016113724epcas5p191ccce0f473274fc95934956662fc769@epcas5p1.samsung.com>
2024-10-16 11:29     ` [PATCH v4 01/11] block: define set of integrity flags to be inherited by cloned bip Anuj Gupta
2024-10-16 18:03       ` Keith Busch
     [not found]   ` <CGME20241016113736epcas5p3a03665bf0674e68a8f95bbd5f3607357@epcas5p3.samsung.com>
2024-10-16 11:29     ` [PATCH v4 02/11] block: copy back bounce buffer to user-space correctly in case of split Anuj Gupta
2024-10-16 18:04       ` Keith Busch
2024-10-17  7:53       ` Christoph Hellwig
     [not found]   ` <CGME20241016113738epcas5p2d217b8d6efbf855f61c133f64deaa486@epcas5p2.samsung.com>
2024-10-16 11:29     ` [PATCH v4 03/11] block: modify bio_integrity_map_user to accept iov_iter as argument Anuj Gupta
     [not found]   ` <CGME20241016113741epcas5p3b90adb3b43b6b443ffd00df29d63d289@epcas5p3.samsung.com>
2024-10-16 11:29     ` [PATCH v4 04/11] block: define meta io descriptor Anuj Gupta
2024-10-16 19:35       ` Keith Busch
2024-10-17  5:49         ` Anuj Gupta
2024-10-17  7:57       ` Christoph Hellwig
2024-10-22  2:11       ` Martin K. Petersen
2024-10-22  6:04         ` Christoph Hellwig
2024-10-23  1:20           ` Martin K. Petersen
2024-10-28  3:46         ` Anuj Gupta
     [not found]   ` <CGME20241016113743epcas5p3b4092c938d8795cea666ab4e6baf4aa9@epcas5p3.samsung.com>
2024-10-16 11:29     ` [PATCH v4 05/11] fs: introduce IOCB_HAS_METADATA for metadata Anuj Gupta
2024-10-17  7:58       ` Christoph Hellwig
     [not found]   ` <CGME20241016113745epcas5p1723d91b979fd0e597495fef377ad0f62@epcas5p1.samsung.com>
2024-10-16 11:29     ` [PATCH v4 06/11] block: add flags for integrity meta Anuj Gupta
2024-10-17  8:00       ` Christoph Hellwig
2024-10-17 10:45         ` Anuj Gupta
2024-10-17 12:01           ` Christoph Hellwig
2024-10-17 12:59             ` Anuj gupta
2024-10-17 14:34               ` Christoph Hellwig
     [not found]   ` <CGME20241016113747epcas5p4e276eb0da2695ba032ce1d2a3b83fff4@epcas5p4.samsung.com>
2024-10-16 11:29     ` [PATCH v4 07/11] io_uring/rw: add support to send meta along with read/write Anuj Gupta
2024-10-17  8:10       ` Christoph Hellwig
2024-10-17 22:51         ` Jens Axboe
2024-10-21  5:31         ` Anuj Gupta
2024-10-22  6:02           ` Christoph Hellwig
2024-10-22  1:50         ` Martin K. Petersen
     [not found]   ` <CGME20241016113750epcas5p2089e395ca764de023be64519da9b0982@epcas5p2.samsung.com>
2024-10-16 11:29     ` [PATCH v4 08/11] block: introduce BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags Anuj Gupta
2024-10-17  8:12       ` Christoph Hellwig
2024-10-17 10:46         ` Anuj Gupta
2024-10-17 14:37           ` Christoph Hellwig
     [not found]   ` <CGME20241016113752epcas5p4c365819fce1e5d498fd781ae2b309341@epcas5p4.samsung.com>
2024-10-16 11:29     ` [PATCH v4 09/11] block: add support to pass user meta buffer Anuj Gupta
2024-10-17  8:15       ` Christoph Hellwig
2024-10-17  8:24       ` Christoph Hellwig
     [not found]   ` <CGME20241016113755epcas5p2d563b183a9f4e19f5c02d73255282342@epcas5p2.samsung.com>
2024-10-16 11:29     ` [PATCH v4 10/11] nvme: add support for passing on the application tag Anuj Gupta
2024-10-17  8:14       ` Christoph Hellwig
     [not found]   ` <CGME20241016113757epcas5p42b95123c857e5d92d9cdec55e190ce4e@epcas5p4.samsung.com>
2024-10-16 11:29     ` [PATCH v4 11/11] scsi: add support for user-meta interface Anuj Gupta
2024-10-17  8:15       ` Christoph Hellwig
2024-10-17 11:39       ` Anuj Gupta
2024-10-17 14:39         ` Christoph Hellwig
2024-10-18  8:26           ` Anuj Gupta
2024-10-18  9:02             ` Christoph Hellwig
2024-10-22  1:58       ` Martin K. Petersen
2024-10-28  7:36         ` Anuj Gupta [this message]
2024-10-29  2:24           ` Martin K. Petersen
2024-10-22  2:04   ` [PATCH v4 00/11] Read/Write with meta/integrity Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241028073610.GB18956@green245 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox