Add -A (noac) option to turn off the attribute cache. (Maciej W. Rozycki)

This commit is contained in:
christos 2020-10-03 18:06:37 +00:00
parent 806d42fb8f
commit a9f74273b0
2 changed files with 26 additions and 5 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mount_nfs.8,v 1.48 2018/05/17 06:37:06 wiz Exp $
.\" $NetBSD: mount_nfs.8,v 1.49 2020/10/03 18:06:37 christos Exp $
.\"
.\" Copyright (c) 1992, 1993, 1994, 1995
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95
.\"
.Dd September 12, 2016
.Dd October 3, 2020
.Dt MOUNT_NFS 8
.Os
.Sh NAME
@ -37,7 +37,7 @@
.Nd mount NFS file systems
.Sh SYNOPSIS
.Nm
.Op Fl 23bCcdilPpqsTUuX
.Op Fl 23AbCcdilPpqsTUuX
.Op Fl a Ar maxreadahead
.Op Fl D Ar deadthresh
.Op Fl g Ar maxgroups
@ -75,6 +75,17 @@ Use the NFS Version 2 protocol.
Use the NFS Version 3 protocol.
The default is to try version 3 first, and
fall back to version 2 if the mount fails.
.It Fl A
Disable the attribute cache in the client, making it consult the server
for the current version of a given file's attributes every time the file
is accessed.
By default the attribute cache is enabled, making the client only consult
the server every handful of seconds. This improves performance, however
at the cost of the risk of a mid-air collision when changes are made
simultaneously by different NFS clients and/or locally on the NFS server
that affect the same file. In that case changes made elsewhere may be
missed, leading to consistency issues.
.It Fl a Ar maxreadahead
Set the read-ahead count to the specified value.
This may be in the range of 0 - 4, and determines how many blocks
@ -186,6 +197,9 @@ Same as
.It Cm nfsv3
Same as
.Fl 3 .
.It Cm noac
Same as
.Fl A .
.It Cm noresport
Same as
.Fl p .

View File

@ -1,4 +1,4 @@
/* $NetBSD: mount_nfs.c,v 1.72 2018/05/17 02:34:31 thorpej Exp $ */
/* $NetBSD: mount_nfs.c,v 1.73 2020/10/03 18:06:37 christos Exp $ */
/*
* Copyright (c) 1992, 1993, 1994
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993, 1994\
#if 0
static char sccsid[] = "@(#)mount_nfs.c 8.11 (Berkeley) 5/4/95";
#else
__RCSID("$NetBSD: mount_nfs.c,v 1.72 2018/05/17 02:34:31 thorpej Exp $");
__RCSID("$NetBSD: mount_nfs.c,v 1.73 2020/10/03 18:06:37 christos Exp $");
#endif
#endif /* not lint */
@ -79,6 +79,7 @@ __RCSID("$NetBSD: mount_nfs.c,v 1.72 2018/05/17 02:34:31 thorpej Exp $");
#define ALTF_CONN 0x00000002
#define ALTF_DUMBTIMR 0x00000004
#define ALTF_INTR 0x00000008
#define ALTF_NOAC 0x00000010
#define ALTF_NFSV3 0x00000020
#define ALTF_RDIRPLUS 0x00000040
#define ALTF_MNTUDP 0x00000080
@ -109,6 +110,7 @@ static const struct mntopt mopts[] = {
{ "conn", 0, ALTF_CONN, 1 },
{ "dumbtimer", 0, ALTF_DUMBTIMR, 1 },
{ "intr", 0, ALTF_INTR, 1 },
{ "ac", 1, ALTF_NOAC, 1 },
{ "nfsv3", 0, ALTF_NFSV3, 1 },
{ "rdirplus", 0, ALTF_RDIRPLUS, 1 },
{ "mntudp", 0, ALTF_MNTUDP, 1 },
@ -217,6 +219,9 @@ mount_nfs_parseargs(int argc, char *argv[],
force2 = 1;
nfsargsp->flags &= ~NFSMNT_NFSV3;
break;
case 'A':
nfsargsp->flags |= NFSMNT_NOAC;
break;
case 'a':
num = strtol(optarg, &p, 10);
if (*p || num < 0)
@ -281,6 +286,8 @@ mount_nfs_parseargs(int argc, char *argv[],
nfsargsp->flags |= NFSMNT_DUMBTIMR;
if (altflags & ALTF_INTR)
nfsargsp->flags |= NFSMNT_INT;
if (altflags & ALTF_NOAC)
nfsargsp->flags |= NFSMNT_NOAC;
if (altflags & (ALTF_NFSV3|ALTF_NQNFS)) {
if (force2)
errx(1, "conflicting version options");