$NetBSD: patch-aq,v 1.1 2000/08/22 15:08:45 wennmach Exp $ Avoid deadlock situation. From arla-current via Assar and Love. Index: xfs_dev-common.c =================================================================== RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/xfs/bsd/xfs_dev-common.c,v retrieving revision 1.39 diff -u -w -u -w -r1.39 xfs_dev-common.c --- xfs/bsd/xfs_dev-common.c 2000/07/17 16:23:47 1.39 +++ xfs/bsd/xfs_dev-common.c 2000/08/20 04:25:33 @@ -383,12 +386,19 @@ sigset_t oldsigmask; #endif /* HAVE_STRUCT_PROC_P_SIGMASK */ int catch; - struct proc *proc = xfs_curproc (); XFSDEB(XDEBMSG, ("xfs_message_rpc opcode = %d\n", message->opcode)); + if (proc == NULL) + proc = xfs_curproc(); + if (!(chan->status & CHANNEL_OPENED)) /* No receiver? */ return ENODEV; + + if (proc->p_pid == chan->proc->p_pid) { + printf("xfs_message_rpc: deadlock avoided\n"); + return EDEADLK; + } if (size < sizeof(struct xfs_message_wakeup)) { printf("XFS PANIC Error: Message to small to receive wakeup, opcode = %d\n", message->opcode);