]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
UBUNTU: SAUCE: hio: Fix incorrect use of enum req_opf values
authorSeth Forshee <seth.forshee@canonical.com>
Tue, 11 Jul 2017 12:12:56 +0000 (07:12 -0500)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 14 Jul 2017 14:41:14 +0000 (11:41 -0300)
BugLink: http://bugs.launchpad.net/bugs/1701316
Patch from Huawei to fix incorrect use of enumerated values for
bio operations as bitmasks. A reordering of the enum in 4.10
caused a change in behavior which has been leading to data
corruption.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
ubuntu/hio/hio.c

index 4320262a76ba21e18ccf5ddfe9dce651d2f71781..7f40497e5ea742617c0fe05f8790ddbefe06eb88 100644 (file)
@@ -2098,7 +2098,7 @@ static inline int ssd_bio_has_discard(struct bio *bio)
 #ifndef SSD_TRIM
        return 0;
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
-       return bio_op(bio) & REQ_OP_DISCARD;
+       return bio_op(bio) == REQ_OP_DISCARD;
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
        return bio->bi_rw & REQ_DISCARD;
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
@@ -2111,7 +2111,7 @@ static inline int ssd_bio_has_discard(struct bio *bio)
 static inline int ssd_bio_has_flush(struct bio *bio)
 {
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0))
-       return bio_op(bio) & REQ_OP_FLUSH;
+       return bio_op(bio) == REQ_OP_FLUSH;
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
        return bio->bi_rw & REQ_FLUSH;
 #else