Date: Mon, 6 Oct 2014 06:20:36 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272596 - head/sys/fs/devfs Message-ID: <201410060620.s966Kaqt078736@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Mon Oct 6 06:20:35 2014 New Revision: 272596 URL: https://svnweb.freebsd.org/changeset/base/272596 Log: devfs: don't take proctree_lock unconditionally in devfs_close MFC after: 1 week Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Mon Oct 6 06:19:54 2014 (r272595) +++ head/sys/fs/devfs/devfs_vnops.c Mon Oct 6 06:20:35 2014 (r272596) @@ -546,19 +546,22 @@ devfs_close(struct vop_close_args *ap) * plus the session), release the reference from the session. */ oldvp = NULL; - sx_xlock(&proctree_lock); if (td && vp == td->td_proc->p_session->s_ttyvp) { - SESS_LOCK(td->td_proc->p_session); - VI_LOCK(vp); - if (count_dev(dev) == 2 && (vp->v_iflag & VI_DOOMED) == 0) { - td->td_proc->p_session->s_ttyvp = NULL; - td->td_proc->p_session->s_ttydp = NULL; - oldvp = vp; + sx_xlock(&proctree_lock); + if (vp == td->td_proc->p_session->s_ttyvp) { + SESS_LOCK(td->td_proc->p_session); + VI_LOCK(vp); + if (count_dev(dev) == 2 && + (vp->v_iflag & VI_DOOMED) == 0) { + td->td_proc->p_session->s_ttyvp = NULL; + td->td_proc->p_session->s_ttydp = NULL; + oldvp = vp; + } + VI_UNLOCK(vp); + SESS_UNLOCK(td->td_proc->p_session); } - VI_UNLOCK(vp); - SESS_UNLOCK(td->td_proc->p_session); + sx_xunlock(&proctree_lock); } - sx_xunlock(&proctree_lock); if (oldvp != NULL) vrele(oldvp); /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410060620.s966Kaqt078736>