Hi,

On Tue, Jul 19, 2022 at 9:15 PM Alexander Aring <aahri...@redhat.com> wrote:
>
> If the user generates a -EINVAL it's probably because the user using DLM
> wrong. To give the user notice about that wrong behaviour we should
> always print -EINVAL errors on the proper loglevel. In case of other
> errors like -EBUSY it will be still printed on debug loglevel as the
> current API handles it as "retry again".
>
> Signed-off-by: Alexander Aring <aahri...@redhat.com>
> ---
>  fs/dlm/lock.c | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
> index d8de4003ec6a..7d5f94867e45 100644
> --- a/fs/dlm/lock.c
> +++ b/fs/dlm/lock.c
> @@ -2900,11 +2900,21 @@ static int validate_lock_args(struct dlm_ls *ls, 
> struct dlm_lkb *lkb,
>  #endif
>         rv = 0;
>   out:
> -       if (rv)
> +       switch (rv) {
> +       case -EINVAL:
> +               log_error(ls, "%s %d %x %x %x %d %d %s", __func__,
> +                         rv, lkb->lkb_id, lkb->lkb_flags, args->flags,
> +                         lkb->lkb_status, lkb->lkb_wait_type,
> +                         lkb->lkb_resource->res_name);
> +               break;
> +       default:
>                 log_debug(ls, "%s %d %x %x %x %d %d %s", __func__,
>                           rv, lkb->lkb_id, lkb->lkb_flags, args->flags,
>                           lkb->lkb_status, lkb->lkb_wait_type,
>                           lkb->lkb_resource->res_name);
> +               break;
> +       }
> +
>         return rv;
>  }
>
> @@ -3037,11 +3047,21 @@ static int validate_unlock_args(struct dlm_lkb *lkb, 
> struct dlm_args *args)
>         lkb->lkb_astparam = args->astparam;
>         rv = 0;
>   out:
> -       if (rv)
> +       switch (rv) {
> +       case -EINVAL:
> +               log_error(ls, "%s %d %x %x %x %x %d %s", __func__, rv,
> +                         lkb->lkb_id, lkb->lkb_flags, lkb->lkb_exflags,
> +                         args->flags, lkb->lkb_wait_type,
> +                         lkb->lkb_resource->res_name);
> +               break;
> +       default:
>                 log_debug(ls, "%s %d %x %x %x %x %d %s", __func__, rv,
>                           lkb->lkb_id, lkb->lkb_flags, lkb->lkb_exflags,
>                           args->flags, lkb->lkb_wait_type,
>                           lkb->lkb_resource->res_name);
> +               break;
> +       }
> +

there need to be a case 0: which does nothing of course... will send a v2.

- Alex

Reply via email to