diff options
-rw-r--r-- | ext2fs/ChangeLog | 11 | ||||
-rw-r--r-- | ext2fs/dir.c | 10 | ||||
-rw-r--r-- | ext2fs/pager.c | 8 | ||||
-rw-r--r-- | ext2fs/truncate.c | 14 |
4 files changed, 38 insertions, 5 deletions
diff --git a/ext2fs/ChangeLog b/ext2fs/ChangeLog index 8b4c5c41..4fc3ed59 100644 --- a/ext2fs/ChangeLog +++ b/ext2fs/ChangeLog @@ -1,3 +1,14 @@ +Wed Aug 20 14:28:00 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> + + * dir.c (diskfs_lookup_hard): Cope with error return from + diskfs_get_filemap. + (diskfs_dirempty): Cope (poorly) with error return from + diskfs_get_filemap. + * truncate.c (force_delayed_copies): Likewise. + + * pager.c (diskfs_get_filemap): If pager_create fails, return + error to caller. + Mon Jun 30 17:34:27 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * ext2fs.c (diskfs_readonly): Delete variable definition. diff --git a/ext2fs/dir.c b/ext2fs/dir.c index a31df4e2..f1ea285c 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -1,6 +1,6 @@ /* Directory management routines - Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. Converted for ext2fs by Miles Bader <miles@gnu.ai.mit.edu> @@ -153,6 +153,10 @@ diskfs_lookup_hard (struct node *dp, char *name, enum lookup_type type, /* Map in the directory contents. */ memobj = diskfs_get_filemap (dp, prot); + + if (memobj == MACH_PORT_NULL) + return errno; + buf = 0; /* We allow extra space in case we have to do an EXTEND. */ buflen = round_page (dp->dn_stat.st_size + DIRBLKSIZ); @@ -716,6 +720,10 @@ diskfs_dirempty (struct node *dp, struct protid *cred) int hit = 0; /* Found something in the directory. */ memory_object_t memobj = diskfs_get_filemap (dp, VM_PROT_READ); + if (memobj == MACH_PORT_NULL) + /* XXX should reflect error properly. */ + return 0; + err = vm_map (mach_task_self (), &buf, dp->dn_stat.st_size, 0, 1, memobj, 0, 0, VM_PROT_READ, VM_PROT_READ, 0); mach_port_deallocate (mach_task_self (), memobj); diff --git a/ext2fs/pager.c b/ext2fs/pager.c index 61f775c4..1b515bca 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -801,6 +801,14 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot) node->dn->pager = pager_create (upi, pager_bucket, MAY_CACHE, MEMORY_OBJECT_COPY_DELAY); + if (node->dn->pager == 0) + { + diskfs_nrele_light (node); + free (upi); + spin_unlock (&node_to_page_lock); + return MACH_PORT_NULL; + } + right = pager_get_port (node->dn->pager); ports_port_deref (node->dn->pager); } diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c index 63cc7340..5dc59638 100644 --- a/ext2fs/truncate.c +++ b/ext2fs/truncate.c @@ -1,6 +1,6 @@ /* File truncation - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -233,9 +233,15 @@ force_delayed_copies (struct node *node, off_t length) pager_change_attributes (pager, MAY_CACHE, MEMORY_OBJECT_COPY_NONE, 1); obj = diskfs_get_filemap (node, VM_PROT_READ); - poke_pages (obj, round_page (length), round_page (node->allocsize)); - mach_port_deallocate (mach_task_self (), obj); - pager_flush_some (pager, round_page(length), node->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 (node->allocsize)); + mach_port_deallocate (mach_task_self (), obj); + pager_flush_some (pager, round_page(length), + node->allocsize - length, 1); + } + ports_port_deref (pager); } } |