All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] check info.exists to get valid value
@ 2014-06-25  8:08 Vaughan Cao
  2014-07-01 18:32 ` Christophe Varoqui
  0 siblings, 1 reply; 2+ messages in thread
From: Vaughan Cao @ 2014-06-25  8:08 UTC (permalink / raw)
  To: christophe.varoqui; +Cc: dm-devel, vaughan.cao

dm_task_get_info will still return 1 if device doesn't exist.
Check info.exists to ensure major and minor values are valid.

There is no reason to assign info.open_count to @r here.

Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
---
 libmultipath/devmapper.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 30e9351..3d4c111 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -567,10 +567,9 @@ dm_dev_t (const char * mapname, char * dev_t, int len)
 	if (!dm_task_run(dmt))
 		goto out;
 
-	if (!dm_task_get_info(dmt, &info))
+	if (!dm_task_get_info(dmt, &info) || !info.exists)
 		goto out;
 
-	r = info.open_count;
 	if (snprintf(dev_t, len, "%i:%i", info.major, info.minor) > len)
 		    goto out;
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] check info.exists to get valid value
  2014-06-25  8:08 [PATCH] check info.exists to get valid value Vaughan Cao
@ 2014-07-01 18:32 ` Christophe Varoqui
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Varoqui @ 2014-07-01 18:32 UTC (permalink / raw)
  To: Vaughan Cao; +Cc: device-mapper development


[-- Attachment #1.1: Type: text/plain, Size: 1036 bytes --]

Applied.
Thanks.


On Wed, Jun 25, 2014 at 10:08 AM, Vaughan Cao <vaughan.cao@oracle.com>
wrote:

> dm_task_get_info will still return 1 if device doesn't exist.
> Check info.exists to ensure major and minor values are valid.
>
> There is no reason to assign info.open_count to @r here.
>
> Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
> ---
>  libmultipath/devmapper.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
> index 30e9351..3d4c111 100644
> --- a/libmultipath/devmapper.c
> +++ b/libmultipath/devmapper.c
> @@ -567,10 +567,9 @@ dm_dev_t (const char * mapname, char * dev_t, int len)
>         if (!dm_task_run(dmt))
>                 goto out;
>
> -       if (!dm_task_get_info(dmt, &info))
> +       if (!dm_task_get_info(dmt, &info) || !info.exists)
>                 goto out;
>
> -       r = info.open_count;
>         if (snprintf(dev_t, len, "%i:%i", info.major, info.minor) > len)
>                     goto out;
>
> --
> 1.9.0
>
>

[-- Attachment #1.2: Type: text/html, Size: 1614 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-01 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25  8:08 [PATCH] check info.exists to get valid value Vaughan Cao
2014-07-01 18:32 ` Christophe Varoqui

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.