Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs If we bail out due to an error, we need 'unreser...



details:   https://anonhg.NetBSD.org/src/rev/d5027d48a103
branches:  trunk
changeset: 565137:d5027d48a103
user:      oster <oster%NetBSD.org@localhost>
date:      Tue Mar 30 14:50:46 2004 +0000

description:
If we bail out due to an error, we need 'unreserve' the space that
we'd reserved earlier.

Approved by: yamt

diffstat:

 sys/ufs/lfs/lfs_inode.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 7b05b9f307be -r d5027d48a103 sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Tue Mar 30 13:38:20 2004 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Tue Mar 30 14:50:46 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.82 2004/01/25 18:06:49 hannken Exp $   */
+/*     $NetBSD: lfs_inode.c,v 1.83 2004/03/30 14:50:46 oster Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.82 2004/01/25 18:06:49 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.83 2004/03/30 14:50:46 oster Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -401,6 +401,8 @@
                error = ufs_balloc_range(ovp, length - 1, 1, ap->a_cred,
                                         aflags);
                if (error) {
+                       lfs_reserve(fs, ovp, NULL,
+                                   -btofsb(fs, (2 * NIADDR + 3) << fs->lfs_bshift));
                        goto errout;
                }
                eoz = blkroundup(fs, length);
@@ -409,6 +411,8 @@
                error = VOP_PUTPAGES(ovp, trunc_page(length), round_page(eoz),
                    PGO_CLEANIT | PGO_DEACTIVATE | (aflags ? PGO_SYNCIO : 0));
                if (error) {
+                       lfs_reserve(fs, ovp, NULL,
+                                   -btofsb(fs, (2 * NIADDR + 3) << fs->lfs_bshift));
                        goto errout;
                }
        }



Home | Main Index | Thread Index | Old Index