Return EIO if a filedescriptor cannot be re-opened after a driver restart.
Select now returns such a filedescriptor as ready (instead of EBADF). Reply before dev_up in FSSIGNON to avoid the problem that a DEV_OPEN request is received by a driver that expects a reply from the FSSIGNON.
This commit is contained in:
parent
c26de9f435
commit
4b1cd8c0ec
5 changed files with 29 additions and 7 deletions
|
@ -807,10 +807,12 @@ printf("VFSdev_up: error sending new driver endpoint. FS_e: %d req_nr: %d\n",
|
||||||
|
|
||||||
minor = ((vp->v_sdev >> MINOR) & BYTE);
|
minor = ((vp->v_sdev >> MINOR) & BYTE);
|
||||||
|
|
||||||
printf("VFS: reopening special %d/%d..\n", maj, minor);
|
printf("vfs:dev_up: reopening special %d/%d..\n", maj, minor);
|
||||||
|
|
||||||
if((r = dev_open(vp->v_sdev, FS_PROC_NR,
|
printf("vfs:dev_up: before dev_open\n");
|
||||||
vp->v_mode & (R_BIT|W_BIT))) != OK) {
|
r = dev_open(vp->v_sdev, FS_PROC_NR, vp->v_mode & (R_BIT|W_BIT));
|
||||||
|
printf("vfs:dev_up: after dev_open: result = %d\n", r);
|
||||||
|
if (r != OK) {
|
||||||
int n;
|
int n;
|
||||||
/* This function will set the fp_filp[]s of processes
|
/* This function will set the fp_filp[]s of processes
|
||||||
* holding that fp to NULL, but _not_ clear
|
* holding that fp to NULL, but _not_ clear
|
||||||
|
|
|
@ -84,6 +84,13 @@ int fild; /* file descriptor */
|
||||||
|
|
||||||
err_code = EBADF;
|
err_code = EBADF;
|
||||||
if (fild < 0 || fild >= OPEN_MAX ) return(NIL_FILP);
|
if (fild < 0 || fild >= OPEN_MAX ) return(NIL_FILP);
|
||||||
|
if (rfp->fp_filp[fild] == NIL_FILP && FD_ISSET(fild, &rfp->fp_filp_inuse))
|
||||||
|
{
|
||||||
|
printf("get_filp2: setting err_code to EIO for proc %d fd %d\n",
|
||||||
|
rfp->fp_endpoint, fild);
|
||||||
|
err_code = EIO; /* The filedes is not there, but is not closed either.
|
||||||
|
*/
|
||||||
|
}
|
||||||
return(rfp->fp_filp[fild]); /* may also be NIL_FILP */
|
return(rfp->fp_filp[fild]); /* may also be NIL_FILP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -550,7 +550,11 @@ PUBLIC int do_svrctl()
|
||||||
* to be up.
|
* to be up.
|
||||||
*/
|
*/
|
||||||
if(fproc[proc_nr_n].fp_execced) {
|
if(fproc[proc_nr_n].fp_execced) {
|
||||||
|
/* Reply before calling dev_up */
|
||||||
|
printf("do_svrctl: replying before dev_up\n");
|
||||||
|
reply(who_e, r);
|
||||||
dev_up(major);
|
dev_up(major);
|
||||||
|
r= SUSPEND;
|
||||||
} else {
|
} else {
|
||||||
dmap[major].dmap_flags |= DMAP_BABY;
|
dmap[major].dmap_flags |= DMAP_BABY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,8 @@ int rw_flag; /* READING or WRITING */
|
||||||
|
|
||||||
if ((f = get_filp(m_in.fd)) == NIL_FILP)
|
if ((f = get_filp(m_in.fd)) == NIL_FILP)
|
||||||
{
|
{
|
||||||
printf("vfs:read_write: returning %d\n", err_code);
|
printf("vfs:read_write: returning %d to endpoint %d\n",
|
||||||
|
err_code, who_e);
|
||||||
return(err_code);
|
return(err_code);
|
||||||
}
|
}
|
||||||
if (((f->filp_mode) & (rw_flag == READING ? R_BIT : W_BIT)) == 0) {
|
if (((f->filp_mode) & (rw_flag == READING ? R_BIT : W_BIT)) == 0) {
|
||||||
|
|
|
@ -278,9 +278,17 @@ PUBLIC int do_select(void)
|
||||||
|
|
||||||
if (!(orig_ops = ops = tab2ops(fd, &selecttab[s])))
|
if (!(orig_ops = ops = tab2ops(fd, &selecttab[s])))
|
||||||
continue;
|
continue;
|
||||||
if (!(filp = selecttab[s].filps[fd] = get_filp(fd))) {
|
filp = selecttab[s].filps[fd] = get_filp(fd);
|
||||||
select_cancel_all(&selecttab[s]);
|
if (filp == NULL) {
|
||||||
return EBADF;
|
if (err_code == EBADF) {
|
||||||
|
select_cancel_all(&selecttab[s]);
|
||||||
|
return EBADF;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* File descriptor is 'ready' to return EIO */
|
||||||
|
printf("vfs:do_select: EIO after driver failure\n");
|
||||||
|
ops2tab(SEL_RD|SEL_WR|SEL_ERR, fd, &selecttab[s]);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(t = 0; t < SEL_FDS; t++) {
|
for(t = 0; t < SEL_FDS; t++) {
|
||||||
|
|
Loading…
Reference in a new issue