From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755425Ab0J0Ije (ORCPT ); Wed, 27 Oct 2010 04:39:34 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:52581 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750743Ab0J0Ijc (ORCPT ); Wed, 27 Oct 2010 04:39:32 -0400 Date: Wed, 27 Oct 2010 04:39:24 -0400 From: Christoph Hellwig To: Arnd Bergmann Cc: "J. Bruce Fields" , Linus Torvalds , Bryan Schumaker , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: nfsd changes for 2.6.37 Message-ID: <20101027083924.GA28129@infradead.org> References: <20101026164549.GD19445@fieldses.org> <20101026214441.GC1842@fieldses.org> <20101026221156.GD1842@fieldses.org> <201010270921.37032.arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201010270921.37032.arnd@arndb.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > If you don't hold lock_flocks throughout fcntl_setlease, the flp variable > points to a flock that may get modified by another thread and you call > time_out_leases() without holding lock_flocks, which it requires. > > The two alternatives I can see are to either use GFP_ATOMIC or to > take the lock inside of generic_setlease and drop it outside. > Neither of the two sounds particularly appealing. Do locks_alloc_lock and initialization of the heap struct file_lock in the caller. This also avoids an entirely useless copy of the lock structure. free the passed in structure if we are modifying an existing lock structure.