lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240617162657.GA843635@p1gen4-pw042f0m.fritz.box>
Date: Mon, 17 Jun 2024 18:26:57 +0200
From: Benjamin Block <bblock@...ux.ibm.com>
To: Li Feng <fengli@...rtx.com>
Cc: "James E.J. Bottomley" <James.Bottomley@...senpartnership.com>,
        open list <linux-kernel@...r.kernel.org>,
        "open list:SCSI SUBSYSTEM" <linux-scsi@...r.kernel.org>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
Subject: Re: [PATCH] scsi: sd: Keep the discard mode stable

Hey,

On Sat, Jun 15, 2024 at 12:03:47AM +0800, Li Feng wrote:
> There is a scenario where a large number of discard commands
> are issued when the iscsi initiator connects to the target
> and then performs a session rescan operation. 

Is this with just one specific target implementation? This sounds like a
broken/buggy target, or is there a reason why this happens in general?

And broken target sounds like device quirk, rather than impacting every
possible target.

> There is a time
> window, most of the commands are in UNMAP mode, and some
> discard commands become WRITE SAME with UNMAP.
> 
> The discard mode has been negotiated during the SCSI probe. If
> the mode is temporarily changed from UNMAP to WRITE SAME with
> UNMAP, IO ERROR may occur because the target may not implement
> WRITE SAME with UNMAP. Keep the discard mode stable to fix this
> issue.
> 
> Signed-off-by: Li Feng <fengli@...rtx.com>
> ---
>  drivers/scsi/sd.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index f6c822c9cbd2..0165dc70a99b 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2598,7 +2598,12 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
>  		if (buffer[14] & 0x40) /* LBPRZ */
>  			sdkp->lbprz = 1;
>  
> -		sd_config_discard(sdkp, SD_LBP_WS16);
> +		/*
> +		 * When the discard mode has been set to UNMAP, it should not be set to
> +		 * WRITE SAME with UNMAP.
> +		 */
> +		if (!sdkp->max_unmap_blocks)
> +			sd_config_discard(sdkp, SD_LBP_WS16);
>  	}
>  
>  	sdkp->capacity = lba + 1;

-- 
Best Regards, Benjamin Block        /        Linux on IBM Z Kernel Development
IBM Deutschland Research & Development GmbH    /   https://www.ibm.com/privacy
Vors. Aufs.-R.: Wolfgang Wendt         /        Gesch?ftsf?hrung: David Faller
Sitz der Ges.: B?blingen     /    Registergericht: AmtsG Stuttgart, HRB 243294

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ