diff --git a/servers/fs/misc.c b/servers/fs/misc.c index 5841a4d05..5bfbf1d56 100644 --- a/servers/fs/misc.c +++ b/servers/fs/misc.c @@ -339,8 +339,11 @@ PUBLIC int do_exit() fp->fp_rootdir = NIL_INODE; fp->fp_workdir = NIL_INODE; - /* If a driver exits, unmap its entries in the dmap table. */ + /* If a driver exits, unmap its entries in the dmap table. + * Also check if any process is SUSPENDed on it. + */ dmap_unmap_by_proc(exitee); + unsuspend_by_proc(exitee); /* If a session leader exits then revoke access to its controlling tty from * all other processes using it. diff --git a/servers/fs/pipe.c b/servers/fs/pipe.c index bb9f9341c..ec9855f51 100644 --- a/servers/fs/pipe.c +++ b/servers/fs/pipe.c @@ -194,6 +194,25 @@ int task; /* who is proc waiting for? (PIPE = pipe) */ } } +/*===========================================================================* + * unsuspend_by_proc * + *===========================================================================*/ +void unsuspend_by_proc(int proc) +{ + struct fproc *rp; + int client = 0; + + /* Revive processes waiting for drivers (SUSPENDed) that have + * disappeared with return code EIO. + */ + for (rp = &fproc[0]; rp < &fproc[NR_PROCS]; rp++, client++) + if(rp->fp_suspended == SUSPENDED && rp->fp_task == -proc) + revive(client, EIO); + + return; +} + + /*===========================================================================* * release * *===========================================================================*/ diff --git a/servers/fs/proto.h b/servers/fs/proto.h index f41315cbb..474880e32 100644 --- a/servers/fs/proto.h +++ b/servers/fs/proto.h @@ -15,7 +15,6 @@ _PROTOTYPE( void free_zone, (Dev_t dev, zone_t numb) ); _PROTOTYPE( struct buf *get_block, (Dev_t dev, block_t block,int only_search)); _PROTOTYPE( void invalidate, (Dev_t device) ); _PROTOTYPE( void put_block, (struct buf *bp, int block_type) ); -_PROTOTYPE( void rw_block, (struct buf *bp, int rw_flag) ); _PROTOTYPE( void rw_scattered, (Dev_t dev, struct buf **bufq, int bufqsize, int rw_flag) ); @@ -127,6 +126,7 @@ _PROTOTYPE( void suspend, (int task) ); _PROTOTYPE( int select_request_pipe, (struct filp *f, int *ops, int bl) ); _PROTOTYPE( int select_cancel_pipe, (struct filp *f) ); _PROTOTYPE( int select_match_pipe, (struct filp *f) ); +_PROTOTYPE( void unsuspend_by_proc, (int) ); /* protect.c */ _PROTOTYPE( int do_access, (void) );