Module Name: src Committed By: martin Date: Wed Jun 11 08:43:01 UTC 2014
Modified Files: src/lib/libquota: quota_nfs.c Log Message: Some more errno remapping: if the NFS server is unreachable because we have no route to it, assume there are no quotas. While this might sound like an impossible scenario, it actually happens inside rump tests when we have a virtual shmif network but are querying quotas for / which happens to be on NFS (but of course outside of the shmif setup). This fixes tests/fs/nfs/t_rquotad on diskless clients. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libquota/quota_nfs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libquota/quota_nfs.c diff -u src/lib/libquota/quota_nfs.c:1.3 src/lib/libquota/quota_nfs.c:1.4 --- src/lib/libquota/quota_nfs.c:1.3 Thu Jun 5 13:14:23 2014 +++ src/lib/libquota/quota_nfs.c Wed Jun 11 08:43:01 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: quota_nfs.c,v 1.3 2014/06/05 13:14:23 martin Exp $ */ +/* $NetBSD: quota_nfs.c,v 1.4 2014/06/11 08:43:01 martin Exp $ */ /*- * Copyright (c) 2011 Manuel Bouyer * All rights reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: quota_nfs.c,v 1.3 2014/06/05 13:14:23 martin Exp $"); +__RCSID("$NetBSD: quota_nfs.c,v 1.4 2014/06/11 08:43:01 martin Exp $"); #include <sys/types.h> #include <sys/param.h> /* XXX for DEV_BSIZE */ @@ -191,9 +191,21 @@ __quota_nfs_get(struct quotahandle *qh, free(host); if (ret != RPC_SUCCESS) { - /* if the file server does not support any quotas at all, - return ENOENT */ - errno = sverrno == ENOTCONN ? ENOENT : sverrno; + /* + * Remap some error codes for callers convenience: + * - if the file server does not support any quotas at all, + * return ENOENT + * - if the server can not be reached something is very + * wrong - or we are run inside a virtual rump network + * but querying an NFS mount from the host. Make sure + * to fail silently and return ENOENT as well. + */ + if (ret == RPC_SYSTEMERROR + && rpc_createerr.cf_error.re_errno == EHOSTUNREACH) + sverrno = ENOENT; + else if (sverrno == ENOTCONN) + sverrno = ENOENT; + errno = sverrno; return -1; }