Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp6045628ybg; Tue, 22 Oct 2019 12:13:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwt4jiLB6juIfRxjEARntMW4ByNvOBfk9QIBm0xqqx5D8rIdOJ1kmr06MyeyITKZ8W8R2uO X-Received: by 2002:aa7:d358:: with SMTP id m24mr32969199edr.204.1571771626195; Tue, 22 Oct 2019 12:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571771626; cv=none; d=google.com; s=arc-20160816; b=r7qC9QOfYYhnb0g+B+hCRIDxQQD/y3t+wIsM/IdUFrXihEnWTQAp+7p7Vf9nlg6SW4 TDshqT49NqjWTFiVcdQLivPEtJTbViuTGBb85UusXLQt+o0C03W3FRv6VJXRdGJsOAXw qmFXwQDNpG7WblJHayS716Pi3Ua7qHuXSaVGhTnjRrRvLEwx5/XzWQroinGrL8ckaMAz zTmJj1G0YhX60P0oAJ8RPrAjRHLiD115hFCz/2xVOM2Z/WUlBAMwfgEeLF8edRZc/LjW Y9rXJ5YJzoM3DfoaZb1+U9XLoeBDtLsJqA6Wyfr+NMJOzNOJMYftHxZ1TmqmorYwSuwo t8Cw== 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=3Fc+LUkX2DQfsC1FANLs6Ewlbb3r42/+k9BP002fgSE=; b=cVi8gC/s6KEQ+xLhPqsK6Q+dRukbCEJ7VLaHHk7TmLlQOZb7XAUFfeAMcPQe8UPbJw vvhAnj2F72/+DoD50zDIKkkjlVkdIpB7VvGskoMzezA8wTkIPLV4cK5mOFPxjAUUUZvm QOoqy0ANABUWjZzia258kQtszRCAo8l9vM/dmcifKJXksuxZl0HIk65tWkc9Ki8wXD8Y FncSRdJzqXrxC1SfUVuI0ADvBZev9OJkcrPZi/KU+AyKLJ55rMRKSywI1OMIJ5w/sf3u jEUgtXwVtESbEQL54hVziVNNE3osVA35Mno0A1xwmHsSelEQcGkAx/9iJLErYexJt2pI cYcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SUpRZkNo; 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 fx11si5697180ejb.302.2019.10.22.12.13.22; Tue, 22 Oct 2019 12:13:46 -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=SUpRZkNo; 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 S1732981AbfJVTM3 (ORCPT + 99 others); Tue, 22 Oct 2019 15:12:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:43484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732960AbfJVTM1 (ORCPT ); Tue, 22 Oct 2019 15:12:27 -0400 Received: from localhost.localdomain (rrcs-50-75-166-42.nys.biz.rr.com [50.75.166.42]) (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 23DD121872; Tue, 22 Oct 2019 19:12:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571771546; bh=NK1shrnB6RXACQmIToR2eAdSTsYyqi7EfbzoHBlz3kE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUpRZkNozB0RJAm3MGvuAjFVVOn+KxxVuGRNznokxXvR/WahJ0ftDqSYZ5/+OmMUH rFJJ7DJuALzjWIluBdaA1zThESMt85t6Sy0V4EYQ05JCfbK0BKRphZ9IVUxtL1X3ac ROdbp79PVROJlZhyi5NKFY65XDBkshw2H+8+Z5Xc= 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" , linux-scsi@vger.kernel.org Subject: [PATCH tip/core/rcu 04/10] drivers/scsi: Replace rcu_swap_protected() with rcu_replace() Date: Tue, 22 Oct 2019 12:12:09 -0700 Message-Id: <20191022191215.25781-4-paulmck@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20191022191136.GA25627@paulmck-ThinkPad-P72> References: <20191022191136.GA25627@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 [ paulmck: From rcu_replace() to rcu_replace_pointer() per Ingo Molnar. ] Signed-off-by: Paul E. McKenney Acked-by: "Martin K. Petersen" Cc: "James E.J. Bottomley" 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..7a1b6c7 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_pointer(*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..5adfcab 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_pointer(sdev->vpd_pg80, vpd_pg80, + lockdep_is_held(&sdev->inquiry_mutex)); + vpd_pg83 = rcu_replace_pointer(sdev->vpd_pg83, vpd_pg83, + lockdep_is_held(&sdev->inquiry_mutex)); mutex_unlock(&sdev->inquiry_mutex); if (vpd_pg83) -- 2.9.5