• Alexander Aring's avatar
    fs: dlm: fix DLM_IFL_CB_PENDING gets overwritten · a034c137
    Alexander Aring authored
    This patch introduce a new internal flag per lkb value to handle
    internal flags which are handled not on wire. The current lkb internal
    flags stored as lkb->lkb_flags are split in upper and lower bits, the
    lower bits are used to share internal flags over wire for other cluster
    wide lkb copies on other nodes.
    
    In commit 61bed0ba ("fs: dlm: use a non-static queue for callbacks")
    we introduced a new internal flag for pending callbacks for the dlm
    callback queue. This flag is protected by the lkb->lkb_cb_lock lock.
    This patch overlooked that on dlm receive path and the mentioned upper
    and lower bits, that dlm will read the flags, mask it and write it
    back. As example receive_flags() in fs/dlm/lock.c. This flag
    manipulation is not done atomically and is not protected by
    lkb->lkb_cb_lock. This has unknown side effects of the current callback
    handling.
    
    In future we should move to set/clear/test bit functionality and avoid
    read, mask and writing back flag values. In later patches we will move
    the upper parts to the new introduced internal lkb flags which are not
    shared between other cluster nodes to the new non shared internal flag
    field to avoid similar issues.
    
    Cc: stable@vger.kernel.org
    Fixes: 61bed0ba ("fs: dlm: use a non-static queue for callbacks")
    Reported-by: default avatarBob Peterson <rpeterso@redhat.com>
    Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
    Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
    a034c137
dlm_internal.h 21.5 KB