Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1558660ybn; Wed, 2 Oct 2019 18:45:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/4e6Eyca9SujTxpcoTQyP129GQaZrE8mu/qNyS7Ll12mOTmyClGLMNA1F1Iz7CCpSRpc3 X-Received: by 2002:a50:9208:: with SMTP id i8mr6944493eda.3.1570067119971; Wed, 02 Oct 2019 18:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570067119; cv=none; d=google.com; s=arc-20160816; b=UcDuncHkxpA6Z0bAvbO7e7lVBxYhNV2z9q0fSCnFzI+ddGyG/Peuu6aCefBKidWbbm 0V4DXXVsEYisNpQRgqno7auYSDDd8f4aRLonbMMbC0GXAGxVLMuV0YyIsS/liN71htZR W+B8KoAC3WnGy6P6SoKV8jWNEARrZR3qxKhdwRMYyQeIFIeKpmZ8Lr5oe4OJHCRRnr7F w3Op4o/86GeA3dpb9HInFOaf/G5H5Yec5SDBu0bzX/VRUESFbtJbFLzJboLTjOxWs1aV 0qIyVKqhH/91lvYUgco9Uuc9OPdBsfTi+PCeoTTltI2Nfr+dtXnW8xX3CX4e84Yd43Jg irtQ== 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:dkim-signature; bh=UgK5Ws7sYVZ/k29yQraN2JGuYVCMdIjCFVhbLIz7S4E=; b=D2qxitgxHXGvX/9wLzJToHtUsy641gvsS9TqPZ5NPXIA/CZStqJvqZWzAjOLj46+dh PvcHawisQab/9ERXlq2R9hhI/hHsk5wjpWQZluE5189tOyGjoMAtMe2///+kp0dci/ii s1GEPdEqeG2DmbGnlQMTk6g00m2mUlWHsL8+d5wvnp7NWnuwMAkcQSvRQzElHHjeTGv7 O3XDT/C6a3NpOopnqqJUJlS13OGjoydFZGMF4OK2LTHIwqFCqQSdkAwdZ5XK+1n7XStj PkxSGNQwTLw1mgUd1r3sOejhxmIVxBhKfFMvrK3TAqzH0biPaotwFuimAWdTSKdegoWk fZmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mhlZM0t9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si590160edb.133.2019.10.02.18.44.55; Wed, 02 Oct 2019 18:45:19 -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=pass header.i=@kernel.org header.s=default header.b=mhlZM0t9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728212AbfJCBnm (ORCPT + 99 others); Wed, 2 Oct 2019 21:43:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:46434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727273AbfJCBnN (ORCPT ); Wed, 2 Oct 2019 21:43:13 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E127B222C8; Thu, 3 Oct 2019 01:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570066993; bh=674sHQEd1wluZlpmpGS4UprpGUXEIOiNdSfx4wnH0Vw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mhlZM0t9VUSt50XzFkt/IP1tuY5mku4MD4KrTjlETK9iTuEeduxMqFNUJjebxX4Cx MTep+XQa5SE7NRRfIkugNjmwvh3vc4+kYIqk/lxCEQYmoZNnx+GOhnjnq9lNmF/uSz bZfftureC0kb/3jyxCPXzkqbEKpGUp/vGZYl8cRE= From: paulmck@kernel.org To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, "Paul E. McKenney" , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org Subject: [PATCH tip/core/rcu 4/9] drivers/scsi: Replace rcu_swap_protected() with rcu_replace() Date: Wed, 2 Oct 2019 18:43:05 -0700 Message-Id: <20191003014310.13262-4-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20191003014153.GA13156@paulmck-ThinkPad-P72> References: <20191003014153.GA13156@paulmck-ThinkPad-P72> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Paul E. McKenney" This commit replaces the use of rcu_swap_protected() with the more intuitively appealing rcu_replace() as a step towards removing rcu_swap_protected(). Link: https://lore.kernel.org/lkml/CAHk-=wiAsJLw1egFEE=Z7-GGtM6wcvtyytXZA1+BHqta4gg6Hw@mail.gmail.com/ Reported-by: Linus Torvalds Signed-off-by: Paul E. McKenney Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Cc: --- drivers/scsi/scsi.c | 4 ++-- drivers/scsi/scsi_sysfs.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 1f5b5c8..6a38d4a 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -434,8 +434,8 @@ static void scsi_update_vpd_page(struct scsi_device *sdev, u8 page, return; mutex_lock(&sdev->inquiry_mutex); - rcu_swap_protected(*sdev_vpd_buf, vpd_buf, - lockdep_is_held(&sdev->inquiry_mutex)); + vpd_buf = rcu_replace(*sdev_vpd_buf, vpd_buf, + lockdep_is_held(&sdev->inquiry_mutex)); mutex_unlock(&sdev->inquiry_mutex); if (vpd_buf) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 64c96c7..8d17779 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -466,10 +466,10 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) sdev->request_queue = NULL; mutex_lock(&sdev->inquiry_mutex); - rcu_swap_protected(sdev->vpd_pg80, vpd_pg80, - lockdep_is_held(&sdev->inquiry_mutex)); - rcu_swap_protected(sdev->vpd_pg83, vpd_pg83, - lockdep_is_held(&sdev->inquiry_mutex)); + vpd_pg80 = rcu_replace(sdev->vpd_pg80, vpd_pg80, + lockdep_is_held(&sdev->inquiry_mutex)); + vpd_pg83 = rcu_replace(sdev->vpd_pg83, vpd_pg83, + lockdep_is_held(&sdev->inquiry_mutex)); mutex_unlock(&sdev->inquiry_mutex); if (vpd_pg83) -- 2.9.5