Commit cfa805f6 authored by Bart Van Assche's avatar Bart Van Assche Committed by David Teigland

dlm: Avoid LVB truncation

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: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 696b3d84
...@@ -2038,8 +2038,8 @@ static void set_lvb_lock_pc(struct dlm_rsb *r, struct dlm_lkb *lkb, ...@@ -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]; b = dlm_lvb_operations[lkb->lkb_grmode + 1][lkb->lkb_rqmode + 1];
if (b == 1) { if (b == 1) {
int len = receive_extralen(ms); int len = receive_extralen(ms);
if (len > DLM_RESNAME_MAXLEN) if (len > r->res_ls->ls_lvblen)
len = DLM_RESNAME_MAXLEN; len = r->res_ls->ls_lvblen;
memcpy(lkb->lkb_lvbptr, ms->m_extra, len); memcpy(lkb->lkb_lvbptr, ms->m_extra, len);
lkb->lkb_lvbseq = ms->m_lvbseq; lkb->lkb_lvbseq = ms->m_lvbseq;
} }
...@@ -3893,8 +3893,8 @@ static int receive_lvb(struct dlm_ls *ls, struct dlm_lkb *lkb, ...@@ -3893,8 +3893,8 @@ static int receive_lvb(struct dlm_ls *ls, struct dlm_lkb *lkb,
if (!lkb->lkb_lvbptr) if (!lkb->lkb_lvbptr)
return -ENOMEM; return -ENOMEM;
len = receive_extralen(ms); len = receive_extralen(ms);
if (len > DLM_RESNAME_MAXLEN) if (len > ls->ls_lvblen)
len = DLM_RESNAME_MAXLEN; len = ls->ls_lvblen;
memcpy(lkb->lkb_lvbptr, ms->m_extra, len); memcpy(lkb->lkb_lvbptr, ms->m_extra, len);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment