Probably the easiest/quickest fix is to enforce rsize/wsize MUST be a multiple of page-size ? Is there any reason to support other sizes? In the mount api you could just round these sizes up to the nearest page size multiple.
This feels like a quick shot which may land near your foot. The documentation does not say why you may want to choose a non-default wsize, but I could think of a scenario where the packet size is chosen based on some network packet fragmentation size. If you suddenly increase the sizes, you may trigger a network performance problem. Besides, the page size is not always fixed. I am assuming we are talking about PAGE_SIZE on the Linux kernel here, but I don't really know anything about this code. Most architectures have 4 KiB page size, but there is the odd one with 8 KiB, and there is a "kernel-64k" variant for ARM with a 64 KiB page size. Before rounding any sizes up, I suggest finding out where the issue is, and whether it could be fixed respecting the user-chosen sizes. Regards, rdiez