Re: [PATCH 42/44] llibmultipath: fix return code check for dm_is_suspended()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 09, 2024 at 11:39:33PM +0200, Martin Wilck wrote:
> dm_is_suspended returns non-null if it failed to obtain the device
> information. It's wrong to assume in this case that the device is suspended.

I'm kinda torn on this one. Sure we don't know if the device is
suspended, and most likely if this failed, the device got removed.  But
on the other hand, it could have failed for another reason, and resuming
a device that isn't suspended (or doesn't exist) causes no harm.

I could go either way on this.

-Ben

> 
> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
> ---
>  libmultipath/devmapper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
> index e653ca6..e9a0103 100644
> --- a/libmultipath/devmapper.c
> +++ b/libmultipath/devmapper.c
> @@ -604,7 +604,7 @@ int dm_addmap_reload(struct multipath *mpp, char *params, int flush)
>  	/* If the resume failed, dm will leave the device suspended, and
>  	 * drop the new table, so doing a second resume will try using
>  	 * the original table */
> -	if (dm_is_suspended(mpp->alias))
> +	if (dm_is_suspended(mpp->alias) == 1)
>  		dm_simplecmd(DM_DEVICE_RESUME, mpp->alias,
>  			     DMFL_NEED_SYNC | (flush ? 0 : DMFL_NO_FLUSH),
>  			     udev_flags);
> -- 
> 2.45.2





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux