Module Name: src Committed By: hannken Date: Mon Aug 12 17:46:38 UTC 2013
Modified Files: src/sys/nfs: nfs_bio.c Log Message: Function nfs_vinvalbuf() ignores errors from vinvalbuf() and therefore delayed write errors may get lost. Change nfs_vinvalbuf() to keep errors from vinvalbuf() for fsync() or close(). Presented on tech-kern@ Fix for PR kern/47980 (NFS over-quota not detected if utimes() called before fsync()/close()) To generate a diff of this commit: cvs rdiff -u -r1.188 -r1.189 src/sys/nfs/nfs_bio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/nfs/nfs_bio.c diff -u src/sys/nfs/nfs_bio.c:1.188 src/sys/nfs/nfs_bio.c:1.189 --- src/sys/nfs/nfs_bio.c:1.188 Tue Sep 27 01:07:38 2011 +++ src/sys/nfs/nfs_bio.c Mon Aug 12 17:46:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_bio.c,v 1.188 2011/09/27 01:07:38 christos Exp $ */ +/* $NetBSD: nfs_bio.c,v 1.189 2013/08/12 17:46:38 hannken Exp $ */ /* * Copyright (c) 1989, 1993 @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.188 2011/09/27 01:07:38 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.189 2013/08/12 17:46:38 hannken Exp $"); #ifdef _KERNEL_OPT #include "opt_nfs.h" @@ -614,7 +614,7 @@ nfs_vinvalbuf(struct vnode *vp, int flag { struct nfsnode *np = VTONFS(vp); struct nfsmount *nmp = VFSTONFS(vp->v_mount); - int error = 0, slptimeo; + int error = 0, allerror = 0, slptimeo; bool catch; if ((nmp->nm_flag & NFSMNT_INT) == 0) @@ -647,6 +647,8 @@ nfs_vinvalbuf(struct vnode *vp, int flag mutex_exit(vp->v_interlock); error = vinvalbuf(vp, flags, cred, l, catch, 0); while (error) { + if (allerror == 0) + allerror = error; if (intrflg && nfs_sigintr(nmp, NULL, l)) { error = EINTR; break; @@ -654,6 +656,13 @@ nfs_vinvalbuf(struct vnode *vp, int flag error = vinvalbuf(vp, flags, cred, l, 0, slptimeo); } mutex_enter(vp->v_interlock); + if (allerror != 0) { + /* + * Keep error from vinvalbuf so fsync/close will know. + */ + np->n_error = allerror; + np->n_flag |= NWRITEERR; + } if (error == 0) np->n_flag &= ~NMODIFIED; np->n_flag &= ~NFLUSHINPROG;