From patchwork Mon Apr 29 20:14:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Parri X-Patchwork-Id: 10922495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14E7E1398 for ; Mon, 29 Apr 2019 20:16:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 066F328660 for ; Mon, 29 Apr 2019 20:16:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EED18287B3; Mon, 29 Apr 2019 20:16:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94E8128660 for ; Mon, 29 Apr 2019 20:16:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729212AbfD2UQB (ORCPT ); Mon, 29 Apr 2019 16:16:01 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38928 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729260AbfD2UQA (ORCPT ); Mon, 29 Apr 2019 16:16:00 -0400 Received: by mail-wr1-f65.google.com with SMTP id a9so17888231wrp.6 for ; Mon, 29 Apr 2019 13:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HnQQB+q10KJ+tBjmTDVhEUeBuplkgzFkaabaWorIDK0=; b=V8llIgXP6nhj3mBW9/AXO9OGQRGRnVOgd/Mgx/UqS0Dmg6P71DCInuxWyizpcBDv2v s4LWS3ulfKwPBDJxaH97b/cxsArPA7/vK6pLhrgQwPdEmqCASyvUl8VDq6EE/M867QlH vuLUSwu+6ZvKtN0hQBgi2CjSm7a1FwV/4h3/I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HnQQB+q10KJ+tBjmTDVhEUeBuplkgzFkaabaWorIDK0=; b=V9XFs0TQurQhY7pQprOgkp7Filabt8M2AG367hrmym1bgj8/8ysNQlr7gPeYBFVNue JRaaH6mrEMn/2Z1h+yMOheHBp/6IgVPhHv5CWzbAGwc/rHu50jcR+bwuhwBtXzs+ZfQ3 Atwwb+3IDRjfTz25vll62oxtA3wLJq4hlTtQOSUwIPiTmlMz8wBaoV2XamCM4EGgBd7+ jcTIkPiQNCZuVR1bGzn9mTbikJvXnsNTA+oxAKkFpdNe12y98XAOW7u0ck+SaJO8uO8v UoMGkNVF/X+wG1zifm6lgrSRpPiXknwF8e5pOxhS3s8t3mVWtVS6KjVh0XPyDbR8ytQW /42w== X-Gm-Message-State: APjAAAUPBPZIxWNSgc0UlaYgVLzgEyXIX96H71sbxvPTj2yZnPMvk9Ff XFGp0/MtbCpmiLBZGCWKnMF6gA== X-Google-Smtp-Source: APXvYqzO/shy+lwWyu704q2dOX00yaUvvzyKRtzyAEk5wDzatGiK5EyHB6NgTBNQOz/tIfNcD7NiVw== X-Received: by 2002:adf:fb4a:: with SMTP id c10mr13358709wrs.309.1556568958675; Mon, 29 Apr 2019 13:15:58 -0700 (PDT) Received: from localhost.localdomain (ip-93-97.sn2.clouditalia.com. [83.211.93.97]) by smtp.gmail.com with ESMTPSA id k6sm22864019wrd.20.2019.04.29.13.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Apr 2019 13:15:57 -0700 (PDT) From: Andrea Parri To: linux-kernel@vger.kernel.org Cc: Andrea Parri , stable@vger.kernel.org, Jens Axboe , linux-block@vger.kernel.org Subject: [PATCH 2/5] bio: fix improper use of smp_mb__before_atomic() Date: Mon, 29 Apr 2019 22:14:58 +0200 Message-Id: <1556568902-12464-3-git-send-email-andrea.parri@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556568902-12464-1-git-send-email-andrea.parri@amarulasolutions.com> References: <1556568902-12464-1-git-send-email-andrea.parri@amarulasolutions.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Jens Axboe Cc: linux-block@vger.kernel.org Reviewed-by: Ming Lei --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index e584673c18814..5becbafb84e8a 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -224,7 +224,7 @@ static inline void bio_cnt_set(struct bio *bio, unsigned int count) { if (count != 1) { bio->bi_flags |= (1 << BIO_REFFED); - smp_mb__before_atomic(); + smp_mb(); } atomic_set(&bio->__bi_cnt, count); }