Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp566861rwd; Wed, 14 Jun 2023 21:47:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4P/LSgQPRuaea2ub64bDFx/TLfY8kLKveliiju4rNvWiWLiZSF/oEvodtX0s928NP5O1lV X-Received: by 2002:a2e:300f:0:b0:2b1:eb07:4d82 with SMTP id w15-20020a2e300f000000b002b1eb074d82mr8181218ljw.7.1686804469440; Wed, 14 Jun 2023 21:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686804469; cv=none; d=google.com; s=arc-20160816; b=L+WOmiXL0w5fUPXYZSH/FT7R/3wwLknD6u9zWFJDv1AOGZ0b09qocDFmJTsktwk8Tl sudTNIu1WgsOtHD+0bzKe2jwiZpSXwFCYFgsb2XvYyRukalkYy0B09Nzsi1YjhI0lYSL yd7iU47rL/3ds0ehaTLyN0XiKqm3OyKltkI/RCz69c3GNj38dNwhbr/2fILYlll6UR4Z hNPbpxxD5wuq2m+oWRWUZnC5H3FJARveKlQVE/HXt0kIs0U9XqZNB5wL6VW42CzDZmZI D6AtzcHmsbeXhmg6A/0VUisfbS2kzi4nfD4kLJeTp0N0ovawFEGIfuh1KqsK5eMsOxLr Ni6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=5haX725GsZtcibp1DE+b0jaJ0yctjbpTJI1SRWALvoc=; b=OnTJUJ6ybwFDiJy2/kVhAZOPDztDhRhHc2LGP/EobkwpcpkVWcZrtPp7A8f/iLfe1D QyskCZDqb967XKnLlTuw2dWurSitiBZDv7qIoxZO2RBhhFDtM1Y0OeqBJl/VcRj7S00b wVQL2sc7gU+5hkxefIgXBzm9uGiyq6EzKj+K+iSSMJsx0qk4M8sFLjlhwcphwt/GXv2v mLD1xLGtpXh0Gh3a76KHoWXN3pqAy2bmSk39ExiuwPSYHuUt1GCqs8qi+vmbEHwkZIXo 7dyQTRxD5NPrqUxnRZJjHjnNCTngNzXiEVtoJZLVO+xsfv7dUPan3mxyIM8jYHDItCfp m5lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l20-20020a056402345400b00519df1f95f5si1127090edc.246.2023.06.14.21.47.24; Wed, 14 Jun 2023 21:47:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237730AbjFOEkX (ORCPT + 99 others); Thu, 15 Jun 2023 00:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229712AbjFOEkV (ORCPT ); Thu, 15 Jun 2023 00:40:21 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02CFFB3; Wed, 14 Jun 2023 21:40:21 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id DCDA567373; Thu, 15 Jun 2023 06:40:15 +0200 (CEST) Date: Thu, 15 Jun 2023 06:40:15 +0200 From: Christoph Hellwig To: Damien Le Moal Cc: Alan Stern , Christoph Hellwig , Hannes Reinecke , Joe Breuer , Bart Van Assche , Bagas Sanjaya , Pavel Machek , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Kees Cook , Tony Luck , "Guilherme G. Piccoli" , Thorsten Leemhuis , "James E.J. Bottomley" , "Martin K. Petersen" , Phillip Potter , Linux Power Management , Linux Kernel Mailing List , Linux Hardening , Linux Regressions , Linux SCSI , Dan Williams , Hannes Reinecke , Adrian Hunter , Martin Kepplinger , Kai-Heng Feng Subject: Re: Fwd: Waking up from resume locks up on sr device Message-ID: <20230615044015.GA4720@lst.de> References: <5513e29d-955a-f795-21d6-ec02a2e2e128@gmail.com> <07d6e2e7-a50a-8cf4-5c5d-200551bd6687@gmail.com> <02e4f87a-80e8-dc5d-0d6e-46939f2c74ac@acm.org> <84f1c51c-86f9-04b3-0cd1-f685ebee7592@kernel.org> <37ed36f0-6f72-115c-85fb-62ef5ad72e76@suse.de> <859f0eda-4984-4489-9851-c9f6ec454a88@rowland.harvard.edu> <41b069c7-8723-4507-3e5a-1d1878db9002@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41b069c7-8723-4507-3e5a-1d1878db9002@kernel.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 15, 2023 at 09:10:28AM +0900, Damien Le Moal wrote: > > Here's what commit e27829dc92e5 ("scsi: serialize ->rescan against > > ->remove", written by Christoph Hellwig) says: > > > > Lock the device embedded in the scsi_device to protect against > > concurrent calls to ->remove. > > > > That's the commit which added the device_lock() call. > > Thanks for the information. > > +Christoph > > Why is adding the device_lock() needed ? We could just do a > scsi_device_get()+scsi_device_put() to serialize against remove. No ? No. scsi_device_get just increments a reference count, and thus prevents ->release from beeing called. ->remove is not in any way affected by the refcount.