From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755917Ab1IAHIx (ORCPT ); Thu, 1 Sep 2011 03:08:53 -0400 Received: from ipmail05.adl6.internode.on.net ([150.101.137.143]:46639 "EHLO ipmail05.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755636Ab1IAHIv (ORCPT ); Thu, 1 Sep 2011 03:08:51 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUEAGssX055LIxDgWdsb2JhbAA6CKhUFQEBFiYlgUABAQQBOhwjBQsIAw4KLhQlAyETh3K4KA6DKoMjBJtjiF4 Date: Thu, 1 Sep 2011 17:08:48 +1000 From: Dave Chinner To: Allison Henderson Cc: linux-kernel@vger.kernel.org, Ext4 Developers List , Andreas Dilger Subject: Re: lock i_mutex for fallocate? Message-ID: <20110901070848.GQ32358@dastard> References: <4E5ED2D5.8040302@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E5ED2D5.8040302@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 31, 2011 at 05:33:25PM -0700, Allison Henderson wrote: > Hi All, > > In ext4 punch hole, we realized that the punch hole operation needs > to be done under i_mutex just like truncate. i_mutex for truncate > is held in the vfs layer, so we dont need to lock it at the file > system layer, but vfs does not lock i_mutex for fallocate. We can > lock i_mutex for fallocate at the fs layer, but question was raised > then: should i_mutex for fallocate be held in the vfs layer instead? No. > I do not know if other file systems need i_mutex to be locked for > fallocate, For one, XFS does not require i_mutex to be held for any extent manipulation of any kind (allocation, truncation, hole punch, unwritten extent conversion, etc). Hence the current structure of having the filesystem take i_mutex if it needs it to protect allocations against races is appropriate. Cheers, Dave. -- Dave Chinner david@fromorbit.com