* [PATCH] dm ebs: fix bio->bi_status assignment
@ 2020-04-29 15:07 heinzm
2020-04-29 15:22 ` Mike Snitzer
0 siblings, 1 reply; 5+ messages in thread
From: heinzm @ 2020-04-29 15:07 UTC (permalink / raw)
To: dm-devel, snitzer
From: Heinz Mauelshagen <heinzm@redhat.com>
Assign blk_status_t to bi_status properly in __ebs_process_bios()
on error (flaw found by static checker).
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
---
drivers/md/dm-ebs-target.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm-ebs-target.c b/drivers/md/dm-ebs-target.c
index 97703c31771f..c9c66d6b1e56 100644
--- a/drivers/md/dm-ebs-target.c
+++ b/drivers/md/dm-ebs-target.c
@@ -210,7 +210,8 @@ static void __ebs_process_bios(struct work_struct *ws)
r = __ebs_discard_bio(ec, bio);
}
- bio->bi_status = r;
+ if (r < 0)
+ bio->bi_status = BLK_STS_IOERR;
}
/*
--
2.25.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: dm ebs: fix bio->bi_status assignment
2020-04-29 15:07 [PATCH] dm ebs: fix bio->bi_status assignment heinzm
@ 2020-04-29 15:22 ` Mike Snitzer
2020-04-29 19:39 ` Heinz Mauelshagen
2020-04-29 19:40 ` Heinz Mauelshagen
0 siblings, 2 replies; 5+ messages in thread
From: Mike Snitzer @ 2020-04-29 15:22 UTC (permalink / raw)
To: heinzm; +Cc: dm-devel
On Wed, Apr 29 2020 at 11:07am -0400,
heinzm@redhat.com <heinzm@redhat.com> wrote:
> From: Heinz Mauelshagen <heinzm@redhat.com>
>
> Assign blk_status_t to bi_status properly in __ebs_process_bios()
> on error (flaw found by static checker).
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
> ---
> drivers/md/dm-ebs-target.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-ebs-target.c b/drivers/md/dm-ebs-target.c
> index 97703c31771f..c9c66d6b1e56 100644
> --- a/drivers/md/dm-ebs-target.c
> +++ b/drivers/md/dm-ebs-target.c
> @@ -210,7 +210,8 @@ static void __ebs_process_bios(struct work_struct *ws)
> r = __ebs_discard_bio(ec, bio);
> }
>
> - bio->bi_status = r;
> + if (r < 0)
> + bio->bi_status = BLK_STS_IOERR;
> }
>
> /*
> --
> 2.25.4
>
Proper way is to use errno_to_blk_status(). I've folded in:
- bio->bi_status = r;
+ if (r < 0)
+ bio->bi_status = errno_to_blk_status(r);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: dm ebs: fix bio->bi_status assignment
2020-04-29 15:22 ` Mike Snitzer
@ 2020-04-29 19:39 ` Heinz Mauelshagen
2020-04-29 19:40 ` Heinz Mauelshagen
1 sibling, 0 replies; 5+ messages in thread
From: Heinz Mauelshagen @ 2020-04-29 19:39 UTC (permalink / raw)
To: Mike Snitzer; +Cc: dm-devel
On 4/29/20 5:22 PM, Mike Snitzer wrote:
> On Wed, Apr 29 2020 at 11:07am -0400,
> heinzm@redhat.com <heinzm@redhat.com> wrote:
>
>> From: Heinz Mauelshagen <heinzm@redhat.com>
>>
>> Assign blk_status_t to bi_status properly in __ebs_process_bios()
>> on error (flaw found by static checker).
>>
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
>> ---
>> drivers/md/dm-ebs-target.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/md/dm-ebs-target.c b/drivers/md/dm-ebs-target.c
>> index 97703c31771f..c9c66d6b1e56 100644
>> --- a/drivers/md/dm-ebs-target.c
>> +++ b/drivers/md/dm-ebs-target.c
>> @@ -210,7 +210,8 @@ static void __ebs_process_bios(struct work_struct *ws)
>> r = __ebs_discard_bio(ec, bio);
>> }
>>
>> - bio->bi_status = r;
>> + if (r < 0)
>> + bio->bi_status = BLK_STS_IOERR;
>> }
>>
>> /*
>> --
>> 2.25.4
>>
> Proper way is to use errno_to_blk_status(). I've folded in:
>
> - bio->bi_status = r;
> + if (r < 0)
> + bio->bi_status = errno_to_blk_status(r);
Thanks, that'll map to both possible values (BLK_STS_IOERR and BLK_STS_RESOURCE here),
though I/O error would've been sufficient here.
Heinz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: dm ebs: fix bio->bi_status assignment
2020-04-29 15:22 ` Mike Snitzer
2020-04-29 19:39 ` Heinz Mauelshagen
@ 2020-04-29 19:40 ` Heinz Mauelshagen
2020-04-29 23:04 ` Mike Snitzer
1 sibling, 1 reply; 5+ messages in thread
From: Heinz Mauelshagen @ 2020-04-29 19:40 UTC (permalink / raw)
To: Mike Snitzer; +Cc: dm-devel
On 4/29/20 5:22 PM, Mike Snitzer wrote:
> On Wed, Apr 29 2020 at 11:07am -0400,
> heinzm@redhat.com <heinzm@redhat.com> wrote:
>
>> From: Heinz Mauelshagen <heinzm@redhat.com>
>>
>> Assign blk_status_t to bi_status properly in __ebs_process_bios()
>> on error (flaw found by static checker).
>>
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
>> ---
>> drivers/md/dm-ebs-target.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/md/dm-ebs-target.c b/drivers/md/dm-ebs-target.c
>> index 97703c31771f..c9c66d6b1e56 100644
>> --- a/drivers/md/dm-ebs-target.c
>> +++ b/drivers/md/dm-ebs-target.c
>> @@ -210,7 +210,8 @@ static void __ebs_process_bios(struct work_struct *ws)
>> r = __ebs_discard_bio(ec, bio);
>> }
>>
>> - bio->bi_status = r;
>> + if (r < 0)
>> + bio->bi_status = BLK_STS_IOERR;
>> }
>>
>> /*
>> --
>> 2.25.4
>>
> Proper way is to use errno_to_blk_status(). I've folded in:
>
> - bio->bi_status = r;
> + if (r < 0)
> + bio->bi_status = errno_to_blk_status(r);
Also, using errno_to_blk_status() doesn't need the conditional so you
may mind to remove it.
Heinz
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: dm ebs: fix bio->bi_status assignment
2020-04-29 19:40 ` Heinz Mauelshagen
@ 2020-04-29 23:04 ` Mike Snitzer
0 siblings, 0 replies; 5+ messages in thread
From: Mike Snitzer @ 2020-04-29 23:04 UTC (permalink / raw)
To: Heinz Mauelshagen; +Cc: dm-devel
On Wed, Apr 29 2020 at 3:40pm -0400,
Heinz Mauelshagen <heinzm@redhat.com> wrote:
> On 4/29/20 5:22 PM, Mike Snitzer wrote:
> >On Wed, Apr 29 2020 at 11:07am -0400,
> >heinzm@redhat.com <heinzm@redhat.com> wrote:
> >
> >>From: Heinz Mauelshagen <heinzm@redhat.com>
> >>
> >>Assign blk_status_t to bi_status properly in __ebs_process_bios()
> >>on error (flaw found by static checker).
> >>
> >>Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> >>Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
> >>---
> >> drivers/md/dm-ebs-target.c | 3 ++-
> >> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >>diff --git a/drivers/md/dm-ebs-target.c b/drivers/md/dm-ebs-target.c
> >>index 97703c31771f..c9c66d6b1e56 100644
> >>--- a/drivers/md/dm-ebs-target.c
> >>+++ b/drivers/md/dm-ebs-target.c
> >>@@ -210,7 +210,8 @@ static void __ebs_process_bios(struct work_struct *ws)
> >> r = __ebs_discard_bio(ec, bio);
> >> }
> >>- bio->bi_status = r;
> >>+ if (r < 0)
> >>+ bio->bi_status = BLK_STS_IOERR;
> >> }
> >> /*
> >>--
> >>2.25.4
> >>
> >Proper way is to use errno_to_blk_status(). I've folded in:
> >
> >- bio->bi_status = r;
> >+ if (r < 0)
> >+ bio->bi_status = errno_to_blk_status(r);
>
>
> Also, using errno_to_blk_status() doesn't need the conditional so
> you may mind to remove it.
Rather avoid the jump implied by the call (figures another place where
there is a conditional call to errno_to_blk_status is
dm-bufio.c:use_dmio).
Anyway, doesn't much matter either way, just going to leave it as
staged.
Thanks,
Mike
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-29 23:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-29 15:07 [PATCH] dm ebs: fix bio->bi_status assignment heinzm
2020-04-29 15:22 ` Mike Snitzer
2020-04-29 19:39 ` Heinz Mauelshagen
2020-04-29 19:40 ` Heinz Mauelshagen
2020-04-29 23:04 ` Mike Snitzer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.