Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754269Ab3IEQHf (ORCPT ); Thu, 5 Sep 2013 12:07:35 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:60555 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752612Ab3IEQHe (ORCPT ); Thu, 5 Sep 2013 12:07:34 -0400 Date: Thu, 5 Sep 2013 17:07:29 +0100 From: Al Viro To: Miklos Szeredi Cc: Linux-Fsdevel , Kernel Mailing List , "mszeredi@suse.cz" , David Howells , Steven Whitehouse , Trond Myklebust , Greg Kroah-Hartman Subject: Re: [PATCH 04/11] vfs: check unlinked ancestors before mount Message-ID: <20130905160729.GT13318@ZenIV.linux.org.uk> References: <1378374284-1484-5-git-send-email-miklos@szeredi.hu> <20130905111852.GP13318@ZenIV.linux.org.uk> <20130905120230.GA21170@tucsk.piliscsaba.szeredi.hu> <20130905123911.GA25538@tucsk.piliscsaba.szeredi.hu> <20130905132325.GQ13318@ZenIV.linux.org.uk> <20130905142651.GB25538@tucsk.piliscsaba.szeredi.hu> <20130905145613.GR13318@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Content-Length: 1594 Lines: 39 On Thu, Sep 05, 2013 at 05:52:51PM +0200, Miklos Szeredi wrote: > On Thu, Sep 5, 2013 at 4:56 PM, Al Viro wrote: > > I'd probably just do this, and to hell with helper functions... > > > > int d_set_mounted(struct dentry *dentry) > > { > > struct dentry *p; > > int ret = 0; > > write_seqlock(&rename_lock); > > for (p = dentry; !IS_ROOT(p); p = p->d_parent) { > > /* Need exclusion wrt. check_submounts_and_drop() */ > > spin_lock(&p->d_lock); > > if (unlikely(d_unhashed(p))) { > > spin_unlock(&p->d_lock); > > ret = -ENOENT; > > goto out; > > } > > spin_unlock(&p->d_lock); > > } > > spin_lock(&dentry->d_lock); > > dentry->d_flags |= DCACHE_MOUNTED; > > spin_unlock(&dentry->d_lock); > > out: > > write_sequnlock(&rename_lock); > > return ret; > > } > > One issue with that: the dentry should be checked and marked within > the same d_locked region. Because e.g. d_invalidate() relies solely > on d_lock for non-dir mounts and d_mountpoint() checking, no > rename_lock protection there. Point... OK, could you check if vfs.git#for-miklos looks sane now? It should be at cf7543f... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/