From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 5 11:01:40 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 03B4F16A474 for ; Mon, 5 Jun 2006 11:01:40 +0000 (UTC) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from comsys.ntu-kpi.kiev.ua (comsys.ntu-kpi.kiev.ua [195.245.194.142]) by mx1.FreeBSD.org (Postfix) with ESMTP id 36DBB43D45 for ; Mon, 5 Jun 2006 11:01:37 +0000 (GMT) (envelope-from simon@comsys.ntu-kpi.kiev.ua) Received: from pm513-1.comsys.ntu-kpi.kiev.ua (pm513-1.comsys.ntu-kpi.kiev.ua [10.18.52.101]) (authenticated bits=0) by comsys.ntu-kpi.kiev.ua (8.13.6/8.13.6) with ESMTP id k55B2egu052075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 5 Jun 2006 14:02:40 +0300 (EEST) Received: by pm513-1.comsys.ntu-kpi.kiev.ua (Postfix, from userid 1001) id AD0025C023; Mon, 5 Jun 2006 14:01:36 +0300 (EEST) Date: Mon, 5 Jun 2006 14:01:36 +0300 From: Andrey Simonenko To: freebsd-hackers@freebsd.org Message-ID: <20060605110136.GA1348@pm513-1.comsys.ntu-kpi.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11 X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=unavailable version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on comsys.ntu-kpi.kiev.ua X-Virus-Scanned: ClamAV 0.82/1456/Thu May 11 08:57:31 2006 on comsys.ntu-kpi.kiev.ua X-Virus-Status: Clean Subject: Question about synchronization (nfssvc, vfs_busy) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jun 2006 11:01:40 -0000 Greetings, Can somebody comment following questions? I want to know where I'm wrong (I checked CURRENT). 1. If the nfsserver is a KLD, then it can be unloaded. There is the nfssvc(2) which is implemented in nfsserver and it is called without Giant. Suppose nfsrv_numnfsd is equal to 0 and some process calls nfssvc(NFSSVC_ADDSOCK), as the result copyin() is called, which can sleep due to possible vm fault, I do not even mention thread preemption. Now nfsserver is unloaded, since nfsrv_numnfsd is equal to zero; when blocked process in copyin() wakes up, it will be continue execution in non-existent KVM address space. 2. If vfs_busy() is called without LK_NOWAIT flag, then it can sleep if a filesystem is being unmounted. At some point unmount() will reach vfs_mount_destroy() and since there is one ref from vfs_busy() it will sleep 3 seconds and will notice MNTK_MWAIT flag and wake up a process, which is sleeping in vfs_busy(). How woken up process can work with mount structure in vfs_busy() after wakeup(), which could be already deallocated in vfs_mount_destroy()?