Fix remaining calls to cache_enter() in both NFS clients to provide
appropriate timestamps. Restore the assertions which verify that NCF_TS is set when timestamp is asked for. Reviewed by: jhb (previous version) MFC after: 2 weeks
This commit is contained in:
parent
d9360bbfc4
commit
d5210589b7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230552
@ -1433,8 +1433,6 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if ((cnp->cn_flags & MAKEENTRY))
|
|
||||||
cache_enter(dvp, newvp, cnp);
|
|
||||||
*vpp = newvp;
|
*vpp = newvp;
|
||||||
} else if (NFS_ISV4(dvp)) {
|
} else if (NFS_ISV4(dvp)) {
|
||||||
error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid,
|
error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid,
|
||||||
@ -1592,8 +1590,8 @@ nfs_create(struct vop_create_args *ap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (cnp->cn_flags & MAKEENTRY)
|
if ((cnp->cn_flags & MAKEENTRY) && attrflag)
|
||||||
cache_enter(dvp, newvp, cnp);
|
cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime);
|
||||||
*ap->a_vpp = newvp;
|
*ap->a_vpp = newvp;
|
||||||
} else if (NFS_ISV4(dvp)) {
|
} else if (NFS_ISV4(dvp)) {
|
||||||
error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid,
|
error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid,
|
||||||
@ -1968,8 +1966,9 @@ nfs_link(struct vop_link_args *ap)
|
|||||||
* must care about lookup caching hit rate, so...
|
* must care about lookup caching hit rate, so...
|
||||||
*/
|
*/
|
||||||
if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 &&
|
if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 &&
|
||||||
(cnp->cn_flags & MAKEENTRY))
|
(cnp->cn_flags & MAKEENTRY) && dattrflag) {
|
||||||
cache_enter(tdvp, vp, cnp);
|
cache_enter_time(tdvp, vp, cnp, &dnfsva.na_mtime);
|
||||||
|
}
|
||||||
if (error && NFS_ISV4(vp))
|
if (error && NFS_ISV4(vp))
|
||||||
error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0,
|
error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0,
|
||||||
(gid_t)0);
|
(gid_t)0);
|
||||||
@ -2025,15 +2024,6 @@ nfs_symlink(struct vop_symlink_args *ap)
|
|||||||
error = nfscl_maperr(cnp->cn_thread, error,
|
error = nfscl_maperr(cnp->cn_thread, error,
|
||||||
vap->va_uid, vap->va_gid);
|
vap->va_uid, vap->va_gid);
|
||||||
} else {
|
} else {
|
||||||
/*
|
|
||||||
* If negative lookup caching is enabled, I might as well
|
|
||||||
* add an entry for this node. Not necessary for correctness,
|
|
||||||
* but if negative caching is enabled, then the system
|
|
||||||
* must care about lookup caching hit rate, so...
|
|
||||||
*/
|
|
||||||
if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 &&
|
|
||||||
(cnp->cn_flags & MAKEENTRY))
|
|
||||||
cache_enter(dvp, newvp, cnp);
|
|
||||||
*ap->a_vpp = newvp;
|
*ap->a_vpp = newvp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2043,6 +2033,16 @@ nfs_symlink(struct vop_symlink_args *ap)
|
|||||||
if (dattrflag != 0) {
|
if (dattrflag != 0) {
|
||||||
mtx_unlock(&dnp->n_mtx);
|
mtx_unlock(&dnp->n_mtx);
|
||||||
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
|
(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
|
||||||
|
/*
|
||||||
|
* If negative lookup caching is enabled, I might as well
|
||||||
|
* add an entry for this node. Not necessary for correctness,
|
||||||
|
* but if negative caching is enabled, then the system
|
||||||
|
* must care about lookup caching hit rate, so...
|
||||||
|
*/
|
||||||
|
if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 &&
|
||||||
|
(cnp->cn_flags & MAKEENTRY)) {
|
||||||
|
cache_enter_time(dvp, newvp, cnp, &dnfsva.na_mtime);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dnp->n_attrstamp = 0;
|
dnp->n_attrstamp = 0;
|
||||||
mtx_unlock(&dnp->n_mtx);
|
mtx_unlock(&dnp->n_mtx);
|
||||||
@ -2118,8 +2118,9 @@ nfs_mkdir(struct vop_mkdir_args *ap)
|
|||||||
* must care about lookup caching hit rate, so...
|
* must care about lookup caching hit rate, so...
|
||||||
*/
|
*/
|
||||||
if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 &&
|
if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 &&
|
||||||
(cnp->cn_flags & MAKEENTRY))
|
(cnp->cn_flags & MAKEENTRY) && dattrflag) {
|
||||||
cache_enter(dvp, newvp, cnp);
|
cache_enter_time(dvp, newvp, cnp, &dnfsva.na_mtime);
|
||||||
|
}
|
||||||
*ap->a_vpp = newvp;
|
*ap->a_vpp = newvp;
|
||||||
}
|
}
|
||||||
return (error);
|
return (error);
|
||||||
|
@ -237,13 +237,9 @@ static void
|
|||||||
cache_out_ts(struct namecache *ncp, struct timespec *tsp, int *ticksp)
|
cache_out_ts(struct namecache *ncp, struct timespec *tsp, int *ticksp)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((ncp->nc_flag & NCF_TS) == 0) {
|
KASSERT((ncp->nc_flag & NCF_TS) != 0 ||
|
||||||
if (tsp != NULL)
|
(tsp == NULL && ticksp == NULL),
|
||||||
bzero(tsp, sizeof(*tsp));
|
("No NCF_TS"));
|
||||||
if (ticksp != NULL)
|
|
||||||
*ticksp = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tsp != NULL)
|
if (tsp != NULL)
|
||||||
*tsp = ((struct namecache_ts *)ncp)->nc_time;
|
*tsp = ((struct namecache_ts *)ncp)->nc_time;
|
||||||
@ -791,8 +787,8 @@ cache_enter_time(dvp, vp, cnp, tsp)
|
|||||||
n2->nc_nlen == cnp->cn_namelen &&
|
n2->nc_nlen == cnp->cn_namelen &&
|
||||||
!bcmp(nc_get_name(n2), cnp->cn_nameptr, n2->nc_nlen)) {
|
!bcmp(nc_get_name(n2), cnp->cn_nameptr, n2->nc_nlen)) {
|
||||||
if (tsp != NULL) {
|
if (tsp != NULL) {
|
||||||
if ((n2->nc_flag & NCF_TS) == 0)
|
KASSERT((n2->nc_flag & NCF_TS) != 0,
|
||||||
continue;
|
("no NCF_TS"));
|
||||||
n3 = (struct namecache_ts *)n2;
|
n3 = (struct namecache_ts *)n2;
|
||||||
n3->nc_time =
|
n3->nc_time =
|
||||||
((struct namecache_ts *)ncp)->nc_time;
|
((struct namecache_ts *)ncp)->nc_time;
|
||||||
|
@ -1532,8 +1532,6 @@ nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
|
|||||||
if (newvp)
|
if (newvp)
|
||||||
vput(newvp);
|
vput(newvp);
|
||||||
} else {
|
} else {
|
||||||
if (cnp->cn_flags & MAKEENTRY)
|
|
||||||
cache_enter(dvp, newvp, cnp);
|
|
||||||
*vpp = newvp;
|
*vpp = newvp;
|
||||||
}
|
}
|
||||||
mtx_lock(&(VTONFS(dvp))->n_mtx);
|
mtx_lock(&(VTONFS(dvp))->n_mtx);
|
||||||
@ -1672,8 +1670,6 @@ nfs_create(struct vop_create_args *ap)
|
|||||||
vput(newvp);
|
vput(newvp);
|
||||||
}
|
}
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (cnp->cn_flags & MAKEENTRY)
|
|
||||||
cache_enter(dvp, newvp, cnp);
|
|
||||||
*ap->a_vpp = newvp;
|
*ap->a_vpp = newvp;
|
||||||
}
|
}
|
||||||
mtx_lock(&(VTONFS(dvp))->n_mtx);
|
mtx_lock(&(VTONFS(dvp))->n_mtx);
|
||||||
|
Loading…
Reference in New Issue
Block a user