Skip to content

Commit 7c38ce8

Browse files
committed
basic-server: LocalFileSystem: throw StaleException for missing Inode
When trying to resolve an Inode object that doesn't exist, we currently throw NoEntException. When restarting a server, NFS clients may still request old Inodes, which (apart from the root inode) will not exist, since they're all UUID generated. This is a problem at for the macOS NFS client, which may fail and not recover from this situation. Throw StaleException instead, which will instruct the NFS client to refresh its file handles/Inodes. A "cd $(pwd)" may still be required if the user was in an NFS mount point filetree upon server restart, but at least it's recovering now. Related: #149 Signed-off-by: Christian Kohlschütter <[email protected]>
1 parent e7be461 commit 7c38ce8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

basic-server/src/main/java/org/dcache/nfs4j/server/LocalFileSystem.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import javax.security.auth.Subject;
3535

3636
import org.cliffc.high_scale_lib.NonBlockingHashMap;
37+
import org.dcache.nfs.ChimeraNFSException;
3738
import org.dcache.nfs.FsExport;
3839
import org.dcache.nfs.status.ExistException;
3940
import org.dcache.nfs.status.InvalException;
@@ -43,6 +44,7 @@
4344
import org.dcache.nfs.status.NotSuppException;
4445
import org.dcache.nfs.status.PermException;
4546
import org.dcache.nfs.status.ServerFaultException;
47+
import org.dcache.nfs.status.StaleException;
4648
import org.dcache.nfs.v4.NfsIdMapping;
4749
import org.dcache.nfs.v4.SimpleIdMap;
4850
import org.dcache.nfs.v4.xdr.nfsace4;
@@ -86,10 +88,10 @@ private static Inode toFh(UUID inodeNumber) {
8688
return Inode.forFile(toByteArray(inodeNumber));
8789
}
8890

89-
private Path resolveInode(Inode inodeNumber) throws NoEntException {
91+
private Path resolveInode(Inode inodeNumber) throws ChimeraNFSException {
9092
Path path = inodeToPath.get(inodeNumber);
9193
if (path == null) {
92-
throw new NoEntException("inode #" + inodeNumber);
94+
throw new StaleException("inode #" + inodeNumber);
9395
}
9496
return path;
9597
}

0 commit comments

Comments
 (0)