nfscl: Fix forced dismount from looping on commit

When a forced dismount is in progress, it is possible to
end up looping, retrying commits that fail.
This patch fixes the problem by pretending
that commits succeeded when a forced dismount is in prgress.

MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2021-11-03 14:25:44 -07:00
parent 589aed00e3
commit 6b67753488
2 changed files with 2 additions and 2 deletions

View File

@ -1738,7 +1738,7 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td,
off = ((u_quad_t)bp->b_blkno) * DEV_BSIZE + bp->b_dirtyoff;
retv = ncl_commit(vp, off, bp->b_dirtyend-bp->b_dirtyoff,
bp->b_wcred, td);
if (retv == 0) {
if (NFSCL_FORCEDISM(vp->v_mount) || retv == 0) {
bp->b_dirtyoff = bp->b_dirtyend = 0;
bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK);
bp->b_resid = 0;

View File

@ -3067,7 +3067,7 @@ ncl_flush(struct vnode *vp, int waitfor, struct thread *td,
for (i = 0; i < bvecpos; i++) {
bp = bvec[i];
bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK);
if (retv) {
if (!NFSCL_FORCEDISM(vp->v_mount) && retv) {
/*
* Error, leave B_DELWRI intact
*/