From owner-p4-projects@FreeBSD.ORG Fri Oct 14 23:41:14 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 37B7C16A421; Fri, 14 Oct 2005 23:41:14 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1110C16A41F for ; Fri, 14 Oct 2005 23:41:14 +0000 (GMT) (envelope-from soc-chenk@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A477043D46 for ; Fri, 14 Oct 2005 23:41:13 +0000 (GMT) (envelope-from soc-chenk@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j9ENfDpq098093 for ; Fri, 14 Oct 2005 23:41:13 GMT (envelope-from soc-chenk@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j9ENfDig098090 for perforce@freebsd.org; Fri, 14 Oct 2005 23:41:13 GMT (envelope-from soc-chenk@freebsd.org) Date: Fri, 14 Oct 2005 23:41:13 GMT Message-Id: <200510142341.j9ENfDig098090@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to soc-chenk@freebsd.org using -f From: soc-chenk To: Perforce Change Reviews Cc: Subject: PERFORCE change 85318 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2005 23:41:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=85318 Change 85318 by soc-chenk@soc-chenk_leavemealone on 2005/10/14 23:40:32 Attempt to fix some known non-privilegedly accessible crash schemes - tried to fix: - forced unmount when being busy - deadlocks by null mounts Submitted by: soc-chenk Affected files ... .. //depot/projects/soc2005/fuse4bsd2/fuse_module/fuse.c#17 edit Differences ... ==== //depot/projects/soc2005/fuse4bsd2/fuse_module/fuse.c#17 (text+ko) ==== @@ -333,8 +333,18 @@ out: mtx_unlock(&caliban->answer_mtx); - KASSERT(err || fuse_callbn_answered(caliban), - ("fuse requester was woken up but still no answer")); + if (! (err || fuse_callbn_answered(caliban))) { + /* + * Some deadlocky scenarios can get us here, like SIGKILLing + * the fusexmp daemon after a fuse dir has been null mounted + * over its original copy in the "normal" fs + * + * (I guess there is no need of kicking the daemon at this + * point...) + */ + DEBUG2G("fuse requester was woken up but still no answer"); + err = ENXIO; + } return (err); } @@ -3520,6 +3530,16 @@ panic("non-fat file passed to read routine"); vn_lock(fp->f_vnode, LK_EXCLUSIVE | LK_RETRY, td); + + if (fp->f_vnode->v_type == VBAD) { +#if _DEBUG2G + DEBUG2G("bad file\n"); + vn_printf(fp->f_vnode, " * "); +#endif + VOP_UNLOCK(fp->f_vnode, 0, td); + return (EBADF); + } + if ((flags & FOF_OFFSET) == 0) uio->uio_offset = fp->f_offset; @@ -4845,6 +4865,16 @@ return (0); vn_lock(fp->f_vnode, LK_EXCLUSIVE | LK_RETRY, td); + + if (fp->f_vnode->v_type == VBAD) { +#if _DEBUG2G + DEBUG2G("bad file\n"); + vn_printf(fp->f_vnode, " * "); +#endif + VOP_UNLOCK(fp->f_vnode, 0, td); + return (EBADF); + } + if (fp->f_flag & O_APPEND) { VOP_GETATTR(fp->f_vnode, &va, cred, td); uio->uio_offset = va.va_size;