If processes are blocked on device drivers (returning SUSPEND),

unblock the processes when the device drivers die.
This commit is contained in:
Ben Gras 2005-10-12 15:01:23 +00:00
parent 87dbfc7dda
commit 2eca6f9374
3 changed files with 24 additions and 2 deletions

View file

@ -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.

View file

@ -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 *
*===========================================================================*/

View file

@ -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) );