Module Name:    src
Committed By:   njoly
Date:           Sun Mar 16 10:16:15 UTC 2014

Modified Files:
        src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
When trying to extend a file, don't wait until the underlying memory
allocation succeed. Return ENOSPC upon failure.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/rump/librump/rumpvfs/rumpfs.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/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.125 src/sys/rump/librump/rumpvfs/rumpfs.c:1.126
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.125	Mon Feb 24 11:43:33 2014
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Sun Mar 16 10:16:15 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.125 2014/02/24 11:43:33 pooka Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.126 2014/03/16 10:16:15 njoly Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.125 2014/02/24 11:43:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.126 2014/03/16 10:16:15 njoly Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -971,7 +971,9 @@ rump_vop_setattr(void *v)
 		size_t copylen, newlen;
 
 		newlen = vap->va_size;
-		newdata = rump_hypermalloc(newlen, 0, true, "rumpfs");
+		newdata = rump_hypermalloc(newlen, 0, false, "rumpfs");
+		if (newdata == NULL)
+			return ENOSPC;
 
 		copylen = MIN(rn->rn_dlen, newlen);
 		memset(newdata, 0, newlen);
@@ -1465,7 +1467,9 @@ rump_vop_write(void *v)
 		oldlen = rn->rn_dlen;
 		olddata = rn->rn_data;
 
-		rn->rn_data = rump_hypermalloc(newlen, 0, true, "rumpfs");
+		rn->rn_data = rump_hypermalloc(newlen, 0, false, "rumpfs");
+		if (rn->rn_data == NULL)
+			return ENOSPC;
 		rn->rn_dlen = newlen;
 		memset(rn->rn_data, 0, newlen);
 		memcpy(rn->rn_data, olddata, oldlen);

Reply via email to