Looking at sanlock source, if you specify the size, sanlock will copy
what you asked for.
But if you specify 0 sanlock will copy entire sector:
753 if (!len)
754 len = r->leader.sector_size;
Since we don't have a good way to get the sector size from
sanlock, I think we
should pass the size the user specified, and if the user did not
specify, allocate
and zero (calloc) a 4k buffer and pass sanlock lvblen=0, and let sanlock copy
an entire sector.
Looks like sanlock does not keep the size of the lvb passed in
set_lvb, so it cannot
return this value in. It also does not return the size it read when
using lvblen=0, so
we will always get one sector on the client side.
Maybe I'm missing something, but using lvblen=0 returns EINVAL,
probably because of this check[1]
[1]
https://pagure.io/sanlock/blob/master/f/src/client.c#_1475