Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/nfs Function nfs_vinvalbuf() ignores errors from vinvalb...



details:   https://anonhg.NetBSD.org/src/rev/e3be1631efb3
branches:  trunk
changeset: 789281:e3be1631efb3
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Aug 12 17:46:38 2013 +0000

description:
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())

diffstat:

 sys/nfs/nfs_bio.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r f89841ed344d -r e3be1631efb3 sys/nfs/nfs_bio.c
--- a/sys/nfs/nfs_bio.c Mon Aug 12 17:41:51 2013 +0000
+++ b/sys/nfs/nfs_bio.c Mon Aug 12 17:46:38 2013 +0000
@@ -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 @@
 {
        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 @@
        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 @@
                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;



Home | Main Index | Thread Index | Old Index