nfsclient: Fix the stripe unit size for a File Layout pNFS layout

During a recent virtual NFSv4 testing event, a bug in the FreeBSD client
was detected when doing a File Layout pNFS DS I/O operation.
The size of the I/O operation was smaller than expected.
The I/O size is specified as a stripe unit size in bits 6->31 of nflh_util
in the layout.  I had misinterpreted RFC5661 and had shifted the value
right by 6 bits. The correct interpretation is to use the value as
presented (it is always an exact multiple of 64), clearing bits 0->5.
This patch fixes this.

Without the patch, I/O through the DSs work, but the I/O size is 1/64th
of what is optimal.

MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2021-03-01 12:49:32 -08:00
parent c88c1f23a8
commit 94f2e42f5e

View File

@ -6024,7 +6024,7 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit,
np = VTONFS(vp);
rel_off = off - flp->nfsfl_patoff;
stripe_unit_size = (flp->nfsfl_util >> 6) & 0x3ffffff;
stripe_unit_size = flp->nfsfl_util & NFSFLAYUTIL_STRIPE_MASK;
stripe_pos = (rel_off / stripe_unit_size + flp->nfsfl_stripe1) %
dp->nfsdi_stripecnt;
transfer = stripe_unit_size - (rel_off % stripe_unit_size);