From 6c312d1a9ddc52c7515669f3dbb1595816748725 Mon Sep 17 00:00:00 2001 From: wennmach Date: Tue, 22 Aug 2000 15:08:38 +0000 Subject: Added three patches to deal with a potential deadlock situation, which may arise when writing back data from a vnode failed because the ticket expired in the meantime. From arla-current, thanks to Assar Westerlund and Love. --- net/arla/patches/patch-ao | 44 +++++++ net/arla/patches/patch-ap | 283 ++++++++++++++++++++++++++++++++++++++++++++++ net/arla/patches/patch-aq | 34 ++++++ 3 files changed, 361 insertions(+) create mode 100644 net/arla/patches/patch-ao create mode 100644 net/arla/patches/patch-ap create mode 100644 net/arla/patches/patch-aq (limited to 'net/arla/patches') diff --git a/net/arla/patches/patch-ao b/net/arla/patches/patch-ao new file mode 100644 index 00000000000..0daa46d65f9 --- /dev/null +++ b/net/arla/patches/patch-ao @@ -0,0 +1,44 @@ +$NetBSD: patch-ao,v 1.1 2000/08/22 15:08:45 wennmach Exp $ + +Deal with a potential deadlock situation, which may arise when writing back +data from a vnode failed because the ticket expired in the meantime. +From arla-current, thanks to Assar and Love. + +Index: xfs_vnodeops-common.c +=================================================================== +RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/xfs/bsd/xfs_vnodeops-common.c,v +retrieving revision 1.58 +diff -u -w -u -w -r1.58 xfs_vnodeops-common.c +--- xfs/bsd/xfs_vnodeops-common.c 2000/08/02 00:58:09 1.58 ++++ xfs/bsd/xfs_vnodeops-common.c 2000/08/17 00:30:23 +@@ -260,8 +260,17 @@ + return 0; + } + +- if (xn->flags & XFS_DATA_DIRTY) ++ if (xn->flags & XFS_DATA_DIRTY) { ++#ifdef FSYNC_RECLAIM ++ /* writing back the data from this vnode failed */ ++ if (waitfor & FSYNC_RECLAIM) { ++ printf("xfs_fsync: data lost, failed to write back\n"); ++ xn->flags &= ~XFS_DATA_DIRTY; ++ return 0; ++ } ++#endif + error = do_fsync(xfsp, xn, cred, proc, XFS_WRITE | XFS_FSYNC); ++ } + + return error; + } +@@ -907,8 +916,9 @@ + /* xn->cred not set -> NOCRED */ + + error = xfs_fsync_common(vp, xn->cred, /* XXX */ 0, p); +- if (error) +- XFSDEB(XDEBVNOPS, ("xfs_inactive: fsync failed: %d\n", error)); ++ if (error) { ++ printf ("xfs_inactive: failed writing back data: %d\n", error); ++ } + + #ifndef __osf__ + xfs_vfs_unlock(vp, p); diff --git a/net/arla/patches/patch-ap b/net/arla/patches/patch-ap new file mode 100644 index 00000000000..ef938da51a8 --- /dev/null +++ b/net/arla/patches/patch-ap @@ -0,0 +1,283 @@ +$NetBSD: patch-ap,v 1.1 2000/08/22 15:08:45 wennmach Exp $ + +Avoid deadlock situation. +From arla-current via Assar and Love. + +Index: xfs_dev-bsd.c +=================================================================== +RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/xfs/bsd/xfs_dev-bsd.c,v +retrieving revision 1.24 +diff -u -w -r1.24 xfs_dev-bsd.c +--- xfs/bsd/xfs_dev-bsd.c 2000/07/22 03:59:04 1.24 ++++ xfs/bsd/xfs_dev-bsd.c 2000/08/19 10:16:51 +@@ -50,7 +50,7 @@ + { + XFSDEB(XDEBDEV, ("xfsopen dev = %d.%d, flag = %d, devtype = %d\n", + major(dev), minor(dev), flag, devtype)); +- return xfs_devopen_common(dev); ++ return xfs_devopen_common(dev, proc); + } + + int +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 -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/19 10:27:35 +@@ -92,7 +92,7 @@ + * Only allow one open. + */ + int +-xfs_devopen_common(dev_t dev) ++xfs_devopen_common(dev_t dev, struct proc *p) + { + struct xfs_channel *chan; + +@@ -105,8 +105,10 @@ + if (chan->status & CHANNEL_OPENED) { + XFSDEB(XDEBDEV, ("xfs_devopen: already open\n")); + return EBUSY; +- } else ++ } else { + chan->status |= CHANNEL_OPENED; ++ chan->proc = p; ++ } + + chan->message_buffer = xfs_alloc(MAX_XMSG_SIZE); + +@@ -372,7 +374,8 @@ + */ + + int +-xfs_message_rpc(int fd, struct xfs_message_header * message, u_int size) ++xfs_message_rpc(int fd, struct xfs_message_header * message, u_int size, ++ struct proc *proc) + { + int ret; + struct xfs_channel *chan = &xfs_channel[fd]; +Index: xfs_dev-osf.c +=================================================================== +RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/xfs/bsd/xfs_dev-osf.c,v +retrieving revision 1.7 +diff -u -w -r1.7 xfs_dev-osf.c +--- xfs/bsd/xfs_dev-osf.c 2000/03/18 00:51:40 1.7 ++++ xfs/bsd/xfs_dev-osf.c 2000/08/19 10:17:25 +@@ -51,7 +51,7 @@ + { + XFSDEB(XDEBDEV, ("xfsopen dev = %d.%d, flag = %d, format = %d\n", + major(dev), minor(dev), flag, format)); +- return xfs_devopen_common(dev); ++ return xfs_devopen_common(dev, u.u_procp); + } + + static int +Index: xfs_syscalls-common.c +=================================================================== +RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/xfs/bsd/xfs_syscalls-common.c,v +retrieving revision 1.51 +diff -u -w -r1.51 xfs_syscalls-common.c +--- xfs/bsd/xfs_syscalls-common.c 2000/08/02 00:06:16 1.51 ++++ xfs/bsd/xfs_syscalls-common.c 2000/08/19 10:23:15 +@@ -462,7 +462,7 @@ + msg.cred.uid = xfs_proc_to_ruid(p); + msg.cred.pag = xfs_get_pag(xfs_proc_to_cred(p)); + +- error = xfs_message_rpc(0, &msg.header, sizeof(msg)); /* XXX */ ++ error = xfs_message_rpc(0, &msg.header, sizeof(msg), p); /* XXX */ + msg2 = (struct xfs_message_wakeup_data *) &msg; + + if (error == 0) +Index: xfs_vfsops-common.c +=================================================================== +RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/xfs/bsd/xfs_vfsops-common.c,v +retrieving revision 1.27 +diff -u -w -r1.27 xfs_vfsops-common.c +--- xfs/bsd/xfs_vfsops-common.c 2000/08/01 20:36:56 1.27 ++++ xfs/bsd/xfs_vfsops-common.c 2000/08/19 10:23:23 +@@ -240,7 +240,7 @@ + msg.header.opcode = XFS_MSG_GETROOT; + msg.cred.uid = cred->cr_uid; + msg.cred.pag = xfs_get_pag(cred); +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), proc); + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; + } while (error == 0); +Index: xfs_vnodeops-common.c +=================================================================== +RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/xfs/bsd/xfs_vnodeops-common.c,v +retrieving revision 1.59 +diff -u -w -r1.59 xfs_vnodeops-common.c +--- xfs/bsd/xfs_vnodeops-common.c 2000/08/17 00:38:36 1.59 ++++ xfs/bsd/xfs_vnodeops-common.c 2000/08/19 10:28:19 +@@ -71,7 +71,7 @@ + msg.handle = xn->handle; + msg.tokens = tok; + +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; +@@ -103,7 +103,7 @@ + msg.cred.uid = cred->cr_uid; + msg.cred.pag = pag; + msg.handle = xn->handle; +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; + } else { +@@ -132,7 +132,7 @@ + msg.cred.uid = cred->cr_uid; + msg.cred.pag = pag; + msg.handle = xn->handle; +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; + } else { +@@ -163,7 +163,7 @@ + msg.handle = xn->handle; + msg.tokens = tok; + +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; +@@ -229,7 +229,7 @@ + vattr2xfs_attr(&xn->attr, &msg.attr); + msg.flag = flag; + +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; +@@ -432,7 +432,7 @@ + } + + XFS_TOKEN_CLEAR(xn, XFS_ATTR_VALID, XFS_ATTR_MASK); +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; + } +@@ -552,7 +552,7 @@ + bcopy(cnp->cn_nameptr, msg.name, cnp->cn_namelen); + msg.name[cnp->cn_namelen] = '\0'; + +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), proc); + + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; +@@ -603,7 +603,7 @@ + } + + +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; +@@ -637,7 +637,7 @@ + msg.cred.uid = cred->cr_uid; + msg.cred.pag = xfs_get_pag(cred); + +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + if (error == 0) + error = ((struct xfs_message_wakeup *) &msg)->error; + +@@ -685,7 +685,7 @@ + strncpy(msg.new_name, tname, 256); + msg.cred.uid = cred->cr_uid; + msg.cred.pag = xfs_get_pag(cred); +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + if (error == 0) + error = ((struct xfs_message_wakeup *) &msg)->error; + +@@ -722,7 +722,7 @@ + msg.cred.uid = 0; + msg.cred.pag = XFS_ANONYMOUSID; + } +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; + } +@@ -749,7 +749,7 @@ + strncpy(msg.name, name, 256); + msg.cred.uid = cred->cr_uid; + msg.cred.pag = xfs_get_pag(cred); +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + if (error == 0) + error = ((struct xfs_message_wakeup *) &msg)->error; + +@@ -823,7 +823,7 @@ + msg.cred.uid = cred->cr_uid; + msg.cred.pag = xfs_get_pag(cred); + +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; + +@@ -857,7 +857,7 @@ + strncpy (msg.contents, target, sizeof(msg.contents)); + msg.contents[sizeof(msg.contents) - 1] = '\0'; + +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), proc); + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; + +@@ -998,7 +998,7 @@ + msg.cred.uid = 0; + msg.cred.pag = XFS_ANONYMOUSID; + } +- error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg)); ++ error = xfs_message_rpc(xfsp->fd, &msg.header, sizeof(msg), p); + if (error == 0) + error = ((struct xfs_message_wakeup *) & msg)->error; + } +Index: xfs/xfs_dev.h +=================================================================== +RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/xfs/bsd/xfs/xfs_dev.h,v +retrieving revision 1.13 +diff -u -w -r1.13 xfs_dev.h +--- xfs/bsd/xfs/xfs_dev.h 2000/04/02 21:28:24 1.13 ++++ xfs/bsd/xfs/xfs_dev.h 2000/08/19 10:26:53 +@@ -68,6 +68,7 @@ + int status; + #define CHANNEL_OPENED 0x1 + #define CHANNEL_WAITING 0x2 ++ struct proc *proc; + }; + + extern struct xfs_channel xfs_channel[NXFS]; +@@ -108,7 +109,7 @@ + xfs_outq(struct xfs_link *p); + + int +-xfs_devopen_common(dev_t dev); ++xfs_devopen_common(dev_t dev, struct proc *); + + #ifndef __osf__ /* XXX - we should do the same for osf */ + int xfs_devopen(dev_t dev, int flag, int devtype, struct proc *proc); +@@ -131,7 +132,8 @@ + xfs_message_send(int fd, struct xfs_message_header * message, u_int size); + + int +-xfs_message_rpc(int fd, struct xfs_message_header * message, u_int size); ++xfs_message_rpc(int fd, struct xfs_message_header * message, u_int size, ++ struct proc *p); + + int + xfs_message_receive(int fd, diff --git a/net/arla/patches/patch-aq b/net/arla/patches/patch-aq new file mode 100644 index 00000000000..0f1499848a7 --- /dev/null +++ b/net/arla/patches/patch-aq @@ -0,0 +1,34 @@ +$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); + -- cgit v1.2.3