Return-Path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:50080 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933143Ab0J0QNH (ORCPT ); Wed, 27 Oct 2010 12:13:07 -0400 In-Reply-To: <201010271723.59734.arnd@arndb.de> References: <20101026164549.GD19445@fieldses.org> <20101027145538.GC6328@fieldses.org> <20101027145929.GA5788@infradead.org> <201010271723.59734.arnd@arndb.de> From: Linus Torvalds Date: Wed, 27 Oct 2010 09:12:06 -0700 Message-ID: Subject: Re: nfsd changes for 2.6.37 To: Arnd Bergmann Cc: Christoph Hellwig , "J. Bruce Fields" , Bryan Schumaker , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: multipart/mixed; boundary=000e0cd30b2a0002f404939b7ecf Sender: linux-nfs-owner@vger.kernel.org List-ID: MIME-Version: 1.0 --000e0cd30b2a0002f404939b7ecf Content-Type: text/plain; charset=ISO-8859-1 On Wed, Oct 27, 2010 at 8:23 AM, Arnd Bergmann wrote: > > locks_delete_lock is also called with lock_flocks held and calls > fasync_helper... We don't really have to use fasync_helper. In fact, the whole interface is pretty broken for something like file locking, which isn't actually "fasync()". That whole "on/off as an argument" is just crazy. It would be _trivial_ to expose a version of fasync_helper() that takes a pre-allocated fasync_struct for add, and that has separate helper functions for the add/delete case so that you don't have the pointless crazy arguments (for "delete" the "fd" argument is useless, and I do hate "modal" functions that take what they should do as a flag). Then fcntl_setlease() would trivially just allocate the dang thing before. Something like the attached (UNTESTED!) perhaps? Linus --000e0cd30b2a0002f404939b7ecf Content-Type: text/x-patch; charset=US-ASCII; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gfsekse90 IGZzL2ZjbnRsLmMgICAgICAgICB8ICAgNjYgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrLS0tLS0tLS0tLS0tCiBmcy9sb2Nrcy5jICAgICAgICAgfCAgID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