Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp313705pxb; Mon, 8 Nov 2021 14:09:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyegeKHvZa4SFUjwtaF2wkWFiPDo9euYHDEK8a7scnYWN2Ke81scXtKdsD14KxLVs6ZIxFz X-Received: by 2002:a05:6402:4401:: with SMTP id y1mr3220847eda.225.1636409371905; Mon, 08 Nov 2021 14:09:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636409371; cv=none; d=google.com; s=arc-20160816; b=x+qQGSQ8nVRbGkoA6mDmAvIb2gEEyjTN3+lUoLAnAk73CB8b5ypH+zuKhr8T4vVjOM p+4xv6eWwI85mDjg05hLs9DBe7KNRVEhGyPme4Kd1jZ1m6Ij4yP52ZZvyVOK3jkyqCy3 XyjHyECxxuTBtbt7Yl+NhKJdy2PC2Eg93tqdRjEX5TWLFmH01GB/yo49Tb6CSCHpTvl2 nYG7MElekjdJ7FWrDe8SzoXcg2j7UIvDQzUG9zClxoXI/P+5HT8MaZxtztbBDFwA/Z7x KybGIekTJRAywO4xURwcpixklLRX8BKoIQCB7C1GPfZaV9ynomEhBo1fiEIyRfN17E5n M7bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=6qrbAoBrJjelIsGjirLwZN0gyhg8Hh/Ojtm8QnhOi0g=; b=HSzdaTaMpQtSqZSieC77A2Fe62hAnuCTCnOtYjXx1f0zYTMl5a2V5sGEkAekjHZzrX TaN9FAHUHHQeXgwX3zakkeju04eU1ApdGr3Q/Q5uUFI7VtS95zkD9Erw3tdHsloDMwLB 0R/mR1fKUatJyEOgCeetkEEsPnmrMjYWHQH77i2CvUh52PqYha3GsXjDXFg3IkGBqjF2 YL2Wp7SB68/7k6NC3gU2f4gUNS176ri5J0vPkF/mFa5azK9jbabIccom9G025rCRcrj6 M5yZF5Yi2ImbZ7nZyu0Gi5xkDe5TMqy12jAjTJ9mZ8YyyovTwYY/ecWG8LiGi93828Qz KJrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i2si30833659ejp.615.2021.11.08.14.09.06; Mon, 08 Nov 2021 14:09:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237771AbhKHRTg (ORCPT + 99 others); Mon, 8 Nov 2021 12:19:36 -0500 Received: from mail-pj1-f46.google.com ([209.85.216.46]:45969 "EHLO mail-pj1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbhKHRTf (ORCPT ); Mon, 8 Nov 2021 12:19:35 -0500 Received: by mail-pj1-f46.google.com with SMTP id gb13-20020a17090b060d00b001a674e2c4a8so392769pjb.4; Mon, 08 Nov 2021 09:16:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6qrbAoBrJjelIsGjirLwZN0gyhg8Hh/Ojtm8QnhOi0g=; b=A73n+QazPeO2QdsJcqw2SVc29aBVqGbufyGCbTEyDbXyUnj7zdTcU8xXpxivFAlBh/ 6hzmIYUxycxdbikUFEAIUVR3RdJ1JG7w6YF8ChgjV/V6S+mAwb4ULGnh5g2LHcKFQL1b RBgnrRd9vvmDt03Othl2NVqo6TkHhcPbY4nFw8ry83XP/JYBNPHumKyVs/VhReaeJ0LN H6sn2qSueinvUoufcyrVbtFt/BT8lHrHfQ2/H6l2fprVYxzDXSmUX/4j3ncW4BDZY7u+ QtBFvrv+Rhzeadg/mQa53jLcL3Tmf9cKBCjx95mBb31RMWWFts9OJf+FqHtVCjDPd5XE cYlw== X-Gm-Message-State: AOAM531fyTujzUKgchUU6J2XVZEJMHpeQ2505I97Tk1oRVAVKk0MZSSN E3JbnHffmHaAv0iw05XAeUg= X-Received: by 2002:a17:90a:ba03:: with SMTP id s3mr533039pjr.116.1636391811033; Mon, 08 Nov 2021 09:16:51 -0800 (PST) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:4ca8:59a2:ad3c:1580]) by smtp.gmail.com with ESMTPSA id z4sm6657616pfg.101.2021.11.08.09.16.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Nov 2021 09:16:49 -0800 (PST) Subject: Re: [PATCH 2/2] scsi: ufs: Return a bsg request immediatley if eh-in-progress To: Avri Altman , "James E . J . Bottomley" , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Adrian Hunter References: <20211108120804.10405-1-avri.altman@wdc.com> <20211108120804.10405-3-avri.altman@wdc.com> From: Bart Van Assche Message-ID: Date: Mon, 8 Nov 2021 09:16:48 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211108120804.10405-3-avri.altman@wdc.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/8/21 4:08 AM, Avri Altman wrote: > ufs-bsg is attempting to access the device from user-space, and it is > unaware of the internal driver flows, specifically if error handling is > currently ongoing. > > Fixes: 5e0a86eed846 (scsi: ufs: Add API to execute raw upiu commands) > > Signed-off-by: Avri Altman > --- > drivers/scsi/ufs/ufshcd.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 3869bb57769b..828061c05909 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -6830,6 +6830,9 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, > enum utp_ocs ocs_value; > u8 tm_f = be32_to_cpu(req_upiu->header.dword_1) >> 16 & MASK_TM_FUNC; > > + if (!ufshcd_is_user_access_allowed(hba)) > + return -EBUSY; > + > switch (msgcode) { > case UPIU_TRANSACTION_NOP_OUT: > cmd_type = DEV_CMD_TYPE_NOP; Making operations fail if error handling is in progress makes it harder than necessary to write user space software that uses the BSG interface. Has it been considered to wait inside ufshcd_exec_raw_upiu_cmd() until error handling has finished? Thanks, Bart.