When the NFSv4.1 client is writing to a pNFS Data Server (DS), the

file's size attribute does not get updated. As such, it is necessary
to invalidate the attribute cache before clearing NMODIFIED for pNFS.

MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2013-06-21 22:26:18 +00:00
parent 315c38d135
commit 562395581b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252072
2 changed files with 25 additions and 4 deletions

View File

@ -1372,9 +1372,16 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thread *td, int intrflg)
goto out;
error = vinvalbuf(vp, flags, 0, slptimeo);
}
if (NFSHASPNFS(nmp))
if (NFSHASPNFS(nmp)) {
nfscl_layoutcommit(vp, td);
mtx_lock(&np->n_mtx);
/*
* Invalidate the attribute cache, since writes to a DS
* won't update the size attribute.
*/
mtx_lock(&np->n_mtx);
np->n_attrstamp = 0;
} else
mtx_lock(&np->n_mtx);
if (np->n_directio_asyncwr == 0)
np->n_flag &= ~NMODIFIED;
mtx_unlock(&np->n_mtx);
@ -1555,6 +1562,13 @@ ncl_doio_directwrite(struct buf *bp)
if ((bp->b_flags & B_DIRECT) && bp->b_iocmd == BIO_WRITE) {
struct nfsnode *np = VTONFS(bp->b_vp);
mtx_lock(&np->n_mtx);
if (NFSHASPNFS(VFSTONFS(vnode_mount(bp->b_vp)))) {
/*
* Invalidate the attribute cache, since writes to a DS
* won't update the size attribute.
*/
np->n_attrstamp = 0;
}
np->n_directio_asyncwr--;
if (np->n_directio_asyncwr == 0) {
np->n_flag &= ~NMODIFIED;

View File

@ -2951,9 +2951,16 @@ ncl_flush(struct vnode *vp, int waitfor, struct ucred *cred, struct thread *td,
mtx_unlock(&np->n_mtx);
} else
BO_UNLOCK(bo);
if (NFSHASPNFS(nmp))
if (NFSHASPNFS(nmp)) {
nfscl_layoutcommit(vp, td);
mtx_lock(&np->n_mtx);
/*
* Invalidate the attribute cache, since writes to a DS
* won't update the size attribute.
*/
mtx_lock(&np->n_mtx);
np->n_attrstamp = 0;
} else
mtx_lock(&np->n_mtx);
if (np->n_flag & NWRITEERR) {
error = np->n_error;
np->n_flag &= ~NWRITEERR;