All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Heinz Mauelshagen <heinzm@redhat.com>
Cc: dm-devel@redhat.com
Subject: Re: dm ebs: fix bio->bi_status assignment
Date: Wed, 29 Apr 2020 19:04:22 -0400	[thread overview]
Message-ID: <20200429230422.GA24904@redhat.com> (raw)
In-Reply-To: <cf22a122-13cf-2692-0e35-cce2fac007fa@redhat.com>

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

      reply	other threads:[~2020-04-29 23:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200429230422.GA24904@redhat.com \
    --to=snitzer@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=heinzm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.