From patchwork Thu Nov 10 20:04:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9422027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D041C60484 for ; Thu, 10 Nov 2016 20:06:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9A5229829 for ; Thu, 10 Nov 2016 20:06:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC32329839; Thu, 10 Nov 2016 20:06:13 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 33B6D29829 for ; Thu, 10 Nov 2016 20:06:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965119AbcKJUGM (ORCPT ); Thu, 10 Nov 2016 15:06:12 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:40352 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933923AbcKJUGL (ORCPT ); Thu, 10 Nov 2016 15:06:11 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uAAK4qqS000714 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Nov 2016 20:04:53 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id uAAK4q0F032084 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Nov 2016 20:04:52 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id uAAK4pkh027849; Thu, 10 Nov 2016 20:04:51 GMT Received: from mwanda (/154.123.15.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 10 Nov 2016 12:04:50 -0800 Date: Thu, 10 Nov 2016 23:04:38 +0300 From: Dan Carpenter To: Jens Axboe , Christoph Hellwig Cc: Mike Christie , Shaun Tancheff , Hannes Reinecke , Johannes Thumshirn , Bart Van Assche , Ming Lei , linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] block: precedence bug in bio_set_op_attrs() macro Message-ID: <20161110200438.GA22854@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.0 (2016-04-01) X-Source-IP: aserv0021.oracle.com [141.146.126.233] 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 code causes a problem for flush_epd_write_bio() because | has higher precedence than ?: so it basically turns into: ((bio)->bi_opf |= REQ_SYNC; Which is wrong. Fixes: ef295ecf090d ("block: better op and flags encoding") Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 562ac46..67fae32 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -208,7 +208,7 @@ enum req_flag_bits { /* obsolete, don't use in new code */ #define bio_set_op_attrs(bio, op, op_flags) \ - ((bio)->bi_opf |= (op | op_flags)) + ((bio)->bi_opf |= ((op) | (op_flags))) static inline bool op_is_write(unsigned int op) {