diff -Naur -X exclude-files ac_cur/arch/um/drivers/ubd.c ac/arch/um/drivers/ubd.c --- ac_cur/arch/um/drivers/ubd.c Sat Sep 15 15:56:11 2001 +++ ac/arch/um/drivers/ubd.c Sat Sep 15 20:46:38 2001 @@ -286,10 +286,14 @@ #error end_request needs some locking #endif -static void ubd_finish(void) +static void ubd_finish(int error) { int nsect; + if(error){ + end_request(0); + return; + } nsect = CURRENT->current_nr_sectors; CURRENT->sector += nsect; CURRENT->buffer += nsect << 9; @@ -308,6 +312,7 @@ if(read_ubd_fs(thread_fds[0], &req, sizeof(req)) != sizeof(req)){ printk("Pid %d - spurious interrupt in ubd_handler, " "errno = %d\n", getpid(), errno); + end_request(0); return; } @@ -315,7 +320,7 @@ (req.length != (CURRENT->current_nr_sectors) << 9)) panic("I/O op mismatch"); - ubd_finish(); + ubd_finish(req.error); reactivate_fd(thread_fds[0]); if (!QUEUE_EMPTY) do_ubd_request(NULL); } @@ -615,7 +620,7 @@ static void do_one_request(void) { struct io_thread_req req; - int block, nsect, dev, n; + int block, nsect, dev, n, err; if(CURRENT->rq_status == RQ_INACTIVE) return; if (DEVICE_INTR) return; @@ -651,12 +656,13 @@ req.bitmap = ubd_dev[dev].cow.bitmap; req.bitmap_start = -1; req.bitmap_end = -1; + req.error = 0; if(ubd_dev[dev].cow.file != NULL) cowify_req(&req, &ubd_dev[dev]); if(thread_fds[0] == -1){ - do_io(&req); - ubd_finish(); + err = do_io(&req); + ubd_finish(err); } else { SET_INTR(ubd_handler); diff -Naur -X exclude-files ac_cur/arch/um/drivers/ubd_user.c ac/arch/um/drivers/ubd_user.c --- ac_cur/arch/um/drivers/ubd_user.c Sat Sep 15 15:56:11 2001 +++ ac/arch/um/drivers/ubd_user.c Sat Sep 15 20:46:38 2001 @@ -110,6 +110,52 @@ return(0); } +static int absolutize(char *to, int size, char *from) +{ + char save_cwd[256], *slash; + int remaining; + + if(getcwd(save_cwd, sizeof(save_cwd)) == NULL) { + printk("absolutize : unable to get cwd - errno = %d\n", errno); + return(-1); + } + slash = strrchr(from, '/'); + if(slash != NULL){ + *slash = '\0'; + if(chdir(from)){ + *slash = '/'; + printk("absolutize : Can't cd to '%s' - errno = %d\n", + from, errno); + return(-1); + } + *slash = '/'; + if(getcwd(to, size) == NULL){ + printk("absolutize : unable to get cwd of '%s' - " + "errno = %d\n", from, errno); + return(-1); + } + remaining = size - strlen(to); + if(strlen(slash) + 1 > remaining){ + printk("absolutize : unable to fit '%s' into %d " + "chars\n", from, size); + return(-1); + } + strcat(to, slash); + } + else { + if(strlen(save_cwd) + 1 + strlen(from) + 1 > size){ + printk("absolutize : unable to fit '%s' into %d " + "chars\n", from, size); + return(-1); + } + strcpy(to, save_cwd); + strcat(to, "/"); + strcat(to, from); + } + chdir(save_cwd); + return(0); +} + int create_cow_file(char *cow_file, char *backing_file, int sectorsize, int *bitmap_len_out, int *data_offset_out) { @@ -133,7 +179,10 @@ sizeof(header.backing_file) - 1); goto error; } - strcpy(header.backing_file, backing_file); + + if(absolutize(header.backing_file, sizeof(header.backing_file), + backing_file)) + goto error; err = stat64(header.backing_file, &buf); if(err < 0) goto error; @@ -270,7 +319,7 @@ continue; } io_count++; - do_io(&req); + if(do_io(&req)) req.error = 1; if(write(kernel_fds[1], &req, sizeof(req)) != sizeof(req)) printk("io_thread - write failed, errno = %d\n", errno); diff -Naur -X exclude-files ac_cur/arch/um/include/ubd_user.h ac/arch/um/include/ubd_user.h --- ac_cur/arch/um/include/ubd_user.h Sat Sep 15 15:56:11 2001 +++ ac/arch/um/include/ubd_user.h Sat Sep 15 20:46:38 2001 @@ -20,6 +20,7 @@ unsigned long *bitmap; unsigned long bitmap_start; unsigned long bitmap_end; + int error; }; extern int open_ubd_file(char *file, int *openflags, char **backing_file_out, diff -Naur -X exclude-files ac_cur/arch/um/kernel/process_kern.c ac/arch/um/kernel/process_kern.c --- ac_cur/arch/um/kernel/process_kern.c Sat Sep 15 20:06:04 2001 +++ ac/arch/um/kernel/process_kern.c Sat Sep 15 20:46:38 2001 @@ -518,6 +518,7 @@ void finish_fork_handler(int sig) { init_flush_vm(); + flush_tlb_kernel_vm(); check_brk(brk_start); if(current->mm != current->p_pptr->mm) protect(physmem, high_physmem - physmem, 1, 1, 0); diff -Naur -X exclude-files ac_cur/arch/um/kernel/signal_user.c ac/arch/um/kernel/signal_user.c --- ac_cur/arch/um/kernel/signal_user.c Sat Sep 15 15:56:11 2001 +++ ac/arch/um/kernel/signal_user.c Sat Sep 15 20:46:38 2001 @@ -5,6 +5,7 @@ #include #include +#include #include "user_util.h" #include "user.h" @@ -24,7 +25,7 @@ } sigaddset(&mask, SIGIO); if(sigprocmask(type, &mask, NULL) < 0) - panic("Failed to change signal mask"); + panic("Failed to change signal mask - errno = %d", errno); } void block_signals(void) diff -Naur -X exclude-files ac_cur/arch/um/kernel/tlb.c ac/arch/um/kernel/tlb.c --- ac_cur/arch/um/kernel/tlb.c Sat Sep 15 16:59:26 2001 +++ ac/arch/um/kernel/tlb.c Sat Sep 15 20:46:38 2001 @@ -83,15 +83,16 @@ } } if(force || !pte_present(*npte) || pte_newpage(*npte)){ - munmap((void *) addr, PAGE_SIZE); + if(munmap((void *) addr, PAGE_SIZE) < 0) + panic("munmap failed, errno = %d\n", + errno); if(pte_present(*npte)) map(addr, pte_address(*npte), PAGE_SIZE, r, w, x); } else if(pte_newprot(*npte)) protect(addr, PAGE_SIZE, r, w, x); - if((mm == proc_mm) && pte_present(*npte)) - *npte = pte_mkuptodate(*npte); + if(mm == proc_mm) *npte = pte_mkuptodate(*npte); addr += PAGE_SIZE; } else { @@ -100,9 +101,10 @@ end = (addr + PMD_SIZE) & PMD_MASK; len = end - addr; if(force || pmd_newpage(*npmd)){ - munmap((void *) addr, len); - if(mm == proc_mm) - pmd_mkuptodate(*npmd); + if(munmap((void *) addr, len) < 0) + panic("munmap failed, errno = %d\n", + errno); + if(mm == proc_mm) pmd_mkuptodate(*npmd); } addr += len; } @@ -166,6 +168,7 @@ { if(current->mm != NULL) fix_range(current->mm, 0, STACK_TOP, 0); else fix_range(NULL, start_vm, end_vm, 0); + } void flush_tlb_page(struct vm_area_struct *vma, unsigned long address)