Received: by 10.213.65.68 with SMTP id h4csp1405819imn; Wed, 21 Mar 2018 09:53:50 -0700 (PDT) X-Google-Smtp-Source: AG47ELuYau1jO/C8L9iC19t8zwiDUzNWwF0AmMSclZX1qvLXsBcrLOpODtXx7yiLTX4sr2CPfZB9 X-Received: by 2002:a17:902:b10f:: with SMTP id q15-v6mr19239521plr.263.1521651230386; Wed, 21 Mar 2018 09:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521651230; cv=none; d=google.com; s=arc-20160816; b=WjJUzs2t2iBV+jQ9A7KS+7jnJF9pcIhju0+fcxFoZ03zwNn1PmbANvLeMUB0UhhVQO N7SBMU5xB4/9YG6k1/Fm8TjUIEo0t/AKXp8WPhJPkbjduqjMMy0J/CBKqR5zQfRh2sAB GG51CW+4Dx+GOWlW2zbP9lmVqwSL7Hn59iIB/xEdHOcKIIlyAZUfGkAS8mYrYmkVyBbo C3eCDkJwA9MQp4SEPN3cMk718hfVzRlryriSxH0hp8Pk5cAKmN1xv8LeWA9nFoojgm+R Pfsz/DVmKcFvMofzKXhjqMw8pbeS4TwjaUMnZ0TwyIXKsEta62MirNnD4Sinsr1bBt+K hk3w== 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:message-id :subject:cc:to:from:date:arc-authentication-results; bh=4IJ1t6r01cXtf9zXquouakI4h+JXHThdhb23PTNImfY=; b=fepB1wjs1H1QzdF9EWdPEkCf8qK4KfNAwkzy3jqRcgLCTZDm2aETKFiub/s2pXZSoc yhByE3yhXzjimKfMuGmYJo6rDPz64KvISVcz2e7ydace0I0pV13Gon6bwIQdWGSoA2S7 u9c9xyBbxIlLtKjcoe3G8pVlZ5yF0byiB6dvMe197s36hg6xrin4rEzaB+2ScEAmoV4j YQzIfwD1HZ5ZZfxXlDjet7V6bOfcWy2uUZRQWlv3V5tTGY8S06NBIJInUfvRuPwf4QMv pW3h9nIU9P07hV0A75P4ojzn0IeL/cdZxVef/U3sla1ELv/U1nVdv2Cg4KIi/CIrUhaN vG8Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q24-v6si4108760pls.600.2018.03.21.09.53.35; Wed, 21 Mar 2018 09:53:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752978AbeCUQwl (ORCPT + 99 others); Wed, 21 Mar 2018 12:52:41 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55978 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752610AbeCUQwf (ORCPT ); Wed, 21 Mar 2018 12:52:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B575406DE12 for ; Wed, 21 Mar 2018 16:52:35 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 628A1215CDA7 for ; Wed, 21 Mar 2018 16:52:35 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id w2LGqZrU027202 for ; Wed, 21 Mar 2018 12:52:35 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w2LGqZOT027199 for ; Wed, 21 Mar 2018 12:52:35 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 21 Mar 2018 12:42:25 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Jens Axboe , Richard Henderson , Ivan Kokshaysky , Matt Turner , Mike Snitzer cc: linux-block@vger.kernel.org, dm-devel@redhat.com, linux-alpha@vger.kernel.org Subject: [PATCH] block: use 32-bit blk_status_t on Alpha Message-ID: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 21 Mar 2018 16:52:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 21 Mar 2018 16:52:35 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mpatocka@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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+ --- include/linux/blk_types.h | 5 +++++ 1 file changed, 5 insertions(+) Index: linux-2.6/include/linux/blk_types.h =================================================================== --- linux-2.6.orig/include/linux/blk_types.h 2018-02-14 20:24:42.038255000 +0100 +++ linux-2.6/include/linux/blk_types.h 2018-03-21 15:04:54.969999000 +0100 @@ -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)