Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp593ybh; Mon, 20 Jul 2020 08:58:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyu3FhPLXP0dU+JeQB7lGI+aONto+g510Iaoa2q6AFJjQ8nuFy7ZnbJra85aVgpw1QRtUGR X-Received: by 2002:a05:6402:1507:: with SMTP id f7mr22918810edw.37.1595260735930; Mon, 20 Jul 2020 08:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595260735; cv=none; d=google.com; s=arc-20160816; b=UwOFzt4UyALs+bVaei1MwJ5L17MtdDm6+XFTjX8zzpj1mEQPYa8LtKtTQdrgFBRoTm I5YPLWsLvOi2GvXgt8BpqtzAOMOcAeePvsVbfFZ01At4QZonfFUQm1B0mlIucgK+2o85 fntlq8f+QSYk9gIlJ1oU6aVYFyR/v+JVbSx34/y0NGFlHMpfvdzyTGr9UznV6/3sHNjX lcGzcXiUCqBCI4AbPuNNcPA5V5OpEyoNUxzDOxGODaIU68mBt31JFa5As5qigCjj3n/r XHHXLjulWNAnofveQb+XtVGpmiH6Ydyb6ln4S8na/UTq4VMLZk1hZAByYfDZfhnjIFqq 0eRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=gjBiJEwyrXxSA52xQ4637SX/LhV+HHIgWPKRBeE4gMY=; b=MH7rrsRGhOWVJr15LxsQZ6KYcuxJrfZufcAaqlJX3Cpl9JPPxJwSxhQB8GY/52NwHS VcZEEHM/q2VCSw91Vf+bqloeV081+HZtmFGCRP+hjhKyWi3etAwDrpnPp+DsFVi8zzg1 VYPSBr/mKjzcA5ws654XrIJrkdHw5VvdUnpR194wye3juLysSv3BDdo75pVlEWnfiH/R i3e7GSpilMoRBov9CDqNe63v4215c5gCO/0o3h6BiVZUeya4F20s5qpHXPE+RdSPJy98 armoYm6lZHvrlq/e0Ts5G0qb+CrmYVHX1qMpDX9l9HgaQCmQ9Cy8hSL3JRmLBfrIMchW F/CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=JskSG97Z; dkim=neutral (no key) header.i=@vger.kernel.org header.b=jdzmhHQA; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si10882205edy.563.2020.07.20.08.58.30; Mon, 20 Jul 2020 08:58:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@linutronix.de header.s=2020 header.b=JskSG97Z; dkim=neutral (no key) header.i=@vger.kernel.org header.b=jdzmhHQA; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731889AbgGTP5P (ORCPT + 99 others); Mon, 20 Jul 2020 11:57:15 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:58982 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731879AbgGTP5P (ORCPT ); Mon, 20 Jul 2020 11:57:15 -0400 From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1595260632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gjBiJEwyrXxSA52xQ4637SX/LhV+HHIgWPKRBeE4gMY=; b=JskSG97Z/unX95AAX1Jjm8Ns2OCTdph2TdGmq7EjoOMw1O61ho5o8HCe/PmnmOfdOiwR2G BAsE7ccRZJ7pWjZ3VdLhvEECDsBDRViQVWGtpX4InMXunbRn5Tg3NmEaJRgAm9hGMkOLxe JeHcLNVy4dFf3lCaiG8fzYzTppDSBz9h7raXMnteivQLU1PBq+U5Qc7wJbCZD88zLiEdpy X5qNp0CIf/qFUSd8YsJ5sEizCPj4nbe1u2L//pv0VGFAQiRdzVbOhcqXUxFxZA+ySe451Y H8nZGMewmjzoYpUAuAhrk4nN523cJpX5kaF+tK8c73MzKJtO54oleP2UVbnzdw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1595260632; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gjBiJEwyrXxSA52xQ4637SX/LhV+HHIgWPKRBeE4gMY=; b=jdzmhHQAFG9KA3OF557zjFKSsF37vGbpIRGkC/fQGHD705Uf+6rpXA+JGWNNl1GCAuSa5c fRs+2KqfTW/5LyDg== To: Peter Zijlstra , Ingo Molnar , Will Deacon Cc: Thomas Gleixner , "Paul E. McKenney" , "Sebastian A. Siewior" , Steven Rostedt , LKML , "Ahmed S. Darwish" , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Subject: [PATCH v4 21/24] NFSv4: Use sequence counter with associated spinlock Date: Mon, 20 Jul 2020 17:55:27 +0200 Message-Id: <20200720155530.1173732-22-a.darwish@linutronix.de> In-Reply-To: <20200720155530.1173732-1-a.darwish@linutronix.de> References: <20200519214547.352050-1-a.darwish@linutronix.de> <20200720155530.1173732-1-a.darwish@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org A sequence counter write side critical section must be protected by some form of locking to serialize writers. A plain seqcount_t does not contain the information of which lock must be held when entering a write side critical section. Use the new seqcount_spinlock_t data type, which allows to associate a spinlock with the sequence counter. This enables lockdep to verify that the spinlock used for writer serialization is held when the write side critical section is entered. If lockdep is disabled this lock association is compiled out and has neither storage size nor runtime overhead. Signed-off-by: Ahmed S. Darwish --- fs/nfs/nfs4_fs.h | 2 +- fs/nfs/nfs4state.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 2b7f6dcd2eb8..210e590e1f71 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -117,7 +117,7 @@ struct nfs4_state_owner { unsigned long so_flags; struct list_head so_states; struct nfs_seqid_counter so_seqid; - seqcount_t so_reclaim_seqcount; + seqcount_spinlock_t so_reclaim_seqcount; struct mutex so_delegreturn_mutex; }; diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index a8dc25ce48bb..b1dba24918f8 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -509,7 +509,7 @@ nfs4_alloc_state_owner(struct nfs_server *server, nfs4_init_seqid_counter(&sp->so_seqid); atomic_set(&sp->so_count, 1); INIT_LIST_HEAD(&sp->so_lru); - seqcount_init(&sp->so_reclaim_seqcount); + seqcount_spinlock_init(&sp->so_reclaim_seqcount, &sp->so_lock); mutex_init(&sp->so_delegreturn_mutex); return sp; } -- 2.20.1