Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Miklos Szeredi
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-

Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Al Viro
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; > >

Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Al Viro
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_submo

Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Miklos Szeredi
On Thu, Sep 05, 2013 at 02:23:25PM +0100, Al Viro wrote: > On Thu, Sep 05, 2013 at 02:39:11PM +0200, Miklos Szeredi wrote: > > +static bool __has_unlinked_ancestor(struct dentry *dentry) > > +{ > > + struct dentry *this; > > + > > + for (this = dentry; !IS_ROOT(this); this = this->d_parent) { >

Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Al Viro
On Thu, Sep 05, 2013 at 02:39:11PM +0200, Miklos Szeredi wrote: > +static bool __has_unlinked_ancestor(struct dentry *dentry) > +{ > + struct dentry *this; > + > + for (this = dentry; !IS_ROOT(this); this = this->d_parent) { > + int is_unhashed; > + > + /* Need exclu

Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Miklos Szeredi
This one actually has a slight chance of working. Thanks, Miklos --- Subject: vfs: check unlinked ancestors before mount From: Miklos Szeredi We check submounts before doing d_drop() on a non-empty directory dentry in NFS (have_submounts()), but we do not exclude a racing mount. Nor do we prev

Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Miklos Szeredi
On Thu, Sep 5, 2013 at 2:02 PM, Miklos Szeredi wrote: > On Thu, Sep 05, 2013 at 01:32:10PM +0200, Miklos Szeredi wrote: >> On Thu, Sep 5, 2013 at 1:18 PM, Al Viro wrote: > >> > Something's really odd with locking here. You are take d_lock, do one >> > check, set flag, drop d_lock, grab rename_lo

Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Miklos Szeredi
On Thu, Sep 05, 2013 at 01:32:10PM +0200, Miklos Szeredi wrote: > On Thu, Sep 5, 2013 at 1:18 PM, Al Viro wrote: > > Something's really odd with locking here. You are take d_lock, do one > > check, set flag, drop d_lock, grab rename_lock, do another check (taking > > and dropping d_lock in proce

Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Miklos Szeredi
On Thu, Sep 5, 2013 at 1:18 PM, Al Viro wrote: > On Thu, Sep 05, 2013 at 11:44:37AM +0200, Miklos Szeredi wrote: >> +static bool __has_unlinked_ancestor(struct dentry *dentry) >> +{ >> + struct dentry *this; >> + >> + for (this = dentry; !IS_ROOT(this); this = this->d_parent) { >> +

Re: [PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Al Viro
On Thu, Sep 05, 2013 at 11:44:37AM +0200, Miklos Szeredi wrote: > +static bool __has_unlinked_ancestor(struct dentry *dentry) > +{ > + struct dentry *this; > + > + for (this = dentry; !IS_ROOT(this); this = this->d_parent) { > + int is_unhashed; > + > + /* Need exclu

[PATCH 04/11] vfs: check unlinked ancestors before mount

2013-09-05 Thread Miklos Szeredi
From: Miklos Szeredi We check submounts before doing d_drop() on a non-empty directory dentry in NFS (have_submounts()), but we do not exclude a racing mount. Nor do we prevent mounts to be added to the disconnected subtree using relative paths after the d_drop(). This patch fixes these issues