svn commit: r319958 - in projects/pnfs-planb-server-stable11/sys/fs: nfs nfsserver
Rick Macklem
rmacklem at FreeBSD.org
Wed Jun 14 20:27:15 UTC 2017
Author: rmacklem
Date: Wed Jun 14 20:27:14 2017
New Revision: 319958
URL: https://svnweb.freebsd.org/changeset/base/319958
Log:
Revert the changes related to Close that updated attributes when only
reading has been done. Make updating changes upon Close conditional upon
vfs.nfsd.pnfsstrictattr being set, since it is a performance hit.
Modified:
projects/pnfs-planb-server-stable11/sys/fs/nfs/nfs_var.h
projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdserv.c
projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdstate.c
Modified: projects/pnfs-planb-server-stable11/sys/fs/nfs/nfs_var.h
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/fs/nfs/nfs_var.h Wed Jun 14 19:36:28 2017 (r319957)
+++ projects/pnfs-planb-server-stable11/sys/fs/nfs/nfs_var.h Wed Jun 14 20:27:14 2017 (r319958)
@@ -109,9 +109,9 @@ int nfsrv_openctrl(struct nfsrv_descript *, vnode_t,
int nfsrv_opencheck(nfsquad_t, nfsv4stateid_t *, struct nfsstate *,
vnode_t, struct nfsrv_descript *, NFSPROC_T *, int);
int nfsrv_openupdate(vnode_t, struct nfsstate *, nfsquad_t,
- nfsv4stateid_t *, struct nfsrv_descript *, NFSPROC_T *);
+ nfsv4stateid_t *, struct nfsrv_descript *, NFSPROC_T *, int *);
int nfsrv_delegupdate(struct nfsrv_descript *, nfsquad_t, nfsv4stateid_t *,
- vnode_t, int, struct ucred *, NFSPROC_T *);
+ vnode_t, int, struct ucred *, NFSPROC_T *, int *);
int nfsrv_releaselckown(struct nfsstate *, nfsquad_t, NFSPROC_T *);
void nfsrv_zapclient(struct nfsclient *, NFSPROC_T *);
int nfssvc_idname(struct nfsd_idargs *);
Modified: projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdserv.c Wed Jun 14 19:36:28 2017 (r319957)
+++ projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdserv.c Wed Jun 14 20:27:14 2017 (r319958)
@@ -59,6 +59,7 @@ extern time_t nfsdev_time;
extern struct nfsdevicehead nfsrv_devidhead;
extern int nfsd_debuglevel;
extern u_long sb_max_adj;
+extern int nfsrv_pnfsatime;
#endif /* !APPLEKEXT */
static int nfs_async = 0;
@@ -3161,7 +3162,7 @@ nfsrvd_close(struct nfsrv_descript *nd, __unused int i
{
u_int32_t *tl;
struct nfsstate st, *stp = &st;
- int error = 0;
+ int error = 0, writeacc;
nfsv4stateid_t stateid;
nfsquad_t clientid;
struct nfsvattr na;
@@ -3204,9 +3205,11 @@ nfsrvd_close(struct nfsrv_descript *nd, __unused int i
nd->nd_flag |= ND_IMPLIEDCLID;
nd->nd_clientid.qval = clientid.qval;
}
- nd->nd_repstat = nfsrv_openupdate(vp, stp, clientid, &stateid, nd, p);
+ nd->nd_repstat = nfsrv_openupdate(vp, stp, clientid, &stateid, nd, p,
+ &writeacc);
/* For pNFS, update the attributes. */
- nfsrv_updatemdsattr(vp, &na, p);
+ if (writeacc != 0 || nfsrv_pnfsatime != 0)
+ nfsrv_updatemdsattr(vp, &na, p);
vput(vp);
if (!nd->nd_repstat) {
/*
@@ -3260,7 +3263,7 @@ nfsrvd_delegpurge(struct nfsrv_descript *nd, __unused
nd->nd_clientid.qval = clientid.qval;
}
nd->nd_repstat = nfsrv_delegupdate(nd, clientid, NULL, NULL,
- NFSV4OP_DELEGPURGE, nd->nd_cred, p);
+ NFSV4OP_DELEGPURGE, nd->nd_cred, p, NULL);
nfsmout:
NFSEXITCODE2(error, nd);
return (error);
@@ -3274,7 +3277,7 @@ nfsrvd_delegreturn(struct nfsrv_descript *nd, __unused
vnode_t vp, NFSPROC_T *p, __unused struct nfsexstuff *exp)
{
u_int32_t *tl;
- int error = 0;
+ int error = 0, writeacc;
nfsv4stateid_t stateid;
nfsquad_t clientid;
struct nfsvattr na;
@@ -3296,9 +3299,10 @@ nfsrvd_delegreturn(struct nfsrv_descript *nd, __unused
nd->nd_clientid.qval = clientid.qval;
}
nd->nd_repstat = nfsrv_delegupdate(nd, clientid, &stateid, vp,
- NFSV4OP_DELEGRETURN, nd->nd_cred, p);
+ NFSV4OP_DELEGRETURN, nd->nd_cred, p, &writeacc);
/* For pNFS, update the attributes. */
- nfsrv_updatemdsattr(vp, &na, p);
+ if (writeacc != 0 || nfsrv_pnfsatime != 0)
+ nfsrv_updatemdsattr(vp, &na, p);
nfsmout:
vput(vp);
NFSEXITCODE2(error, nd);
@@ -3362,7 +3366,8 @@ nfsrvd_openconfirm(struct nfsrv_descript *nd, __unused
nd->nd_flag |= ND_IMPLIEDCLID;
nd->nd_clientid.qval = clientid.qval;
}
- nd->nd_repstat = nfsrv_openupdate(vp, stp, clientid, &stateid, nd, p);
+ nd->nd_repstat = nfsrv_openupdate(vp, stp, clientid, &stateid, nd, p,
+ NULL);
if (!nd->nd_repstat) {
NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
*tl++ = txdr_unsigned(stateid.seqid);
@@ -3465,7 +3470,7 @@ nfsrvd_opendowngrade(struct nfsrv_descript *nd, __unus
}
if (!nd->nd_repstat)
nd->nd_repstat = nfsrv_openupdate(vp, stp, clientid, &stateid,
- nd, p);
+ nd, p, NULL);
if (!nd->nd_repstat) {
/* For NFSv4.1, set the Current StateID. */
if ((nd->nd_flag & ND_NFSV41) != 0) {
Modified: projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdstate.c Wed Jun 14 19:36:28 2017 (r319957)
+++ projects/pnfs-planb-server-stable11/sys/fs/nfsserver/nfs_nfsdstate.c Wed Jun 14 20:27:14 2017 (r319958)
@@ -90,8 +90,8 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, allowreadforwriteopen,
&nfsrv_allowreadforwriteopen, 0,
"Allow Reads to be done with Write Access StateIDs");
-static int nfsrv_pnfsatime = 0;
-SYSCTL_INT(_vfs_nfsd, OID_AUTO, pnfsgetatime, CTLFLAG_RW,
+int nfsrv_pnfsatime = 0;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, pnfsstrictatime, CTLFLAG_RW,
&nfsrv_pnfsatime, 0,
"For pNFS service, do Getattr ops to keep atime up-to-date");
@@ -3291,7 +3291,8 @@ out:
*/
APPLESTATIC int
nfsrv_openupdate(vnode_t vp, struct nfsstate *new_stp, nfsquad_t clientid,
- nfsv4stateid_t *stateidp, struct nfsrv_descript *nd, NFSPROC_T *p)
+ nfsv4stateid_t *stateidp, struct nfsrv_descript *nd, NFSPROC_T *p,
+ int *retwriteaccessp)
{
struct nfsstate *stp, *ownerstp;
struct nfsclient *clp;
@@ -3394,6 +3395,12 @@ nfsrv_openupdate(vnode_t vp, struct nfsstate *new_stp,
} else if (new_stp->ls_flags & NFSLCK_CLOSE) {
ownerstp = stp->ls_openowner;
lfp = stp->ls_lfp;
+ if (retwriteaccessp != NULL) {
+ if ((stp->ls_flags & NFSLCK_WRITEACCESS) != 0)
+ *retwriteaccessp = 1;
+ else
+ *retwriteaccessp = 0;
+ }
if (nfsrv_dolocallocks != 0 && !LIST_EMPTY(&stp->ls_open)) {
/* Get the lf lock */
nfsrv_locklf(lfp);
@@ -3450,7 +3457,7 @@ out:
APPLESTATIC int
nfsrv_delegupdate(struct nfsrv_descript *nd, nfsquad_t clientid,
nfsv4stateid_t *stateidp, vnode_t vp, int op, struct ucred *cred,
- NFSPROC_T *p)
+ NFSPROC_T *p, int *retwriteaccessp)
{
struct nfsstate *stp;
struct nfsclient *clp;
@@ -3515,6 +3522,12 @@ nfsrv_delegupdate(struct nfsrv_descript *nd, nfsquad_t
error = NFSERR_BADSTATEID;
goto out;
}
+ if (retwriteaccessp != NULL) {
+ if ((stp->ls_flags & NFSLCK_DELEGWRITE) != 0)
+ *retwriteaccessp = 1;
+ else
+ *retwriteaccessp = 0;
+ }
nfsrv_freedeleg(stp);
} else {
nfsrv_freedeleglist(&clp->lc_olddeleg);
@@ -6336,7 +6349,7 @@ nfsrv_layoutreturn(struct nfsrv_descript *nd, vnode_t
if (kind == NFSV4LAYOUTRET_FILE) {
*fndp = 0;
error = nfsvno_getfh(vp, &fh, p);
- if (error == 0 && (iomode & NFSLAYOUTIOMODE_RW) != 0) {
+ if (error == 0) {
error = nfsrv_updatemdsattr(vp, &na, p);
if (error != 0)
printf("nfsrv_layoutreturn: updatemdsattr"
More information about the svn-src-projects
mailing list