Received: by 10.192.165.148 with SMTP id m20csp2533754imm; Sun, 22 Apr 2018 09:02:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/cCcA1DKqK3i0RrxCWN3SAoBkV2xEIo4bL5cCe1Rg0dlrzLUCCx3UDixcNnTzeQy8RgWDm X-Received: by 10.99.109.200 with SMTP id i191mr14093590pgc.291.1524412927867; Sun, 22 Apr 2018 09:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524412927; cv=none; d=google.com; s=arc-20160816; b=VTVtxKHSCAVDp8i2z/W3A2SvKghuCNEf9zISD7axJgqIiIbtAh9EGbvclFcR50YoEi KBHyzS+bWYrVPfDNvvPbh/qJkq7jalHzweRXbqinRjMCvXhBRz3KqJZSHGQwBZs8iWkL ztRWbBfERH4kX9isJrq7VxtjwmYrE7JDfo7onuY0khk1r1XUhEKvLIv5GiZa5soJsoP6 B5/5LoyVQsmCCPI9FrW65jJulSJ2cAerYv+qzBNBe1yeiCRjqD0X/xtSnu2A2SK6Gv6c JcBSNJ15w8CizuqZNGinpCuqOtX8AtZXvKvENUBvITI5IcOEJOAXZ6PA1IXtgcV0LyNU vL+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=AOQWTYw8WA/8vLPc0pt7VCchKVMlO+B/DE8V941Jsv4=; b=ynnW3BayXHlcsA3TFfEgLfH7Jb5E0Oup0wPqWShnxO73Jd/wovodTQGggMUUDjOO/e 0j4Y2XvDNz9Huykk2ebHmYJIZ3T/LuPbuQmZhptQWIPmfUKJUUvKgwzVL9lkm13wk/H9 p/Fy5l9wMqGwCfmGDGoYThvUQ20YbAVT28I0OZEndHMkfpXkveNsMDxWgDEHHc++253N TqjrflpI8VFuywkOmnptNrEVMm99+R4kvv1pd1x5wPuiTDDO3gO8rDvRokXwN+POOMza VjZGjdam1Adl3YtmJdUFXfN+Fgq4dT07Tp7evdxCxgYsd5CwC7viDmnjqHxuD+DhU7La siPw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c23-v6si10130826plk.245.2018.04.22.09.01.53; Sun, 22 Apr 2018 09:02:07 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754228AbeDVN6y (ORCPT + 99 others); Sun, 22 Apr 2018 09:58:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46372 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753708AbeDVN6t (ORCPT ); Sun, 22 Apr 2018 09:58:49 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F3F75CE6; Sun, 22 Apr 2018 13:58:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Jens Axboe Subject: [PATCH 4.16 083/196] block: use 32-bit blk_status_t on Alpha Date: Sun, 22 Apr 2018 15:51:43 +0200 Message-Id: <20180422135108.598605082@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mikulas Patocka commit 6e2fb22103b99c26ae30a46512abe75526d8e4c9 upstream. Early alpha processors cannot write a single byte or word; they read 8 bytes, modify the value in registers and write back 8 bytes. The type blk_status_t is defined as one byte, it is often written asynchronously by I/O completion routines, this asynchronous modification can corrupt content of nearby bytes if these nearby bytes can be written simultaneously by another CPU. - one example of such corruption is the structure dm_io where "blk_status_t status" is written by an asynchronous completion routine and "atomic_t io_count" is modified synchronously - another example is the structure dm_buffer where "unsigned hold_count" is modified synchronously from process context and "blk_status_t write_error" is modified asynchronously from bio completion routine This patch fixes the bug by changing the type blk_status_t to 32 bits if we are on Alpha and if we are compiling for a processor that doesn't have the byte-word-extension. Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org # 4.13+ Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- include/linux/blk_types.h | 5 +++++ 1 file changed, 5 insertions(+) --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -20,8 +20,13 @@ typedef void (bio_end_io_t) (struct bio /* * Block error status values. See block/blk-core:blk_errors for the details. + * Alpha cannot write a byte atomically, so we need to use 32-bit value. */ +#if defined(CONFIG_ALPHA) && !defined(__alpha_bwx__) +typedef u32 __bitwise blk_status_t; +#else typedef u8 __bitwise blk_status_t; +#endif #define BLK_STS_OK 0 #define BLK_STS_NOTSUPP ((__force blk_status_t)1) #define BLK_STS_TIMEOUT ((__force blk_status_t)2)