]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
UBUNTU: SAUCE: hio: Fix incorrect use of enum req_opf values
authorSeth Forshee <seth.forshee@canonical.com>
Fri, 7 Jul 2017 12:59:08 +0000 (07:59 -0500)
committerPaolo Pisati <paolo.pisati@canonical.com>
Tue, 2 Nov 2021 07:24:42 +0000 (08:24 +0100)
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>
ubuntu/hio/hio.c

index 98846b55878d1d2bfde1a0ac3e3dc7063c626e71..2021b884d69638a732c21977fd0562913ba1ae7f 100644 (file)
@@ -2111,7 +2111,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))
@@ -2124,7 +2124,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