summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/nfsclient/nfs_lock.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/nfsclient/nfs_lock.c b/sys/nfsclient/nfs_lock.c
index 67f049a..550a133 100644
--- a/sys/nfsclient/nfs_lock.c
+++ b/sys/nfsclient/nfs_lock.c
@@ -143,10 +143,20 @@ nfs_dolock(struct vop_advlock_args *ap)
*/
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, _PATH_LCKFIFO, td);
- fmode = FFLAGS(O_WRONLY);
+ fmode = FFLAGS(O_WRONLY | O_NONBLOCK);
error = vn_open_cred(&nd, &fmode, 0, thread0.td_ucred);
- if (error != 0) {
- return (error == ENOENT ? EOPNOTSUPP : error);
+ switch (error) {
+ case ENOENT:
+ case ENXIO:
+ /*
+ * Map a failure to find the fifo or no listener on the
+ * fifo to locking not being supported.
+ */
+ return (EOPNOTSUPP);
+ case 0:
+ break;
+ default:
+ return (error);
}
wvp = nd.ni_vp;
VOP_UNLOCK(wvp, 0, td); /* vn_open leaves it locked */
OpenPOWER on IntegriCloud