From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: device-mapper development <dm-devel@redhat.com>,
Alasdair G Kergon <agk@redhat.com>
Subject: Re: fix reversed logic in device_area_is_valid
Date: Mon, 27 Jul 2009 10:15:07 -0400 [thread overview]
Message-ID: <20090727141506.GA4964@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0907270913170.25437@hs20-bc2-1.build.redhat.com>
On Mon, Jul 27 2009 at 9:21am -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:
> Hi
>
> This patch fixes a bug introduced in 2.6.31-rc1. Targets that define
> iterate_devices and don't contain any devices (such as dm-loop in fsio)
> don't work.
>
> Mikulas
>
> ---
>
> Fix reverse logic in device_area_is_valid
>
> ->iterate_devices method calls the callback for every underlying device
> in the target. If the callback returns non-zero, iterate_devices exits
> and returns this value. If the callback returns zero for all the devices,
> iterate_devices returns zero.
>
> The logic to check for invalid device areas was reversed.
> device_area_is_valid returned 0 on error and 1 on success.
>
> Thus:
> - error was returned only if all the devices vere errorneous. If some of them
> returned 1 (success), dm_calculate_queue_limits understood this as success.
> - if the target had no device (the example is dm-loop target in FSIO mode),
> iterate_devices returned error straight away and dm_calculate_queue_limits
> understood this as an error.
>
> This patch reverses the logic so that 0 means success and 1 means error.
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Nice catch, interesting that this was somehow missed. All targets do
treat a non-zero return from .iterate_devices as an error.
We should probably rename device_area_is_valid to device_area_invalid.
Mike
next prev parent reply other threads:[~2009-07-27 14:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-27 13:21 [PATCH] fix reversed logic in device_area_is_valid Mikulas Patocka
2009-07-27 14:15 ` Mike Snitzer [this message]
2009-07-27 14:23 ` Mikulas Patocka
2009-07-28 12:07 ` [PATCH] Rename device_area_is_valid and reverse logic accordingly Mike Snitzer
2009-07-30 19:08 ` Mikulas Patocka
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=20090727141506.GA4964@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=mpatocka@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.