]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - include/linux/blk_types.h
block: use 32-bit blk_status_t on Alpha
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 21 Mar 2018 16:42:25 +0000 (12:42 -0400)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 15:48:43 +0000 (11:48 -0400)
commit6defef6e3c3b16171b3492ff8363a624e6779680
tree42ecd633a9ce31a2e0f24ef4060f8f5447ccf1f8
parentebe2b260647a62991f1a58d967d3d56ee06b1be7
block: use 32-bit blk_status_t on Alpha

BugLink: http://bugs.launchpad.net/bugs/1773233
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 <mpatocka@redhat.com>
Cc: stable@vger.kernel.org # 4.13+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/linux/blk_types.h