-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nfsv4.1: resulting notification bitmap should match requests length
Motivation: Though bitmap can have an arbitrary length, the linux 5.10 client expects device notification bitmap to be size of one (1). Modification: Update OperationGETDEVICEINFO to initialize resulting notification bitmap with the length that matches requested notification bitmap. Result: Linux 5.10 client processes the result of getdeviceinfo operation as expected. Target: 0.22, master Acked-by: Paul Millar Acked-by: Albert Rossi (cherry picked from commit 8ede287) Signed-off-by: Tigran Mkrtchyan <[email protected]>
- Loading branch information
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
core/src/test/java/org/dcache/nfs/v4/OperationGETDEVICEINFOTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.dcache.nfs.v4; | ||
|
||
import com.google.common.collect.Sets; | ||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import org.dcache.nfs.v4.xdr.COMPOUND4args; | ||
import org.dcache.nfs.v4.xdr.COMPOUND4res; | ||
import org.dcache.nfs.v4.xdr.device_addr4; | ||
import org.dcache.nfs.v4.xdr.deviceid4; | ||
import org.dcache.nfs.v4.xdr.layouttype4; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.dcache.nfs.v4.NfsTestUtils.generateRpcCall; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.BDDMockito.given; | ||
|
||
import static org.dcache.nfs.v4.NfsTestUtils.execute; | ||
|
||
/** | ||
* | ||
*/ | ||
public class OperationGETDEVICEINFOTest { | ||
|
||
@Test | ||
public void testNotificationBitmapSize() throws IOException, URISyntaxException { | ||
|
||
NFSv41DeviceManager dm = mock(NFSv41DeviceManager.class); | ||
given(dm.getDeviceInfo(any(), any())).willReturn(mock(device_addr4.class)); | ||
|
||
given(dm.getLayoutTypes()).willReturn(Sets.newHashSet(layouttype4.values())); | ||
CompoundContext context = new CompoundContextBuilder() | ||
.withDeviceManager(dm) | ||
.withCall(generateRpcCall()) | ||
.build(); | ||
|
||
COMPOUND4args gdiArgs = new CompoundBuilder() | ||
.withGetdeviceinfo(new deviceid4(new byte[] {0x7})) | ||
.build(); | ||
|
||
COMPOUND4res res = execute(context, gdiArgs); | ||
assertEquals("invalid notification bitmap size", 1, res.resarray.get(0).opgetdeviceinfo.gdir_resok4.gdir_notification.value.length); | ||
} | ||
} |