Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3460466ioo; Mon, 30 May 2022 02:33:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvd9btQcehE2wtNr9qUHQyhFv/EGwr6srU0KDKRDEi9f+bdG3YyJDZy03kVyB9+J/jYZWv X-Received: by 2002:a17:902:7c03:b0:162:1a2d:5b2c with SMTP id x3-20020a1709027c0300b001621a2d5b2cmr38771360pll.107.1653903194130; Mon, 30 May 2022 02:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653903194; cv=none; d=google.com; s=arc-20160816; b=WD9U/JLV+PDnP+TJ24hDVP6nSmOgydHSUPpfTxtxNEDBJZ47z+pVXJ+Z1my7i4zmf1 LC32OkNcBTG9qKDkGfvHfT2SoM9Pw66CB1cekziIjmpKsO72dFxXg9PWr+6jRl1k1KNO 5q4YiTV/Jw5YlkmdxSNx6d1r+kT0Ng2en/S65E2dCFot7hkm56UJ+NgIJRNA7ss1g6ub E7Bz5ttJrBm9H68vP6PSD1wOuaC0VP/9zRozVbWsU4qBMV+0H2iIfnKEt9z1mB6iCf5f JoXJkpeBJzb9EIr4odHekV11GYKwBhPHVpADBh7yJdXbbCLuxUKuhhyvCFr4S51pS7uw C7qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DKRkj/xqttsImUIpAfot1EAes2QVwyvbLRzEMdKGtM8=; b=tggu+dmDSLjp2JEKoHMGGDVlOhFn5GKUjny7mvrPTVMpntAynd3ygE3/A32ZtDIYiD tE4MJPp27Tpu4+wRRAQnKnq/OZcmQUtWjqTrx8V8gL+BUcqoFxfez7/7Y43rff2AQVtT FaG0SuRPNLrKB3sKET9nOCfODu4HXpI9SFuWFYf58gIhXNHb8EdWZDYjwbNd4Wf3v3Hs 6kM2cAVfpr4rPR8tLQt6usqJCsvdHQQ216TAQSIjtd4gUGicnARS4Qux6Ht56AmC2uGQ lfLuA0h1DAa2ZInbyG2yeVY2bwmHTyRiyuKtdYXEmEK1TuSSd5YA2CEo4w/E5frEERk1 I6BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=ENQI6uQq; 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 h2-20020a63f902000000b003f5f0a397e6si15886447pgi.814.2022.05.30.02.32.52; Mon, 30 May 2022 02:33:14 -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; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=ENQI6uQq; 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 S232674AbiE3GBZ (ORCPT + 99 others); Mon, 30 May 2022 02:01:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232666AbiE3GBV (ORCPT ); Mon, 30 May 2022 02:01:21 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE92B7090B; Sun, 29 May 2022 23:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=DKRkj/xqttsImUIpAfot1EAes2QVwyvbLRzEMdKGtM8=; b=ENQI6uQqOs+houccJ/3lgsGW2P UhEA4W3dOhWEdaNQypSeW6OHZu1+9fhwJy/ptJvShOOhbMk8Kchxt0DP1faNviHtpQDIPugRsel/K 1u4lM+sqymbxwr4eAQbH5lrzfSq1+/80RupEUNO1blXzgJl/scfT99Xqw1RLPox4wRXdFdPJjN9M0 Cs69GzE93bofDCbnucZF28P2cQaFBUmJsWfvlSMANIkusQXu075ag3Y2rgaB+3bsknESg+Sy7UaE4 4B+KWPiGcBzO19apaK5y1Vf8E8BKyynJQyoGwyU0K5bQ9AR5CoLr/vXWl6VZ/9mKckwdGdQN+PMxe 2q5UgHjA==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvYSt-005UUM-3L; Mon, 30 May 2022 06:01:19 +0000 Date: Sun, 29 May 2022 23:01:19 -0700 From: Christoph Hellwig To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, Song Liu , Christoph Hellwig , Donald Buczek , Guoqing Jiang , Xiao Ni , Stephen Bates , Martin Oliveira , David Sloan Subject: Re: [PATCH v2 13/17] md/raid5-cache: Add RCU protection to conf->log accesses Message-ID: References: <20220526163604.32736-1-logang@deltatee.com> <20220526163604.32736-14-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220526163604.32736-14-logang@deltatee.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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, May 26, 2022 at 10:36:00AM -0600, Logan Gunthorpe wrote: > The mdadm test 21raid5cache randomly fails with NULL pointer accesses > of conf->log when run repeatedly. conf->log was sort of protected with > RCU, but most dereferences were not done with the correct functions. > > Add rcu_read_locks(), rcu_dereference_protected() and rcu_access_pointers() > calls to the appropriate places and mark the pointer with __rcu. Looking at the code a bit more, is this really enough? Calls to r5c_is_writeback / r5c_confi_is_writeback are sprinkled all over the code, and my gut feeling is the value is not expected to change over way longer critical sections than this. So maybe the answer here is to fix up the release to be properly locked as it only affects the non-I/O slow path anyway.