Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1529890rdd; Thu, 11 Jan 2024 01:47:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGo63WnRv6U2gxSw4o8ZSb9ijFVP+epn1HRyteS0RYPtN3c0JpMbHXJldTsobQ9iYeJ+dbi X-Received: by 2002:a05:6a20:3948:b0:19a:112e:89dc with SMTP id r8-20020a056a20394800b0019a112e89dcmr786740pzg.62.1704966462394; Thu, 11 Jan 2024 01:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704966462; cv=none; d=google.com; s=arc-20160816; b=h0CZoSSQwa8dIkMIz736og7Vq+Xp3cRktx1IemUmd4RYpwXav8Uaj5bY5QQxpP+syB rFJ/HUdsjoUmxR60K0AA8rqK0kQrs0C8S0NDxGpfA2ymhZ3P634T+5l6smbaY4dNFS8F J601QVSaYdOA5ApgSm/Bz6ylEOc/odPDVAG4kvhmCResiaBpkuNrH3ExronTeV4EISx4 Qv5Kk4D5mpmdZaoaML0O0TthzAOMA8ER3Hsfne4UHqakEeB3ZsmAGFOf6fINgfUSHhVc WYRJVQcKAy++zqF5scb5/HBoUqH6ChQnlCTXhV/s/i1kl/atAHQuBjH/rsUJ+cWE9on7 PTug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Juf5uUV4tXU2U1YKARKiIhFtX+TfgU5/8AWD3AT17Qk=; fh=kV4PWBfOozawGU9tD3jKwX3RH0BjK9Di4yIjGsCugVs=; b=Ejq8FTo3pY9CNgzQZmHeSKa1LwvNA3Il0uEIR1fcZkjkuBX22XT6toAk9jt3m7e0F7 fUiLJkQhwRyDigMDRdB+nBNHSZ7SB/MHXOy1AjCFtZvynxgR2PVbhhCc/rTXlXt+W+rO UxFmH5nbRj/4c/klMPF53JmKZSQg33+jYzmm2EipP/m/NofJDgys9E8bi3rgJsVehKA1 TUWP7t0A2xzGWzTETW2g68VpLV2L2+/3SuM6HVyLA1o4d9c8F/wD8nrK6EJA+1RyIEZa lIz92BzdT3OVWcxUcPyB7v7HVNTisA/G7oZ075c3B7ZgkVKoAxHLaxBGeK1W2GB1+mzR Q7mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mV5oevAi; spf=pass (google.com: domain of linux-kernel+bounces-23330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x38-20020a634a26000000b005c278210f82si741923pga.544.2024.01.11.01.47.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 01:47:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mV5oevAi; spf=pass (google.com: domain of linux-kernel+bounces-23330-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23330-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D8F97B224E7 for ; Thu, 11 Jan 2024 09:45:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7DD2811C8F; Thu, 11 Jan 2024 09:45:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="mV5oevAi" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A68E111194; Thu, 11 Jan 2024 09:45:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3D08C433C7; Thu, 11 Jan 2024 09:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1704966343; bh=qKFDAC9Z0CvkABbEWUdz+tzPYQm8wVre2lupE0nCoBQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mV5oevAiLf4HdYbwcimI6X5nngi9Byp7IUGyQ9wPzPZXxwXaGZ6J5DOjJ0uRneOde bZuVNFRnsEfBNPraXxy1T+ShtW5+zXEdHRL8JZ0KD9MFkoXpnV85fQsOpGWARRa/hJ hPhlH1lxaL33V3kjtO2c1LJMg5tOKVtQDDZgKeGA= Date: Thu, 11 Jan 2024 10:45:38 +0100 From: Greg Kroah-Hartman To: "Martin K. Petersen" Cc: Pavel Machek , bvanassche@acm.org, hch@lst.de, hare@suse.de, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, torvalds@linux-foundation.org, stable@vger.kernel.org, lwn@lwn.net, jslaby@suse.cz Subject: Re: scsi_get_lba breakage in 5.10 -- Re: Linux 5.10.206 Message-ID: <2024011121-unfailing-backroom-14e6@gregkh> References: <2024010527-revision-ended-aea2@gregkh> <2024011047-clench-scheme-1f46@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2024011047-clench-scheme-1f46@gregkh> On Wed, Jan 10, 2024 at 10:15:34AM +0100, Greg Kroah-Hartman wrote: > On Tue, Jan 09, 2024 at 08:55:52AM -0500, Martin K. Petersen wrote: > > > > Pavel, > > > > > This is bad idea. This changes return value, but without fixing > > > callers; there will be subtle bugs somewhere. > > > > I'm not sure why this particular change was backported since it was part > > of a larger cleanup of explicitly distinguishing between block layer > > sectors and device-specific LBAs. This was done to fix devices using PI > > with 4 KB blocks which would otherwise end up getting programmed with > > the wrong reference tag value. > > > > > At minimum, we need this: > > > > > > 87662a472a9d8980b26ba5803447df2c4981d467 scsi: iser: Use scsi_get_sector() instead of scsi_get_lba() > > > > I agree this would be appropriate. Otherwise we'll print the error being > > at the wrong sector in case of an error on a PI device with 4 KB blocks. > > However, the message is purely informative. > > > > > That will fix iser, but there's also: > > > > > > drivers/s390/scsi/zfcp_fsf.c: io->ref_tag_value = scsi_get_lba(scsi_cmnd) & 0xFFFFFFFF; > > > drivers/scsi/isci/request.c: tc->ref_tag_seed_gen = scsi_get_lba(scmd) & 0xffffffff; > > > drivers/scsi/isci/request.c: tc->ref_tag_seed_verify = scsi_get_lba(scmd) & 0xffffffff; > > > drivers/scsi/lpfc/lpfc_scsi.c: lba = scsi_get_lba(sc); > > > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ > > > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ > > > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ > > > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */ > > > drivers/scsi/lpfc/lpfc_scsi.c: start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */ > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd), > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd), > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd), > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd), > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd), > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd), > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd), > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd), > > > drivers/scsi/lpfc/lpfc_scsi.c: failing_sector = scsi_get_lba(cmd); > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd), > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd), > > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd), > > > drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd))); > > > drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd))); > > > drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd))); > > > drivers/scsi/qla2xxx/qla_isr.c: cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag, > > > drivers/scsi/qla2xxx/qla_isr.c: sector_t lba_s = scsi_get_lba(cmd); > > > > Save for two cases in lpfc_queuecommand (which like the iser case will > > print the wrong sector number on error) all these look OK to me. Note > > that almost all callers of scsi_get_lba() actually intended to get the > > protocol LBA as the name indicates and not the block layer sector > > number. > > Ick, this is going to get complex fast. How about I revert the whole > series, and then just add the one bugfix at the end, in a "fixed by > hand" version like I have here below. Would that be better overall? > > Thanks, > > greg k-h > > > diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c > index 0c4bc42b55c2..3d3d139127ee 100644 > --- a/drivers/scsi/scsi_error.c > +++ b/drivers/scsi/scsi_error.c > @@ -1069,6 +1069,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, > > scsi_log_send(scmd); > scmd->scsi_done = scsi_eh_done; > + scmd->flags |= SCMD_LAST; > > /* > * Lock sdev->state_mutex to avoid that scsi_device_quiesce() can > @@ -2361,6 +2362,7 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg) > scsi_init_command(dev, scmd); > scmd->request = rq; > scmd->cmnd = scsi_req(rq)->cmd; > + scmd->flags |= SCMD_LAST; > > scmd->scsi_done = scsi_reset_provider_done_command; > memset(&scmd->sdb, 0, sizeof(scmd->sdb)); Ok, I have now done this and will push out a -rc1 with these changes in it. greg k-h >