Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/miscfs/fdesc From Bill Studenmund: unlock the fdescfs "/...



details:   https://anonhg.NetBSD.org/src/rev/9845d4d96e81
branches:  trunk
changeset: 474773:9845d4d96e81
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jul 19 23:00:47 1999 +0000

description:
>From Bill Studenmund: unlock the fdescfs "/dev/tty" vnode before calling
cttyread()/cttywrite(), and lock it again when it returns.

Squashes the somewhat bizarre lossage I was observing w/ more(1), sudo(1),
etc.

diffstat:

 sys/miscfs/fdesc/fdesc_vnops.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r e0f1707ac781 -r 9845d4d96e81 sys/miscfs/fdesc/fdesc_vnops.c
--- a/sys/miscfs/fdesc/fdesc_vnops.c    Mon Jul 19 19:42:27 1999 +0000
+++ b/sys/miscfs/fdesc/fdesc_vnops.c    Mon Jul 19 23:00:47 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdesc_vnops.c,v 1.48 1999/07/08 01:26:26 wrstuden Exp $        */
+/*     $NetBSD: fdesc_vnops.c,v 1.49 1999/07/19 23:00:47 thorpej Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -826,10 +826,13 @@
                struct ucred *a_cred;
        } */ *ap = v;
        int error = EOPNOTSUPP;
+       struct vnode *vp = ap->a_vp;
 
-       switch (VTOFDESC(ap->a_vp)->fd_type) {
+       switch (VTOFDESC(vp)->fd_type) {
        case Fctty:
+               VOP_UNLOCK(vp, 0);
                error = cttyread(devctty, ap->a_uio, ap->a_ioflag);
+               vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
                break;
 
        default:
@@ -851,10 +854,13 @@
                struct ucred *a_cred;
        } */ *ap = v;
        int error = EOPNOTSUPP;
+       struct vnode *vp = ap->a_vp;
 
-       switch (VTOFDESC(ap->a_vp)->fd_type) {
+       switch (VTOFDESC(vp)->fd_type) {
        case Fctty:
+               VOP_UNLOCK(vp, 0);
                error = cttywrite(devctty, ap->a_uio, ap->a_ioflag);
+               vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
                break;
 
        default:



Home | Main Index | Thread Index | Old Index