[PATCH 0/1][Yakkety/Zesty] Fix data corruption with hio driver

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 0/1][Yakkety/Zesty] Fix data corruption with hio driver

Seth Forshee
BugLink: http://bugs.launchpad.net/bugs/1701316

Impact: Data corruption is seen when using the hio driver with 4.8 and
later kernels.

Fix: Patch to fix incorrect use of enumerated values as bitmasks.

Test case: See bug for reproducers.

Regression potential: Very low. Changes are simple and Obviously Correct
(TM), and they only affect the hio driver.

Thanks,
Seth


Seth Forshee (1):
  UBUNTU: SAUCE: hio: Fix incorrect use of enum req_opf values

 ubuntu/hio/hio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH 1/1][Yakkety/Zesty] UBUNTU: SAUCE: hio: Fix incorrect use of enum req_opf values

Seth Forshee
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 <[hidden email]>
---
 ubuntu/hio/hio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ubuntu/hio/hio.c b/ubuntu/hio/hio.c
index 4320262a76ba..7f40497e5ea7 100644
--- a/ubuntu/hio/hio.c
+++ b/ubuntu/hio/hio.c
@@ -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
--
2.11.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK: [PATCH 1/1][Yakkety/Zesty] UBUNTU: SAUCE: hio: Fix incorrect use of enum req_opf values

Colin Ian King-2
On 11/07/17 13:12, Seth Forshee wrote:

> 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 <[hidden email]>
> ---
>  ubuntu/hio/hio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ubuntu/hio/hio.c b/ubuntu/hio/hio.c
> index 4320262a76ba..7f40497e5ea7 100644
> --- a/ubuntu/hio/hio.c
> +++ b/ubuntu/hio/hio.c
> @@ -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
>

Limited to one specific driver so small regression impact.  Positive
test results.  Thanks Seth.

Acked-by: Colin Ian King <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH 0/1][Yakkety/Zesty] Fix data corruption with hio driver

Seth Forshee
In reply to this post by Seth Forshee
On Tue, Jul 11, 2017 at 07:12:55AM -0500, Seth Forshee wrote:
> BugLink: http://bugs.launchpad.net/bugs/1701316
>
> Impact: Data corruption is seen when using the hio driver with 4.8 and
> later kernels.

To clarify - the data corruption has only been reported with 4.10 and
later kernels to my knowledge, but the code in question is used for 4.8
and later and so yakkety should also get the fix.

The patch could be applied to xenial too, but it won't make any
practical differnce there. The code is present in xenial but not built
for kernels before 4.8.

> Fix: Patch to fix incorrect use of enumerated values as bitmasks.
>
> Test case: See bug for reproducers.
>
> Regression potential: Very low. Changes are simple and Obviously Correct
> (TM), and they only affect the hio driver.
>
> Thanks,
> Seth
>
>
> Seth Forshee (1):
>   UBUNTU: SAUCE: hio: Fix incorrect use of enum req_opf values
>
>  ubuntu/hio/hio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ACK: [PATCH 1/1][Yakkety/Zesty] UBUNTU: SAUCE: hio: Fix incorrect use of enum req_opf values

Stefan Bader-2
In reply to this post by Seth Forshee
On 11.07.2017 14:12, Seth Forshee wrote:
> 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 <[hidden email]>

Acked-by: Stefan Bader <[hidden email]>

> ---
>  ubuntu/hio/hio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ubuntu/hio/hio.c b/ubuntu/hio/hio.c
> index 4320262a76ba..7f40497e5ea7 100644
> --- a/ubuntu/hio/hio.c
> +++ b/ubuntu/hio/hio.c
> @@ -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
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

APPLIED: [PATCH 0/1][Yakkety/Zesty] Fix data corruption with hio driver

Thadeu Lima de Souza Cascardo-3
In reply to this post by Seth Forshee
Applied to yakkety and zesty master-next branches.

Thanks.
Cascardo.

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Loading...