aboutsummaryrefslogtreecommitdiff
path: root/ufs/sizes.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-08-20 19:06:42 +0000
committerThomas Bushnell <thomas@gnu.org>1997-08-20 19:06:42 +0000
commit7b01458f66d04a90e8497bd60f1baa7eb79b9d6a (patch)
treeb81d77f74bfb35d39e7b3a356ff16067f22cb63a /ufs/sizes.c
parent56c05885be4c655fc18c119dbb87527bf5b9af86 (diff)
downloadhurd-7b01458f66d04a90e8497bd60f1baa7eb79b9d6a.tar.gz
hurd-7b01458f66d04a90e8497bd60f1baa7eb79b9d6a.tar.bz2
hurd-7b01458f66d04a90e8497bd60f1baa7eb79b9d6a.zip
Wed Aug 20 14:34:24 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* dir.c (diskfs_lookup_hard): Cope with error return from diskfs_get_filemap. * sizes.c (diskfs_grow): Likewise. * dir.c (diskfs_dirempty): Cope (poorly) with error return from diskfs_get_filemap. * sizes.c (diskfs_truncate): Likewise. (block_extended): Likewise. * pager.c (diskfs_get_filemap): If pager_create fails, return error to caller.
Diffstat (limited to 'ufs/sizes.c')
-rw-r--r--ufs/sizes.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/ufs/sizes.c b/ufs/sizes.c
index 84c2493d..5c3d12f0 100644
--- a/ufs/sizes.c
+++ b/ufs/sizes.c
@@ -1,5 +1,5 @@
/* File growth and truncation
- Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation
+ Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation
This file is part of the GNU Hurd.
@@ -104,10 +104,14 @@ diskfs_truncate (struct node *np,
pager_change_attributes (upi->p, MAY_CACHE,
MEMORY_OBJECT_COPY_NONE, 1);
obj = diskfs_get_filemap (np, VM_PROT_READ | VM_PROT_WRITE);
- poke_pages (obj, round_page (length), round_page (np->allocsize));
- mach_port_deallocate (mach_task_self (), obj);
- pager_flush_some (upi->p, round_page (length),
- np->allocsize - length, 1);
+ if (obj != MACH_PORT_NULL)
+ {
+ /* XXX should cope with errors from diskfs_get_filemap */
+ poke_pages (obj, round_page (length), round_page (np->allocsize));
+ mach_port_deallocate (mach_task_self (), obj);
+ pager_flush_some (upi->p, round_page (length),
+ np->allocsize - length, 1);
+ }
ports_port_deref (upi->p);
}
@@ -400,6 +404,11 @@ block_extended (struct node *np,
/* Map in this part of the file */
mapobj = diskfs_get_filemap (np, VM_PROT_WRITE | VM_PROT_READ);
+
+ /* XXX Should cope with errors from diskfs_get_filemap and back
+ out the operation here. */
+ assert (mapobj);
+
err = vm_map (mach_task_self (), &mapaddr, round_page (old_size), 0, 1,
mapobj, lbn * sblock->fs_bsize, 0,
VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE, 0);
@@ -477,6 +486,9 @@ diskfs_grow (struct node *np,
/* This reference will ensure that NP->dn->fileinfo stays allocated. */
pagerpt = diskfs_get_filemap (np, VM_PROT_WRITE|VM_PROT_READ);
+ if (pagerpt == MACH_PORT_NULL)
+ return errno;
+
/* The new last block of the file. */
lbn = lblkno (sblock, end - 1);