Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/nfs Resolve conflicts



details:   https://anonhg.NetBSD.org/src/rev/2667adee96b5
branches:  trunk
changeset: 819109:2667adee96b5
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Nov 18 08:31:29 2016 +0000

description:
Resolve conflicts

diffstat:

 sys/fs/nfs/client/nfs_clbio.c     |   176 ++--
 sys/fs/nfs/client/nfs_clstate.c   |   125 +-
 sys/fs/nfs/client/nfs_clvnops.c   |   142 +--
 sys/fs/nfs/common/krpc_subr.c     |     8 +-
 sys/fs/nfs/common/nfs_fha.h       |    22 +-
 sys/fs/nfs/common/nfsm_subs.h     |    16 +-
 sys/fs/nfs/files.newnfs           |    13 +-
 sys/fs/nfs/nlm/nlm_prot_impl.c    |    26 +-
 sys/fs/nfs/server/nfs_nfsdcache.c |   204 +++--
 sys/fs/nfs/server/nfs_nfsdkrpc.c  |   112 ++-
 sys/fs/nfs/server/nfs_nfsdserv.c  |   804 +++++++++++++++++++---
 sys/fs/nfs/server/nfs_nfsdstate.c |  1281 ++++++++++++++++++++++++++++++------
 sys/fs/nfs/server/nfs_nfsdsubs.c  |   179 +++-
 13 files changed, 2297 insertions(+), 811 deletions(-)

diffs (truncated from 5978 to 300 lines):

diff -r 51b54ba5fe16 -r 2667adee96b5 sys/fs/nfs/client/nfs_clbio.c
--- a/sys/fs/nfs/client/nfs_clbio.c     Fri Nov 18 08:29:43 2016 +0000
+++ b/sys/fs/nfs/client/nfs_clbio.c     Fri Nov 18 08:31:29 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_clbio.c,v 1.2 2013/12/09 09:35:17 wiz Exp $        */
+/*     $NetBSD: nfs_clbio.c,v 1.3 2016/11/18 08:31:30 pgoyette Exp $   */
 /*-
  * Copyright (c) 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -34,10 +34,8 @@
  */
 
 #include <sys/cdefs.h>
-/* __FBSDID("FreeBSD: head/sys/fs/nfsclient/nfs_clbio.c 252072 2013-06-21 22:26:18Z rmacklem "); */
-__RCSID("$NetBSD: nfs_clbio.c,v 1.2 2013/12/09 09:35:17 wiz Exp $");
-
-#include "opt_kdtrace.h"
+/* __FBSDID("FreeBSD: head/sys/fs/nfsclient/nfs_clbio.c 304026 2016-08-12 22:44:59Z rmacklem "); */
+__RCSID("$NetBSD: nfs_clbio.c,v 1.3 2016/11/18 08:31:30 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -64,7 +62,7 @@
 #include <fs/nfsclient/nfs_kdtrace.h>
 
 extern int newnfs_directio_allow_mmap;
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
 extern struct mtx ncl_iod_mutex;
 extern int ncl_numasync;
 extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON];
@@ -104,10 +102,10 @@
        cred = curthread->td_ucred;             /* XXX */
        nmp = VFSTONFS(vp->v_mount);
        pages = ap->a_m;
-       count = ap->a_count;
+       npages = ap->a_count;
 
        if ((object = vp->v_object) == NULL) {
-               ncl_printf("nfs_getpages: called with non-merged cache vnode??\n");
+               printf("ncl_getpages: called with non-merged cache vnode\n");
                return (VM_PAGER_ERROR);
        }
 
@@ -115,7 +113,7 @@
                mtx_lock(&np->n_mtx);
                if ((np->n_flag & NNONCACHE) && (vp->v_type == VREG)) {
                        mtx_unlock(&np->n_mtx);
-                       ncl_printf("nfs_getpages: called on non-cacheable vnode??\n");
+                       printf("ncl_getpages: called on non-cacheable vnode\n");
                        return (VM_PAGER_ERROR);
                } else
                        mtx_unlock(&np->n_mtx);
@@ -130,30 +128,21 @@
        } else
                mtx_unlock(&nmp->nm_mtx);
 
-       npages = btoc(count);
-
        /*
         * If the requested page is partially valid, just return it and
         * allow the pager to zero-out the blanks.  Partially valid pages
         * can only occur at the file EOF.
+        *
+        * XXXGL: is that true for NFS, where short read can occur???
         */
        VM_OBJECT_WLOCK(object);
-       if (pages[ap->a_reqpage]->valid != 0) {
-               for (i = 0; i < npages; ++i) {
-                       if (i != ap->a_reqpage) {
-                               vm_page_lock(pages[i]);
-                               vm_page_free(pages[i]);
-                               vm_page_unlock(pages[i]);
-                       }
-               }
-               VM_OBJECT_WUNLOCK(object);
-               return (0);
-       }
+       if (pages[npages - 1]->valid != 0 && --npages == 0)
+               goto out;
        VM_OBJECT_WUNLOCK(object);
 
        /*
         * We use only the kva address for the buffer, but this is extremely
-        * convienient and fast.
+        * convenient and fast.
         */
        bp = getpbuf(&ncl_pbuf_freecnt);
 
@@ -162,6 +151,7 @@
        PCPU_INC(cnt.v_vnodein);
        PCPU_ADD(cnt.v_vnodepgsin, npages);
 
+       count = npages << PAGE_SHIFT;
        iov.iov_base = (caddr_t) kva;
        iov.iov_len = count;
        uio.uio_iov = &iov;
@@ -178,16 +168,7 @@
        relpbuf(bp, &ncl_pbuf_freecnt);
 
        if (error && (uio.uio_resid == count)) {
-               ncl_printf("nfs_getpages: error %d\n", error);
-               VM_OBJECT_WLOCK(object);
-               for (i = 0; i < npages; ++i) {
-                       if (i != ap->a_reqpage) {
-                               vm_page_lock(pages[i]);
-                               vm_page_free(pages[i]);
-                               vm_page_unlock(pages[i]);
-                       }
-               }
-               VM_OBJECT_WUNLOCK(object);
+               printf("ncl_getpages: error %d\n", error);
                return (VM_PAGER_ERROR);
        }
 
@@ -222,7 +203,7 @@
                } else {
                        /*
                         * Read operation was short.  If no error
-                        * occured we may have hit a zero-fill
+                        * occurred we may have hit a zero-fill
                         * section.  We leave valid set to 0, and page
                         * is freed by vm_page_readahead_finish() if
                         * its index is not equal to requested, or
@@ -231,11 +212,14 @@
                         */
                        ;
                }
-               if (i != ap->a_reqpage)
-                       vm_page_readahead_finish(m);
        }
+out:
        VM_OBJECT_WUNLOCK(object);
-       return (0);
+       if (ap->a_rbehind)
+               *ap->a_rbehind = 0;
+       if (ap->a_rahead)
+               *ap->a_rahead = 0;
+       return (VM_PAGER_OK);
 }
 
 /*
@@ -285,7 +269,7 @@
        if (newnfs_directio_enable && !newnfs_directio_allow_mmap &&
            (np->n_flag & NNONCACHE) && (vp->v_type == VREG)) {
                mtx_unlock(&np->n_mtx);
-               ncl_printf("ncl_putpages: called on noncache-able vnode??\n");
+               printf("ncl_putpages: called on noncache-able vnode\n");
                mtx_lock(&np->n_mtx);
        }
 
@@ -304,7 +288,7 @@
 
        /*
         * We use only the kva address for the buffer, but this is extremely
-        * convienient and fast.
+        * convenient and fast.
         */
        bp = getpbuf(&ncl_pbuf_freecnt);
 
@@ -484,7 +468,7 @@
 
            switch (vp->v_type) {
            case VREG:
-               NFSINCRGLOBAL(newnfsstats.biocache_reads);
+               NFSINCRGLOBAL(nfsstatsv1.biocache_reads);
                lbn = uio->uio_offset / biosize;
                on = uio->uio_offset - (lbn * biosize);
 
@@ -561,7 +545,7 @@
                        n = MIN((unsigned)(bcount - on), uio->uio_resid);
                break;
            case VLNK:
-               NFSINCRGLOBAL(newnfsstats.biocache_readlinks);
+               NFSINCRGLOBAL(nfsstatsv1.biocache_readlinks);
                bp = nfs_getcacheblk(vp, (daddr_t)0, NFS_MAXPATHLEN, td);
                if (!bp) {
                        error = newnfs_sigintr(nmp, td);
@@ -581,7 +565,7 @@
                on = 0;
                break;
            case VDIR:
-               NFSINCRGLOBAL(newnfsstats.biocache_readdirs);
+               NFSINCRGLOBAL(nfsstatsv1.biocache_readdirs);
                if (np->n_direofoffset
                    && uio->uio_offset >= np->n_direofoffset) {
                    return (0);
@@ -696,10 +680,10 @@
                        n = np->n_direofoffset - uio->uio_offset;
                break;
            default:
-               ncl_printf(" ncl_bioread: type %x unexpected\n", vp->v_type);
+               printf(" ncl_bioread: type %x unexpected\n", vp->v_type);
                bp = NULL;
                break;
-           };
+           }
 
            if (n > 0) {
                    error = vn_io_fault_uiomove(bp->b_data + on, (int)n, uio);
@@ -876,8 +860,8 @@
        struct vattr vattr;
        struct nfsmount *nmp = VFSTONFS(vp->v_mount);
        daddr_t lbn;
-       int bcount;
-       int bp_cached, n, on, error = 0, error1;
+       int bcount, noncontig_write, obcount;
+       int bp_cached, n, on, error = 0, error1, wouldcommit;
        size_t orig_resid, local_resid;
        off_t orig_size, tmp_off;
 
@@ -921,7 +905,6 @@
                        if (ioflag & IO_NDELAY)
                                return (EAGAIN);
 #endif
-flush_and_restart:
                        np->n_attrstamp = 0;
                        KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
                        error = ncl_vinvalbuf(vp, V_SAVE, td, 1);
@@ -978,27 +961,14 @@
         * IO_UNIT -- we just make all writes atomic anyway, as there's
         * no point optimizing for something that really won't ever happen.
         */
+       wouldcommit = 0;
        if (!(ioflag & IO_SYNC)) {
                int nflag;
 
                mtx_lock(&np->n_mtx);
                nflag = np->n_flag;
                mtx_unlock(&np->n_mtx);
-               int needrestart = 0;
-               if (nmp->nm_wcommitsize < uio->uio_resid) {
-                       /*
-                        * If this request could not possibly be completed
-                        * without exceeding the maximum outstanding write
-                        * commit size, see if we can convert it into a
-                        * synchronous write operation.
-                        */
-                       if (ioflag & IO_NDELAY)
-                               return (EAGAIN);
-                       ioflag |= IO_SYNC;
-                       if (nflag & NMODIFIED)
-                               needrestart = 1;
-               } else if (nflag & NMODIFIED) {
-                       int wouldcommit = 0;
+               if (nflag & NMODIFIED) {
                        BO_LOCK(&vp->v_bufobj);
                        if (vp->v_bufobj.bo_dirty.bv_cnt != 0) {
                                TAILQ_FOREACH(bp, &vp->v_bufobj.bo_dirty.bv_hd,
@@ -1008,28 +978,23 @@
                                }
                        }
                        BO_UNLOCK(&vp->v_bufobj);
-                       /*
-                        * Since we're not operating synchronously and
-                        * bypassing the buffer cache, we are in a commit
-                        * and holding all of these buffers whether
-                        * transmitted or not.  If not limited, this
-                        * will lead to the buffer cache deadlocking,
-                        * as no one else can flush our uncommitted buffers.
-                        */
-                       wouldcommit += uio->uio_resid;
-                       /*
-                        * If we would initially exceed the maximum
-                        * outstanding write commit size, flush and restart.
-                        */
-                       if (wouldcommit > nmp->nm_wcommitsize)
-                               needrestart = 1;
                }
-               if (needrestart)
-                       goto flush_and_restart;
        }
 
        do {
-               NFSINCRGLOBAL(newnfsstats.biocache_writes);
+               if (!(ioflag & IO_SYNC)) {
+                       wouldcommit += biosize;
+                       if (wouldcommit > nmp->nm_wcommitsize) {
+                               np->n_attrstamp = 0;
+                               KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
+                               error = ncl_vinvalbuf(vp, V_SAVE, td, 1);
+                               if (error)
+                                       return (error);
+                               wouldcommit = biosize;
+                       }
+               }
+
+               NFSINCRGLOBAL(nfsstatsv1.biocache_writes);
                lbn = uio->uio_offset / biosize;
                on = uio->uio_offset - (lbn * biosize);
                n = MIN((unsigned)(biosize - on), uio->uio_resid);
@@ -1039,7 +1004,15 @@
                 * unaligned buffer size.
                 */
                mtx_lock(&np->n_mtx);
-               if (uio->uio_offset == np->n_size && n) {
+               if ((np->n_flag & NHASBEENLOCKED) == 0 &&
+                   (nmp->nm_flag & NFSMNT_NONCONTIGWR) != 0)
+                       noncontig_write = 1;
+               else



Home | Main Index | Thread Index | Old Index