Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpvfs Don't loop eternally if uiomove() f...



details:   https://anonhg.NetBSD.org/src/rev/1e7def50e11a
branches:  trunk
changeset: 759865:1e7def50e11a
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Dec 18 11:45:09 2010 +0000

description:
Don't loop eternally if uiomove() fails eternally (e.g. because
the connection to the client has been severed).

diffstat:

 sys/rump/librump/rumpvfs/vm_vfs.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 82476bc2c2a1 -r 1e7def50e11a sys/rump/librump/rumpvfs/vm_vfs.c
--- a/sys/rump/librump/rumpvfs/vm_vfs.c Sat Dec 18 09:44:41 2010 +0000
+++ b/sys/rump/librump/rumpvfs/vm_vfs.c Sat Dec 18 11:45:09 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_vfs.c,v 1.23 2010/09/09 12:18:39 pooka Exp $        */
+/*     $NetBSD: vm_vfs.c,v 1.24 2010/12/18 11:45:09 pooka Exp $        */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.23 2010/09/09 12:18:39 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.24 2010/12/18 11:45:09 pooka Exp $");
 
 #include <sys/param.h>
 
@@ -195,8 +195,14 @@
                        pageoff = uio->uio_offset & PAGE_MASK;
                        xfersize = MIN(MIN(todo, PAGE_SIZE), PAGE_SIZE-pageoff);
                        KASSERT(xfersize > 0);
-                       uiomove((uint8_t *)pg->uanon + pageoff,
+                       rv = uiomove((uint8_t *)pg->uanon + pageoff,
                            xfersize, uio);
+                       if (rv) {
+                               mutex_enter(&uobj->vmobjlock);
+                               uvm_page_unbusy(pgs, npages);
+                               mutex_exit(&uobj->vmobjlock);
+                               goto out;
+                       }
                        if (uio->uio_rw == UIO_WRITE)
                                pg->flags &= ~(PG_CLEAN | PG_FAKE);
                        todo -= xfersize;



Home | Main Index | Thread Index | Old Index