From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755658Ab2AIPLr (ORCPT ); Mon, 9 Jan 2012 10:11:47 -0500 Received: from li9-11.members.linode.com ([67.18.176.11]:41069 "EHLO test.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754125Ab2AIPLp (ORCPT ); Mon, 9 Jan 2012 10:11:45 -0500 Date: Mon, 9 Jan 2012 10:11:29 -0500 From: "Ted Ts'o" To: Al Viro Cc: Linus Torvalds , Miklos Szeredi , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Toshiyuki Okajima Subject: Re: [git pull] vfs pile 1 Message-ID: <20120109151129.GA22175@thunk.org> Mail-Followup-To: Ted Ts'o , Al Viro , Linus Torvalds , Miklos Szeredi , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Toshiyuki Okajima References: <20120105022318.GG23916@ZenIV.linux.org.uk> <20120108235039.GQ23916@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120108235039.GQ23916@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.20 (2009-06-14) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on test.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 08, 2012 at 11:50:40PM +0000, Al Viro wrote: > > WTF is ext4_symlink() doing in case of long symlinks? Look: > drop_nlink(inode); > err = ext4_orphan_add(handle, inode); > ext4_journal_stop(handle); > [write symlink body] > inc_nlink(inode); > err = ext4_orphan_del(handle, inode); > oh, I see... The comment above that re deadlocks and inability to do that > in a single transaction ;-/ > > OK, try this; that's equivalent to what they are doing and will not WARN_ON(); > I hadn't checked other filesystems for similar tricks yet, so this has a good > chance of being incomplete. > > diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c > index 86edc45..2043f48 100644 > --- a/fs/ext4/namei.c > +++ b/fs/ext4/namei.c > @@ -2315,7 +2315,7 @@ retry: > err = PTR_ERR(handle); > goto err_drop_inode; > } > - inc_nlink(inode); > + set_nlink(inode, 1); > err = ext4_orphan_del(handle, inode); > if (err) { > ext4_journal_stop(handle); Thanks, looks good to me. Acked-by: "Theodore Ts'o" What's there is a bit of kludge, granted. But an attempt to optimize out placing the inode on and off the orphan list (either by deferring the start of the ext3/4 journal handle, or by special casing the block used for the long symlink) would add a lot of complexity, and creating long symlinks is not common case in most workloads... - Ted