From patchwork Tue Mar 6 19:05:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 130832 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp4295911lja; Tue, 6 Mar 2018 11:05:36 -0800 (PST) X-Google-Smtp-Source: AG47ELsXpU3U7ea4U3GupU8VzoyvAS/bmKa0aF4zbCL+s3ALLFB6cngWV4eSnKs7lP6eF+v+IpvE X-Received: by 2002:a17:902:850a:: with SMTP id bj10-v6mr18030001plb.5.1520363136160; Tue, 06 Mar 2018 11:05:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520363136; cv=none; d=google.com; s=arc-20160816; b=oRWWNZwwUvUkRu5pLnaJfk9j+EFFBke53STtxUDIGwBra/b6GQ1DQ8/brhtHVwRATX uHb5yiu82632ys/4qkj8O5c4+6CumYMh+g/QoheQXmEgvIVg7hoQ+g0qn6Ad0JRwjPMp bFFNt+v7v4ZgFHYak/Fe1OytFLWsBkOpRVyqAsTggjbQqThcozPASwLcaEXPhcW71Ahb aWEJYEw4fMwvx2XalQ91ESXKZdGx+OzReUrGAdvDBNHBxzGUEeIjeip39ArR4k/CoNxT KOkp+694U41gg8uEcNwSjk1nAQb+qG1pTFlGH2GBmJ2A9ZNyn5bjOse38mOiIpgSGb9N 42cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=a1V6BwQO4moREB4V8DdZsoaaYJ3c4dnM7bhD6UB+FKQ=; b=jOArirjMjioWDXEcJLWZIIE/unFNDA+4JeRhTlKad3nVIeEMcm1RWMowIJOwi96ItY 57Ffe1WIWKSVrq/iCckJtCfaZSXCAuq3ZlHrLoGY8GFKkxkJXleh/pxbJS4KXylNXiNl 5bo5JoN1hsK3hK/yreu7r6RU/h2P0EXEpxhNSH/1YV2wMToYc0++tAxSeeqcgndCurWc mh4DV5rz8ho1XatHLnvPfd8BvdzMuEZxyMqqaEO14VaOgGbAVUipwEhIyOQ8pbEkxHKs w/sytAPIsp4FxW9dRJBH0sweSWw6gl5nrPmVeo54n0BNx6/nw84w1b+yx2foj7tM3k4y etyg== ARC-Authentication-Results: i=1; mx.google.com; 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 k15si12335584pfi.174.2018.03.06.11.05.35; Tue, 06 Mar 2018 11:05:36 -0800 (PST) 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; 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 S1754043AbeCFTFF (ORCPT + 28 others); Tue, 6 Mar 2018 14:05:05 -0500 Received: from foss.arm.com ([217.140.101.70]:43130 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750838AbeCFTFE (ORCPT ); Tue, 6 Mar 2018 14:05:04 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BB6C415BE; Tue, 6 Mar 2018 11:05:03 -0800 (PST) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8D6563F5C9; Tue, 6 Mar 2018 11:05:03 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id C8EA91AE536F; Tue, 6 Mar 2018 19:05:07 +0000 (GMT) From: Will Deacon To: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, torvalds@linux-foundation.org Cc: peterz@infradead.org, willy@infradead.org, linux-kernel@vger.kernel.org, Will Deacon Subject: [RESEND PATCHv2 2/2] fs: dcache: Use READ_ONCE when accessing i_dir_seq Date: Tue, 6 Mar 2018 19:05:06 +0000 Message-Id: <1520363106-4687-3-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1520363106-4687-1-git-send-email-will.deacon@arm.com> References: <1520363106-4687-1-git-send-email-will.deacon@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org i_dir_seq is subject to concurrent modification by a cmpxchg or store-release operation, so ensure that the relaxed access in d_alloc_parallel uses READ_ONCE. Reported-by: Peter Zijlstra Signed-off-by: Will Deacon --- fs/dcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.4 diff --git a/fs/dcache.c b/fs/dcache.c index b243deec298c..5716ab04e1db 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2502,7 +2502,7 @@ struct dentry *d_alloc_parallel(struct dentry *parent, } hlist_bl_lock(b); - if (unlikely(parent->d_inode->i_dir_seq != seq)) { + if (unlikely(READ_ONCE(parent->d_inode->i_dir_seq) != seq)) { hlist_bl_unlock(b); rcu_read_unlock(); goto retry;