diff options
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/nfsclient/nfs_clrpcops.c | 23 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_clvfsops.c | 8 | ||||
-rw-r--r-- | sys/fs/tmpfs/tmpfs_subr.c | 3 |
3 files changed, 29 insertions, 5 deletions
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 55eb983..4528855 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -46,6 +46,13 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include <fs/nfs/nfsport.h> +#include <sys/sysctl.h> + +SYSCTL_DECL(_vfs_nfs); + +static int nfsignore_eexist = 0; +SYSCTL_INT(_vfs_nfs, OID_AUTO, ignore_eexist, CTLFLAG_RW, + &nfsignore_eexist, 0, "NFS ignore EEXIST replies for mkdir/symlink"); /* * Global variables @@ -2530,8 +2537,12 @@ nfsrpc_symlink(vnode_t dvp, char *name, int namelen, char *target, mbuf_freem(nd->nd_mrep); /* * Kludge: Map EEXIST => 0 assuming that it is a reply to a retry. + * Only do this if vfs.nfs.ignore_eexist is set. + * Never do this for NFSv4.1 or later minor versions, since sessions + * should guarantee "exactly once" RPC semantics. */ - if (error == EEXIST) + if (error == EEXIST && nfsignore_eexist != 0 && (!NFSHASNFSV4(nmp) || + nmp->nm_minorvers == 0)) error = 0; return (error); } @@ -2550,10 +2561,12 @@ nfsrpc_mkdir(vnode_t dvp, char *name, int namelen, struct vattr *vap, nfsattrbit_t attrbits; int error = 0; struct nfsfh *fhp; + struct nfsmount *nmp; *nfhpp = NULL; *attrflagp = 0; *dattrflagp = 0; + nmp = VFSTONFS(vnode_mount(dvp)); fhp = VTONFS(dvp)->n_fhp; if (namelen > NFS_MAXNAMLEN) return (ENAMETOOLONG); @@ -2605,9 +2618,13 @@ nfsrpc_mkdir(vnode_t dvp, char *name, int namelen, struct vattr *vap, nfsmout: mbuf_freem(nd->nd_mrep); /* - * Kludge: Map EEXIST => 0 assuming that you have a reply to a retry. + * Kludge: Map EEXIST => 0 assuming that it is a reply to a retry. + * Only do this if vfs.nfs.ignore_eexist is set. + * Never do this for NFSv4.1 or later minor versions, since sessions + * should guarantee "exactly once" RPC semantics. */ - if (error == EEXIST) + if (error == EEXIST && nfsignore_eexist != 0 && (!NFSHASNFSV4(nmp) || + nmp->nm_minorvers == 0)) error = 0; return (error); } diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 73c6eb6..b165b96 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -779,7 +779,7 @@ nfs_mount(struct mount *mp) struct thread *td; char hst[MNAMELEN]; u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; - char *opt, *name, *secname; + char *cp, *opt, *name, *secname; int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; int minvers = 0; @@ -1158,8 +1158,12 @@ nfs_mount(struct mount *mp) if (vfs_getopt(mp->mnt_optnew, "principal", (void **)&name, NULL) == 0) strlcpy(srvkrbname, name, sizeof (srvkrbname)); - else + else { snprintf(srvkrbname, sizeof (srvkrbname), "nfs@%s", hst); + cp = strchr(srvkrbname, ':'); + if (cp != NULL) + *cp = '\0'; + } srvkrbnamelen = strlen(srvkrbname); if (vfs_getopt(mp->mnt_optnew, "gssname", (void **)&name, NULL) == 0) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 6114608..9a8aa8a 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <sys/namei.h> #include <sys/priv.h> #include <sys/proc.h> +#include <sys/random.h> #include <sys/rwlock.h> #include <sys/stat.h> #include <sys/systm.h> @@ -1758,6 +1759,8 @@ tmpfs_itimes(struct vnode *vp, const struct timespec *acc, } node->tn_status &= ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED); + /* XXX: FIX? The entropy here is desirable, but the harvesting may be expensive */ + random_harvest_queue(node, sizeof(*node), 1, RANDOM_FS_ATIME); } void |