dlm: Avoid LVB truncation
authorBart Van Assche <bvanassche@acm.org>
Wed, 26 Jun 2013 12:27:57 +0000 (14:27 +0200)
committerDavid Teigland <teigland@redhat.com>
Wed, 26 Jun 2013 16:38:02 +0000 (11:38 -0500)
For lockspaces with an LVB length above 64 bytes, avoid truncating
the LVB while exchanging it with another node in the cluster.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: David Teigland <teigland@redhat.com>
fs/dlm/lock.c

index 1b1146670c4b9c881b1b3a40d62a01b150cecd9d..e223a911a8346691d065e573f0ce0ab0ea9465fc 100644 (file)
@@ -2038,8 +2038,8 @@ static void set_lvb_lock_pc(struct dlm_rsb *r, struct dlm_lkb *lkb,
        b = dlm_lvb_operations[lkb->lkb_grmode + 1][lkb->lkb_rqmode + 1];
        if (b == 1) {
                int len = receive_extralen(ms);
-               if (len > DLM_RESNAME_MAXLEN)
-                       len = DLM_RESNAME_MAXLEN;
+               if (len > r->res_ls->ls_lvblen)
+                       len = r->res_ls->ls_lvblen;
                memcpy(lkb->lkb_lvbptr, ms->m_extra, len);
                lkb->lkb_lvbseq = ms->m_lvbseq;
        }
@@ -3893,8 +3893,8 @@ static int receive_lvb(struct dlm_ls *ls, struct dlm_lkb *lkb,
                if (!lkb->lkb_lvbptr)
                        return -ENOMEM;
                len = receive_extralen(ms);
-               if (len > DLM_RESNAME_MAXLEN)
-                       len = DLM_RESNAME_MAXLEN;
+               if (len > ls->ls_lvblen)
+                       len = ls->ls_lvblen;
                memcpy(lkb->lkb_lvbptr, ms->m_extra, len);
        }
        return 0;