Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4300547imm; Mon, 14 May 2018 05:43:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZplZ9vTyLCVsgFd2N5zL23fX5Pgux41ALKl/aW7VA9ijO2iV2/ARkWbKGrK0u8nP3tThvJG X-Received: by 2002:a63:9741:: with SMTP id d1-v6mr8540483pgo.447.1526301832627; Mon, 14 May 2018 05:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526301832; cv=none; d=google.com; s=arc-20160816; b=JuY1dAxs6kJVpK5QIGN3C20RA75trNB17lroghyBtXl9Yva2l7gKWzdDcw0z16FJNz 2VwtugjTAy1VDk6zr8ndlm+43/aiQK8nIomhUvSMRwaq8qscktSoHMPHbyyEQRS2Ok/M heYd2wSXre4yV/pzTkDD+9cotDckZRepKj1HtxRIIheCqM52kcqJVL5qBnF0xWq0WsO1 5jyeTlRuuel2XsluU1bA9EJCnYdSvzq956rHMjo9gpUltt9vihP733bPpQ5sXkNxQl+1 aiWRSRIDt4jSOKx84OszK/CqXh+jaNft0JN7HoYVRTE8lKAkRMTeyky+mpQBrN3K5swO lB6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=J+gIf/iS1YNB+SVuEmsMuV1azP9OebDnfisWHno1UiM=; b=Jj9APxhawb5D4q6EWaRbR6efpHLC4SowsVbIlXV8GFVmilrtTdGC/DxVuwgrnM4TTL r/Ld9foZW617Ag8yBGl4cZASHCuG2DGL96jWZ8Im3tMa28jteTySgq3hZjRz88kKoWWh piRPRxltML/Xkvi/5P2casfYs+BfoOifkfexni1T22BZPkO/V68mpVQ1N6bYYfrRyi1b BPXRSPPx4gDlpnlM7myZtANBxEBDejgeosJ4qRCjyzP7XhGSs9EUc77mZJPlvu32vCOe a4kZqmYjOueZpo9Hx0IxdVBqsD7LIk1BGkoMky8v6strQEssCKKpkGZe0EONdQQ7xlT7 qNCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=D2HMOjgz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8-v6si9356898plr.471.2018.05.14.05.43.38; Mon, 14 May 2018 05:43:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=D2HMOjgz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753411AbeENMml (ORCPT + 99 others); Mon, 14 May 2018 08:42:41 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40020 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752985AbeENMmi (ORCPT ); Mon, 14 May 2018 08:42:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=J+gIf/iS1YNB+SVuEmsMuV1azP9OebDnfisWHno1UiM=; b=D2HMOjgzaB+Y/aBh0IqbbeFZ6 HGq9JJda2yf7UeDSWH1osR7650g/vHBuexNkGie9wzT4OtVDShT55RIe04vx1kNXTwXyibG/utJAA dr6NE8v1EPIA+8Sj4p4Qpi0CZmGwJLMtvKTsGeCnaJGZ2SnX+41iJxJpO0HODVFPJfLe9ScBY85uP KCf8zV7jGGy923Vls0Fdz/vLDoFQcc69IVxioYvzaSK9A2ItASnLwDeSqtKq1p8W/BCFAr3boutpn ff9CBSpdL8oTQolq+7ZJxxsYbQTxLHXbXf3whRjmomELMpVDCVRWh6G1tuqt5LBN2Ba0KnXzwlIjM rxYt4+VXg==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fICoA-0004zm-Qx; Mon, 14 May 2018 12:42:30 +0000 Date: Mon, 14 May 2018 05:42:30 -0700 From: Christoph Hellwig To: Johannes Thumshirn Cc: Keith Busch , Sagi Grimberg , Linux Kernel Mailinglist , Linux NVMe Mailinglist , Hannes Reinecke , Christoph Hellwig , paulmck@linux.vnet.ibm.com Subject: Re: [PATCH] nvme: fix lockdep warning in nvme_mpath_clear_current_path Message-ID: <20180514124230.GA654@infradead.org> References: <20180514121312.13624-1-jthumshirn@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180514121312.13624-1-jthumshirn@suse.de> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > extern unsigned int nvme_io_timeout; > #define NVME_IO_TIMEOUT (nvme_io_timeout * HZ) > @@ -454,7 +455,9 @@ static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns) > { > struct nvme_ns_head *head = ns->head; > > - if (head && ns == srcu_dereference(head->current_path, &head->srcu)) > + if (head && > + ns == rcu_dereference_protected(head->current_path, > + lockdep_is_held(&ns->ctrl->subsys->lock))) > rcu_assign_pointer(head->current_path, NULL); > } > struct nvme_ns *nvme_find_path(struct nvme_ns_head *head); We don't really dereference it at all in fact, but just check the pointers for equality. I wonder if there is a better way to do this, as my ANA patches add a caller without the lock (and withou SRU protection either now that I think of it) - for a pure pointer compare we really should not need any sort of protection.