From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH] CIFS: make cifsd (more) signal-safe Date: Wed, 6 Jun 2007 09:55:50 +0100 Message-ID: <20070606085550.GA7351@infradead.org> References: <20070605152340.f09fa6f2.jlayton@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-cifs-client@lists.samba.org, linux-fsdevel@vger.kernel.org To: Jeff Layton Return-path: Received: from pentafluge.infradead.org ([213.146.154.40]:57157 "EHLO pentafluge.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754719AbXFFIzx (ORCPT ); Wed, 6 Jun 2007 04:55:53 -0400 Content-Disposition: inline In-Reply-To: <20070605152340.f09fa6f2.jlayton@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Tue, Jun 05, 2007 at 03:23:40PM -0400, Jeff Layton wrote: > I recently sent a similar, smaller patch for this problem. After some > discussion with Steve and Shaggy, I think I better understand why cifsd > allows signals through, and I realize that my earlier patch wasn't > comprehensive enough > > The mount and unmount calls will send a KILL signal to cifsd to wake it > up if it happens to be blocked in kernel_recvmsg. The problem is that > it doesn't distinguish between "legitimate" signals sent for this > reason and spurious signals sent by a userspace process (for instance). > While this is definitely a "don't do that" sort of situation, we might > as well try to have cifsd be as signal-safe as possible. > > The following patch does this by making sure that we set tcpStatus to > CifsExiting before sending cifsd a signal, and having cifsd check for > that when it sees that it's been signalled. If the tcpStatus is not set > correctly, it ignores it, flushes signals and moves on. > > I've tested a similar backported version of this on an earlier kernel, > but have not tested this particular patch as of yet. The right way to fix this is to stop sending signals at all and have a kernel-internal way to get out of kernel_recvmsg. Uses of signals by kernel thread generally are bugs.