From owner-freebsd-fs@FreeBSD.ORG Thu Nov 25 15:26:55 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CCBE106566B; Thu, 25 Nov 2010 15:26:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DE25E8FC08; Thu, 25 Nov 2010 15:26:54 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 9320646B32; Thu, 25 Nov 2010 10:26:54 -0500 (EST) Received: from John-Baldwins-Macbook-Pro.local (d-69-161-103-3.cpe.metrocast.net [69.161.103.3]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A6FA28A009; Thu, 25 Nov 2010 10:26:53 -0500 (EST) Message-ID: <4CEE803C.9090005@FreeBSD.org> Date: Thu, 25 Nov 2010 10:26:52 -0500 From: John Baldwin User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Jeremy Chadwick References: <201011221629.27166.jhb@freebsd.org> <1793929802.495869.1290477665351.JavaMail.root@erie.cs.uoguelph.ca> <20101123051344.GA67909@icarus.home.lan> In-Reply-To: <20101123051344.GA67909@icarus.home.lan> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 25 Nov 2010 10:26:53 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-0.9 required=4.2 tests=BAYES_00,RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: freebsd-fs@freebsd.org, Ivan Voras Subject: Re: preferred kernel upcall method to master nfsd X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Nov 2010 15:26:55 -0000 Jeremy Chadwick wrote: > On Mon, Nov 22, 2010 at 09:01:05PM -0500, Rick Macklem wrote: >>> nfsd is a user process. I suspect that when it receives a signal it >>> falls out of >>> nfssvc() with EINTR and handles saving the restart file in userland. >>> Is that close >>> to the process Rick or does you need to send a signal between threads >>> that are >>> exclusively within the kernel? >>> >> Yep, the kernel nfsd thread needs to tell the userland master nfsd to >> make a backup copy of the stable restart file now. >> >> Doing it with signals, the kernel code would post a signal (SIGUSR2 ?) >> to the master nfsd (which is normally in userland). >> >> The master nfsd would simply have a signal handler for SIGUSR2 that would >> copy the file (it's pretty small) to a backup copy. >> >> At least that's how I would think I could code it. I haven't actually >> tried it? >> >> My question was mostly if there was a preferred/better way for the >> kernel code to tell the userland master nfsd to copy the file? > > Could kqueue(2) be used for this? A userland app can use kqueue(2) to check for signals already. The real question is what is the easiest way for the kernel to signal an event to userland. You could do something convoluted where you create a dummy /dev device that you mark readable when you want to post an event to userland, but that's a lot more work than just calling psignal() if you already know which process to send the signal to. -- John Baldwin