lkml.org 
[lkml]   [2022]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 6.0 042/862] fs: dlm: handle -EBUSY first in lock arg validation
    Date
    From: Alexander Aring <aahringo@redhat.com>

    commit 44637ca41d551d409a481117b07fa209b330fca9 upstream.

    During lock arg validation, first check for -EBUSY cases, then for
    -EINVAL cases. The -EINVAL checks look at lkb state variables
    which are not stable when an lkb is busy and would cause an
    -EBUSY result, e.g. lkb->lkb_grmode.

    Cc: stable@vger.kernel.org
    Signed-off-by: Alexander Aring <aahringo@redhat.com>
    Signed-off-by: David Teigland <teigland@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    fs/dlm/lock.c | 18 +++++++++---------
    1 file changed, 9 insertions(+), 9 deletions(-)

    --- a/fs/dlm/lock.c
    +++ b/fs/dlm/lock.c
    @@ -2864,17 +2864,9 @@ static int set_unlock_args(uint32_t flag
    static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb,
    struct dlm_args *args)
    {
    - int rv = -EINVAL;
    + int rv = -EBUSY;

    if (args->flags & DLM_LKF_CONVERT) {
    - if (lkb->lkb_flags & DLM_IFL_MSTCPY)
    - goto out;
    -
    - if (args->flags & DLM_LKF_QUECVT &&
    - !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1])
    - goto out;
    -
    - rv = -EBUSY;
    if (lkb->lkb_status != DLM_LKSTS_GRANTED)
    goto out;

    @@ -2884,6 +2876,14 @@ static int validate_lock_args(struct dlm

    if (is_overlap(lkb))
    goto out;
    +
    + rv = -EINVAL;
    + if (lkb->lkb_flags & DLM_IFL_MSTCPY)
    + goto out;
    +
    + if (args->flags & DLM_LKF_QUECVT &&
    + !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1])
    + goto out;
    }

    lkb->lkb_exflags = args->flags;

    \
     
     \ /
      Last update: 2022-10-19 10:44    [W:2.441 / U:0.148 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site