xpmem: truncates the size of xpmem_attach at the page boundary (workaround for fjmpi)

Fujitsu MPI tries to attach a segment with the size of the source range size plus one.

Change-Id: Iab3801727f938dfb6242b6b90c88e4986b84d08e
Refs: #1507
This commit is contained in:
Yoshihisa Morizumi
2021-01-29 05:17:47 +09:00
committed by Masamichi Takagi
parent 4d1d53b335
commit 63443383e9
2 changed files with 27 additions and 0 deletions

View File

@ -1027,10 +1027,19 @@ static int xpmem_attach(
return -EINVAL;
}
#ifdef ENABLE_FJMPI_WORKAROUND
/* Truncate size at page boundary because Fujitsu MPI
* erroneously passes (source range size + 1) as "size"
*/
size = (size & ~(PAGE_SIZE - 1));
#else
/* If the size is not page aligned, fix it */
if (offset_in_page(size) != 0) {
size += PAGE_SIZE - offset_in_page(size);
}
#endif
XPMEM_DEBUG("size after fix: 0x%lx", size);
ap_tg = xpmem_tg_ref_by_apid(apid);
if (IS_ERR(ap_tg))