- From 9e4ff94c4f543142dade3da2b53367a5a5f56e7d Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 16 Jan 2024 01:45:55 +0100
- Subject: [PATCH 1/3] LocalFileSystem: Add better diag message
- Add better debug message in case something goes wrong
- ---
- src/main/java/org/dcache/simplenfs/LocalFileSystem.java | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- diff --git a/src/main/java/org/dcache/simplenfs/LocalFileSystem.java b/src/main/java/org/dcache/simplenfs/LocalFileSystem.java
- index 82fcf33..af56d6b 100644
- --- a/src/main/java/org/dcache/simplenfs/LocalFileSystem.java
- +++ b/src/main/java/org/dcache/simplenfs/LocalFileSystem.java
- @@ -114,7 +114,7 @@ public class LocalFileSystem implements VirtualFileSystem {
- if (inodeToPath.remove(inodeNumber) != path) {
- throw new IllegalStateException("cant map, rollback failed");
- }
- - throw new IllegalStateException("path ");
- + throw new IllegalStateException("path='"+path+"', inodeNumber="+inodeNumber+", otherInodeNumber=" +otherInodeNumber);
- }
- }
- --
- 2.30.2
- From f406e5402a4e1d2137c9b3ea3e2e34a9e2283e2f Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 16 Jan 2024 01:47:24 +0100
- Subject: [PATCH 2/3] SimpleNfsServer: Add -nfsvers option to specify NFS
- version
- Add -nfsvers option to specify which NFS versions should be supported
- by the server (3, 4, or 0 for both 3+4).
- ---
- src/main/java/org/dcache/simplenfs/App.java | 4 +-
- .../org/dcache/simplenfs/SimpleNfsServer.java | 40 +++++++++++++------
- 2 files changed, 31 insertions(+), 13 deletions(-)
- diff --git a/src/main/java/org/dcache/simplenfs/App.java b/src/main/java/org/dcache/simplenfs/App.java
- index 58b846f..d34ed0f 100644
- --- a/src/main/java/org/dcache/simplenfs/App.java
- +++ b/src/main/java/org/dcache/simplenfs/App.java
- @@ -18,6 +18,8 @@ public class App {
- private Path root;
- @Option(name = "-exports", usage = "path to file with export tables", metaVar = "<file>")
- private Path exportsFile;
- + @Option(name = "-nfsvers", usage = "NFS version (3, 4, 0==3+4) to use", metaVar = "<int>")
- + private int nfsVers = 0;
- @Option(name = "-port", usage = "TCP port to use", metaVar = "<port>")
- private int rpcPort = 2049;
- @Option(name = "-with-portmap", usage = "start embedded portmap")
- @@ -52,7 +54,7 @@ public class App {
- new OncRpcEmbeddedPortmap();
- }
- - try (SimpleNfsServer ignored = new SimpleNfsServer(rpcPort, root, exportFile, null)) {
- + try (SimpleNfsServer ignored = new SimpleNfsServer(nfsVers, rpcPort, root, exportFile, null)) {
- //noinspection ResultOfMethodCallIgnored
- System.in.read(); //any key to shutdown
- }
- diff --git a/src/main/java/org/dcache/simplenfs/SimpleNfsServer.java b/src/main/java/org/dcache/simplenfs/SimpleNfsServer.java
- index 0067f89..c7542e2 100644
- --- a/src/main/java/org/dcache/simplenfs/SimpleNfsServer.java
- +++ b/src/main/java/org/dcache/simplenfs/SimpleNfsServer.java
- @@ -28,11 +28,16 @@ public class SimpleNfsServer implements Closeable {
- private final String name;
- public SimpleNfsServer(Path root) {
- - this(2049, root, null, null);
- + this(0, 2049, root, null, null);
- }
- - public SimpleNfsServer(int port, Path root, ExportFile exportFile, String name) {
- + public SimpleNfsServer(int nfsVers, int port, Path root, ExportFile exportFile, String name) {
- try {
- + NfsServerV3 nfs3 = null;
- + NFSServerV41 nfs4 = null;
- + boolean startNfsV3 = ((nfsVers == 0) || (nfsVers == 3));
- + boolean startNfsV4 = ((nfsVers == 0) || (nfsVers == 4));
- +
- if (exportFile == null) {
- exportFile = new ExportFile(new InputStreamReader(SimpleNfsServer.class.getClassLoader().getResourceAsStream("exports")));
- }
- @@ -59,19 +64,30 @@ public class SimpleNfsServer implements Closeable {
- .withServiceName(this.name)
- .build();
- - NFSServerV41 nfs4 = new NFSServerV41.Builder()
- - .withVfs(vfs)
- - .withOperationExecutor(new MDSOperationExecutor())
- - .withExportTable(exportFile)
- - .build();
- + if (startNfsV4) {
- + nfs4 = new NFSServerV41.Builder()
- + .withVfs(vfs)
- + .withOperationExecutor(new MDSOperationExecutor())
- + .withExportTable(exportFile)
- + .build();
- + }
- +
- + if (startNfsV3) {
- + nfs3 = new NfsServerV3(exportFile, vfs);
- + }
- - NfsServerV3 nfs3 = new NfsServerV3(exportFile, vfs);
- MountServer mountd = new MountServer(exportFile, vfs);
- - nfsSvc.register(new OncRpcProgram(mount_prot.MOUNT_PROGRAM, mount_prot.MOUNT_V3), mountd);
- - nfsSvc.register(new OncRpcProgram(mount_prot.MOUNT_PROGRAM, mount_prot.MOUNT_V1), mountd);
- - nfsSvc.register(new OncRpcProgram(nfs3_prot.NFS_PROGRAM, nfs3_prot.NFS_V3), nfs3);
- - nfsSvc.register(new OncRpcProgram(nfs4_prot.NFS4_PROGRAM, nfs4_prot.NFS_V4), nfs4);
- + if (startNfsV3) {
- + nfsSvc.register(new OncRpcProgram(mount_prot.MOUNT_PROGRAM, mount_prot.MOUNT_V3), mountd);
- + nfsSvc.register(new OncRpcProgram(mount_prot.MOUNT_PROGRAM, mount_prot.MOUNT_V1), mountd);
- + nfsSvc.register(new OncRpcProgram(nfs3_prot.NFS_PROGRAM, nfs3_prot.NFS_V3), nfs3);
- + }
- +
- + if (startNfsV4) {
- + nfsSvc.register(new OncRpcProgram(nfs4_prot.NFS4_PROGRAM, nfs4_prot.NFS_V4), nfs4);
- + }
- +
- nfsSvc.start();
- } catch (IOException e) {
- throw new UncheckedIOException(e);
- --
- 2.30.2
- From 0c5128f03b3ff49ed5776d4a3f8aaa0b5f6a84d3 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 16 Jan 2024 01:49:02 +0100
- Subject: [PATCH 3/3] Update to nfs4j-core 0.25 and bump version to 1.1
- Update to nfs4j-core 0.25 and bump our version to 1.1
- ---
- pom.xml | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
- diff --git a/pom.xml b/pom.xml
- index 6d4517b..2c346b9 100644
- --- a/pom.xml
- +++ b/pom.xml
- @@ -4,7 +4,7 @@
- <groupId>org.dcache</groupId>
- <artifactId>simple-nfs</artifactId>
- - <version>1.0-SNAPSHOT</version>
- + <version>1.1-SNAPSHOT</version>
- <name>Simple nfs server</name>
- <url>http://www.dcache.org/</url>
- @@ -65,7 +65,7 @@
- <dependency>
- <groupId>org.dcache</groupId>
- <artifactId>nfs4j-core</artifactId>
- - <version>0.23.0</version>
- + <version>0.25.0</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- --
- 2.30.2
SimpleNfs patches (-nfsvers option, diag msg and bump to nfs4j-core 0.25)
Posted by Anonymous on Tue 16th Jan 2024 00:57
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.