From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F4ACC28CC2 for ; Thu, 30 May 2019 03:46:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D930C24CD8 for ; Thu, 30 May 2019 03:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559188015; bh=Gh2SH9ciqBTpsiaSefHXI2RPs4vrW9UNvsPEoZ4y/QY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YyGNJlnTzJ4+J0UBF27HJEdjirS1qL/+/m5Ipz2qMa+qlQZ2ckFYCTWGhYD4AEgiu h2HwgKclbViiGvb5j/NQJPrUL3fBzMoRWsETmV616dKOd6wl2yuF9C9KCXh9wavYme ixiZsViYD5FK9ijEIZ7/7ZdFUQe5nmXY1Ap6KwxI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732258AbfE3DUf (ORCPT ); Wed, 29 May 2019 23:20:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:58924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732254AbfE3DUf (ORCPT ); Wed, 29 May 2019 23:20:35 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A982024948; Thu, 30 May 2019 03:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186434; bh=Gh2SH9ciqBTpsiaSefHXI2RPs4vrW9UNvsPEoZ4y/QY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DD4/Vq8/aqhCgl5E5K0kCbVxVfTXXKpSzlLFIhUP7d5WXLR6ypnnQEEvcI4Kv2QS5 eRhtA4rXUcw6P8/9s58CekcjqBn+6Ipc2IJuG7Uu7IKdtazkrV/Mid35n/jSg4kir/ 0t+Fd0whRFx2jti9n5sS9u3aFPGPZ76szFwY/mdc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paul E. McKenney" , Peter Zijlstra , Andrea Parri , Ming Lei , Jens Axboe , linux-block@vger.kernel.org Subject: [PATCH 4.9 003/128] bio: fix improper use of smp_mb__before_atomic() Date: Wed, 29 May 2019 20:05:35 -0700 Message-Id: <20190530030433.605961301@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030432.977908967@linuxfoundation.org> References: <20190530030432.977908967@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Andrea Parri commit f381c6a4bd0ae0fde2d6340f1b9bb0f58d915de6 upstream. This barrier only applies to the read-modify-write operations; in particular, it does not apply to the atomic_set() primitive. Replace the barrier with an smp_mb(). Fixes: dac56212e8127 ("bio: skip atomic inc/dec of ->bi_cnt for most use cases") Cc: stable@vger.kernel.org Reported-by: "Paul E. McKenney" Reported-by: Peter Zijlstra Signed-off-by: Andrea Parri Reviewed-by: Ming Lei Cc: Jens Axboe Cc: Ming Lei Cc: linux-block@vger.kernel.org Cc: "Paul E. McKenney" Cc: Peter Zijlstra Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -237,7 +237,7 @@ static inline void bio_cnt_set(struct bi { if (count != 1) { bio->bi_flags |= (1 << BIO_REFFED); - smp_mb__before_atomic(); + smp_mb(); } atomic_set(&bio->__bi_cnt, count); }