Source-Changes-HG archive

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

[src/netbsd-2]: src/sys/nfs Pull up following revision(s) (requested by jld i...



details:   https://anonhg.NetBSD.org/src/rev/7ee20d4a69be
branches:  netbsd-2
changeset: 564343:7ee20d4a69be
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Dec 01 16:18:34 2005 +0000

description:
Pull up following revision(s) (requested by jld in ticket #8826):
        sys/nfs/nfs_bio.c: revisions 1.136-1.137 via patch
The problem (kern/31926): under certain conditions, which could be
reliably reproduced, NFS reads would occasionally return zeroes instead
of some of the file data, or fail with EINVAL.

diffstat:

 sys/nfs/nfs_bio.c |  29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diffs (61 lines):

diff -r 98dbda14b56a -r 7ee20d4a69be sys/nfs/nfs_bio.c
--- a/sys/nfs/nfs_bio.c Thu Dec 01 15:59:16 2005 +0000
+++ b/sys/nfs/nfs_bio.c Thu Dec 01 16:18:34 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_bio.c,v 1.116.2.2.2.1 2005/01/30 13:43:55 he Exp $ */
+/*     $NetBSD: nfs_bio.c,v 1.116.2.2.2.2 2005/12/01 16:18:34 riz Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.116.2.2.2.1 2005/01/30 13:43:55 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.116.2.2.2.2 2005/12/01 16:18:34 riz Exp $");
 
 #include "opt_nfs.h"
 #include "opt_ddb.h"
@@ -220,25 +220,34 @@
                nfsstats.biocache_reads++;
 
                error = 0;
-               if (uio->uio_offset >= np->n_size) {
-                       break;
-               }
                while (uio->uio_resid > 0) {
                        void *win;
-                       vsize_t bytelen = MIN(np->n_size - uio->uio_offset,
-                                             uio->uio_resid);
+                       vsize_t bytelen;
 
-                       if (bytelen == 0)
+                       nfs_delayedtruncate(vp);
+                       if (np->n_size <= uio->uio_offset) {
                                break;
+                       }
+                       bytelen =
+                           MIN(np->n_size - uio->uio_offset, uio->uio_resid);
                        win = ubc_alloc(&vp->v_uobj, uio->uio_offset,
                                        &bytelen, UBC_READ);
                        error = uiomove(win, bytelen, uio);
                        ubc_release(win, 0);
                        if (error) {
-                               break;
+                               /*
+                                * XXXkludge
+                                * the file has been truncated on the server.
+                                * there isn't much we can do.
+                                */
+                               if (uio->uio_offset >= np->n_size) {
+                                       /* end of file */
+                                       error = 0;
+                               } else {
+                                       break;
+                               }
                        }
                }
-               n = 0;
                break;
 
            case VLNK:



Home | Main Index | Thread Index | Old Index