Scan all processes for that might be blocked on a lock

This commit is contained in:
Thomas Veerman 2010-04-28 11:54:22 +00:00
parent b65ebdffac
commit f9317dc039

View file

@ -58,6 +58,7 @@ int req; /* either F_SETLK or F_SETLKW */
case SEEK_END: first = f->filp_vno->v_size; break; case SEEK_END: first = f->filp_vno->v_size; break;
default: return(EINVAL); default: return(EINVAL);
} }
/* Check for overflow. */ /* Check for overflow. */
if (((long)flock.l_start > 0) && ((first + flock.l_start) < first)) if (((long)flock.l_start > 0) && ((first + flock.l_start) < first))
return(EINVAL); return(EINVAL);
@ -154,7 +155,7 @@ int req; /* either F_SETLK or F_SETLKW */
if (ltype == F_UNLCK) return(OK); /* unlocked a region with no locks */ if (ltype == F_UNLCK) return(OK); /* unlocked a region with no locks */
/* There is no conflict. If space exists, store new lock in the table. */ /* There is no conflict. If space exists, store new lock in the table. */
if (empty == (struct file_lock *) 0) return(ENOLCK); /* table full */ if (empty == NIL_LOCK) return(ENOLCK); /* table full */
empty->lock_type = ltype; empty->lock_type = ltype;
empty->lock_pid = fp->fp_pid; empty->lock_pid = fp->fp_pid;
empty->lock_vnode = f->filp_vno; empty->lock_vnode = f->filp_vno;
@ -181,7 +182,7 @@ PUBLIC void lock_revive()
struct fproc *fptr; struct fproc *fptr;
for (fptr = &fproc[INIT_PROC_NR + 1]; fptr < &fproc[NR_PROCS]; fptr++){ for (fptr = &fproc[0]; fptr < &fproc[NR_PROCS]; fptr++){
if(fptr->fp_pid == PID_FREE) continue; if(fptr->fp_pid == PID_FREE) continue;
if (fptr->fp_blocked_on == FP_BLOCKED_ON_LOCK) { if (fptr->fp_blocked_on == FP_BLOCKED_ON_LOCK) {
revive(fptr->fp_endpoint, 0); revive(fptr->fp_endpoint, 0);