Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4519634ybz; Tue, 21 Apr 2020 02:03:02 -0700 (PDT) X-Google-Smtp-Source: APiQypK59ClYsURiiod1NJSS/13fBv6ehW6ZI70gjN15OaijSVQN07JsyA7vU4xRR4+0RgjWX7Wz X-Received: by 2002:aa7:df0a:: with SMTP id c10mr17151955edy.306.1587459782251; Tue, 21 Apr 2020 02:03:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587459782; cv=none; d=google.com; s=arc-20160816; b=peyl7eYaCnT5XXtn+41GO1PQU8hXv3niDWhq1s9bDbFHyP8ncoM2PdGVN1y2nIElwp gcB1M4XWNSyotkrSk3PnEtmoDWT75LxFOFY/mIOPE+6T4XCk0AuPWkBcYY3jZEO4lKzG k5/F5/y0H0UT9vtPo21ehZ46jcxKsg/RJ3Q3r6Df8A7WaZjW2+yKheEc8ztx5RT5J2ml WlKXiaHzn0j6aEvHllfJOCz/hf1TgLgJeEImJ4YtSXopVOKsC57LIF+cNQxK8C2cwt1+ 8FbXBopreKnPI5uNlfcTX76TWPiQH3An9kABrhifpKOKTTE8bJ07RisubvaS8+4LcWbJ gA7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=QuDb75IJ8FWCQ3cQ6m/BOpCM+BfZmjYmhG5ABwAegW4=; b=B/HlL/zqL02mH9g5syC0qLEGL/lJNfhGlRvfuQqvfiNVsT7fHikdmpm2eAiHTILRab m1ejXs9HXEy/4+5XyZd5YkYtyishyUMw0mNuQ07H/7KsMOmLMQ08BWnKPSIE+GQdiVdE xlowfRwP6VzPWNNAxNJWG0cwfNPHMU31hQ2799EztPYHZMfUtpQZaJ7oy3UQTCZSilfQ oCWNSnzS5Af+9e5an6Q/rsth28cI7DxGoFGC6xt9RcRm0IdQJqBqbtzEIL+1NeAV/IAl IVSdBMmHFz6IWCYgiQFjFGu9cF7EWXaPVP28LoLkvjBD4pgokmGrejWw2t0UNfD1FsWd 3fVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="HBq/FbUK"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c22si1177750edr.408.2020.04.21.02.02.38; Tue, 21 Apr 2020 02:03:02 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="HBq/FbUK"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728224AbgDUI7F (ORCPT + 99 others); Tue, 21 Apr 2020 04:59:05 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22211 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726741AbgDUI7E (ORCPT ); Tue, 21 Apr 2020 04:59:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587459543; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QuDb75IJ8FWCQ3cQ6m/BOpCM+BfZmjYmhG5ABwAegW4=; b=HBq/FbUK+ZPU7UJ0bsow1DDhPGfeHWAzKzc5VCBEGDfxV9MrjnhBhS9lJ009zCWcTAHkba rm8334suhat0hrG2tBOKDeHUwRJTb0lVmT1GJ4h8No35fj5iKpJrQB81uGk//gVsBZx0rB EeRgGVOzrG/gLyoaB1sxlpYoQ7HQoFE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-305-IPHMGftYOmG5nkcrO-xcbQ-1; Tue, 21 Apr 2020 04:58:59 -0400 X-MC-Unique: IPHMGftYOmG5nkcrO-xcbQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87635800D5B; Tue, 21 Apr 2020 08:58:57 +0000 (UTC) Received: from T590 (ovpn-8-38.pek2.redhat.com [10.72.8.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69FD960C80; Tue, 21 Apr 2020 08:58:49 +0000 (UTC) Date: Tue, 21 Apr 2020 16:58:44 +0800 From: Ming Lei To: Dexuan Cui Cc: "martin.petersen@oracle.com" , "bvanassche@acm.org" , "hch@lst.de" , "linux-scsi@vger.kernel.org" , "jejb@linux.ibm.com" , "linux-kernel@vger.kernel.org" , "hare@suse.de" , Michael Kelley , Long Li Subject: Re: [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to SDEV_BLOCK Message-ID: <20200421085844.GA284628@T590> References: <1587170445-50013-1-git-send-email-decui@microsoft.com> <20200418024158.GB17090@T590> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 21, 2020 at 03:01:34AM +0000, Dexuan Cui wrote: > > From: Ming Lei > > Sent: Friday, April 17, 2020 7:42 PM > > To: Dexuan Cui > > Cc: jejb@linux.ibm.com; martin.petersen@oracle.com; > > linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; hch@lst.de; > > bvanassche@acm.org; hare@suse.de; Michael Kelley > > ; Long Li > > Subject: Re: [PATCH] scsi: core: Allow the state change from SDEV_QUIESCE to > > SDEV_BLOCK > > > > On Fri, Apr 17, 2020 at 05:40:45PM -0700, Dexuan Cui wrote: > > > The APIs scsi_host_block()/scsi_host_unblock() are recently added by: > > > 2bb955840c1d ("scsi: core: add scsi_host_(block,unblock) helper function") > > > and so far the APIs are only used by: > > > 3d3ca53b1639 ("scsi: aacraid: use scsi_host_(block,unblock) to block I/O") > > > > > > However, from reading the code, I think the APIs don't really work for > > > aacraid, because, in the resume path of hibernation, when aac_suspend() -> > > > scsi_host_block() is called, scsi_device_quiesce() has set the state to > > > SDEV_QUIESCE, so aac_suspend() -> scsi_host_block() returns -EINVAL. > > > > > > Fix the issue by allowing the state change. > > > > > > Fixes: 2bb955840c1d ("scsi: core: add scsi_host_(block,unblock) helper > > function") > > > Signed-off-by: Dexuan Cui > > > --- > > > drivers/scsi/scsi_lib.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > > > index 47835c4b4ee0..06c260f6cdae 100644 > > > --- a/drivers/scsi/scsi_lib.c > > > +++ b/drivers/scsi/scsi_lib.c > > > @@ -2284,6 +2284,7 @@ scsi_device_set_state(struct scsi_device *sdev, > > enum scsi_device_state state) > > > switch (oldstate) { > > > case SDEV_RUNNING: > > > case SDEV_CREATED_BLOCK: > > > + case SDEV_QUIESCE: > > > case SDEV_OFFLINE: > > > break; > > > default: > > > > Looks reasonable because SDEV_BLOCK is one more strict state than > > QEIESCE, so: > > Thanks, Ming! > > > Reviewed-by: Ming Lei > > > > Thanks, > > Ming > > There should be a small typo: s/redha/redhat :-) Sorry for the fault: Reviewed-by: Ming Lei Thanks, Ming