. leave out dead code from device.c
. don't loop doing a receive() after sendrec() - chance of recovering is not high, and can lead to receive()ing a notify() (which can't happen in sendrec()), which is terrible . return status from device when DEV_CANCEL is done on a signal; hardcode EAGAIN to become EINTR though
This commit is contained in:
parent
08bb0f7708
commit
82855e9cf5
2 changed files with 10 additions and 51 deletions
|
@ -623,42 +623,7 @@ message *mess_ptr; /* pointer to message for task */
|
|||
|
||||
proc_e = mess_ptr->IO_ENDPT;
|
||||
|
||||
#if DEAD_CODE
|
||||
while ((r = sendrec(task_nr, mess_ptr)) == ELOCKED) {
|
||||
/* sendrec() failed to avoid deadlock. The task 'task_nr' is
|
||||
* trying to send a REVIVE message for an earlier request.
|
||||
* Handle it and go try again.
|
||||
*/
|
||||
if ((r = receive(task_nr, &local_m)) != OK) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we're trying to send a cancel message to a task which has just
|
||||
* sent a completion reply, ignore the reply and abort the cancel
|
||||
* request. The caller will do the revive for the process.
|
||||
*/
|
||||
if (mess_ptr->m_type == CANCEL && local_m.REP_ENDPT == proc_e) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Otherwise it should be a REVIVE. */
|
||||
if (local_m.m_type != REVIVE) {
|
||||
printf(
|
||||
"fs: strange device reply from %d, type = %d, proc = %d (1)\n",
|
||||
local_m.m_source,
|
||||
local_m.m_type, local_m.REP_ENDPT);
|
||||
continue;
|
||||
}
|
||||
|
||||
revive(local_m.REP_ENDPT, local_m.REP_STATUS);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The message received may be a reply to this call, or a REVIVE for some
|
||||
* other process.
|
||||
*/
|
||||
r = sendrec(task_nr, mess_ptr);
|
||||
for(;;) {
|
||||
if (r != OK) {
|
||||
if (r == EDEADSRCDST || r == EDSTDIED || r == ESRCDIED) {
|
||||
printf("fs: dead driver %d\n", task_nr);
|
||||
|
@ -673,22 +638,14 @@ message *mess_ptr; /* pointer to message for task */
|
|||
}
|
||||
|
||||
/* Did the process we did the sendrec() for get a result? */
|
||||
if (mess_ptr->REP_ENDPT == proc_e) {
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
else if (mess_ptr->m_type == REVIVE) {
|
||||
/* Otherwise it should be a REVIVE. */
|
||||
revive(mess_ptr->REP_ENDPT, mess_ptr->REP_STATUS);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
if (mess_ptr->REP_ENDPT != proc_e) {
|
||||
printf(
|
||||
"fs: strange device reply from %d, type = %d, proc = %d (2) ignored\n",
|
||||
"fs: strange device reply from %d, type = %d, proc = %d (not %d) (2) ignored\n",
|
||||
mess_ptr->m_source,
|
||||
mess_ptr->m_type, mess_ptr->REP_ENDPT);
|
||||
}
|
||||
r = receive(task_nr, mess_ptr);
|
||||
mess_ptr->m_type,
|
||||
proc_e,
|
||||
mess_ptr->REP_ENDPT);
|
||||
return EIO;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
|
|
@ -363,7 +363,7 @@ int proc_nr_e;
|
|||
*/
|
||||
|
||||
register struct fproc *rfp;
|
||||
int proc_nr_p, task, fild;
|
||||
int proc_nr_p, task, fild, status = EINTR;
|
||||
struct filp *f;
|
||||
dev_t dev;
|
||||
message mess;
|
||||
|
@ -408,6 +408,8 @@ int proc_nr_e;
|
|||
mess.m_type = CANCEL;
|
||||
fp = rfp; /* hack - ctty_io uses fp */
|
||||
(*dmap[(dev >> MAJOR) & BYTE].dmap_io)(task, &mess);
|
||||
status = mess.REP_STATUS;
|
||||
if(status == EAGAIN) status = EINTR;
|
||||
if(GRANT_VALID(rfp->fp_grant)) {
|
||||
if(cpf_revoke(rfp->fp_grant)) {
|
||||
panic(__FILE__,"FS: revoke failed for grant (cancel)",
|
||||
|
@ -418,7 +420,7 @@ int proc_nr_e;
|
|||
}
|
||||
|
||||
rfp->fp_suspended = NOT_SUSPENDED;
|
||||
reply(proc_nr_e, EINTR); /* signal interrupted call */
|
||||
reply(proc_nr_e, status); /* signal interrupted call */
|
||||
return(OK);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue