public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] don't invalidate non-directory mountpoints
@ 2005-10-07 11:13 Miklos Szeredi
  2005-10-07 14:30 ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: Miklos Szeredi @ 2005-10-07 11:13 UTC (permalink / raw)
  To: akpm; +Cc: viro, trond.myklebust, linux-kernel

d_invalidate allowed a non-directory mountpoint to be invalidated,
which is bad, since the mountpoint becomes unreachable.

I know it's racy wrt attaching/detaching mount, but AFAICS so is
everything else that unhashes the dentry.  This seems to be an
oversight when splitting out vfsmount_lock from dcache_lock.  To be
fixed.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
---

Index: linux/fs/dcache.c
===================================================================
--- linux.orig/fs/dcache.c	2005-10-04 13:59:57.000000000 +0200
+++ linux/fs/dcache.c	2005-10-07 12:59:11.000000000 +0200
@@ -350,7 +350,8 @@ int d_invalidate(struct dentry * dentry)
 	 */
 	spin_lock(&dentry->d_lock);
 	if (atomic_read(&dentry->d_count) > 1) {
-		if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) {
+		if (dentry->d_inode && (S_ISDIR(dentry->d_inode->i_mode) ||
+					d_mountpoint(dentry))) {
 			spin_unlock(&dentry->d_lock);
 			spin_unlock(&dcache_lock);
 			return -EBUSY;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] don't invalidate non-directory mountpoints
  2005-10-07 11:13 [PATCH] don't invalidate non-directory mountpoints Miklos Szeredi
@ 2005-10-07 14:30 ` Al Viro
  2005-10-07 14:35   ` Miklos Szeredi
  0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2005-10-07 14:30 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: akpm, trond.myklebust, linux-kernel

On Fri, Oct 07, 2005 at 01:13:50PM +0200, Miklos Szeredi wrote:
> d_invalidate allowed a non-directory mountpoint to be invalidated,
> which is bad, since the mountpoint becomes unreachable.
> 
> I know it's racy wrt attaching/detaching mount, but AFAICS so is
> everything else that unhashes the dentry.  This seems to be an
> oversight when splitting out vfsmount_lock from dcache_lock.  To be
> fixed.

NAK.  That's a wrong way to deal with the problem and it's much older
than vfsmount_lock or dcache_lock (and affects directories too).

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] don't invalidate non-directory mountpoints
  2005-10-07 14:30 ` Al Viro
@ 2005-10-07 14:35   ` Miklos Szeredi
  2005-10-07 14:41     ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: Miklos Szeredi @ 2005-10-07 14:35 UTC (permalink / raw)
  To: viro; +Cc: akpm, trond.myklebust, linux-kernel

> > d_invalidate allowed a non-directory mountpoint to be invalidated,
> > which is bad, since the mountpoint becomes unreachable.
> > 
> > I know it's racy wrt attaching/detaching mount, but AFAICS so is
> > everything else that unhashes the dentry.  This seems to be an
> > oversight when splitting out vfsmount_lock from dcache_lock.  To be
> > fixed.
> 
> NAK.  That's a wrong way to deal with the problem and it's much older
> than vfsmount_lock or dcache_lock (and affects directories too).

Sorry?

Directories are not invalidated if they have any other reference (like
a mount, or any subdirectories which may have mounts).

So how does it affect directories?

Miklos


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] don't invalidate non-directory mountpoints
  2005-10-07 14:35   ` Miklos Szeredi
@ 2005-10-07 14:41     ` Al Viro
  2005-10-07 14:45       ` Miklos Szeredi
  0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2005-10-07 14:41 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: akpm, trond.myklebust, linux-kernel

On Fri, Oct 07, 2005 at 04:35:53PM +0200, Miklos Szeredi wrote:
> > > d_invalidate allowed a non-directory mountpoint to be invalidated,
> > > which is bad, since the mountpoint becomes unreachable.
> > > 
> > > I know it's racy wrt attaching/detaching mount, but AFAICS so is
> > > everything else that unhashes the dentry.  This seems to be an
> > > oversight when splitting out vfsmount_lock from dcache_lock.  To be
> > > fixed.
> > 
> > NAK.  That's a wrong way to deal with the problem and it's much older
> > than vfsmount_lock or dcache_lock (and affects directories too).
> 
> Sorry?
> 
> Directories are not invalidated if they have any other reference (like
> a mount, or any subdirectories which may have mounts).
> 
> So how does it affect directories?

The underlying problem is still there - parts of mount tree _can_ go
unreachable when remote object dies; trying to pin them down is hopeless
and the only sane way to deal with that is to dissolve the subtrees
of mount when that happens.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] don't invalidate non-directory mountpoints
  2005-10-07 14:41     ` Al Viro
@ 2005-10-07 14:45       ` Miklos Szeredi
  0 siblings, 0 replies; 5+ messages in thread
From: Miklos Szeredi @ 2005-10-07 14:45 UTC (permalink / raw)
  To: viro; +Cc: akpm, trond.myklebust, linux-kernel

> > > > d_invalidate allowed a non-directory mountpoint to be invalidated,
> > > > which is bad, since the mountpoint becomes unreachable.
> > > > 
> > > > I know it's racy wrt attaching/detaching mount, but AFAICS so is
> > > > everything else that unhashes the dentry.  This seems to be an
> > > > oversight when splitting out vfsmount_lock from dcache_lock.  To be
> > > > fixed.
> > > 
> > > NAK.  That's a wrong way to deal with the problem and it's much older
> > > than vfsmount_lock or dcache_lock (and affects directories too).
> > 
> > Sorry?
> > 
> > Directories are not invalidated if they have any other reference (like
> > a mount, or any subdirectories which may have mounts).
> > 
> > So how does it affect directories?
> 
> The underlying problem is still there - parts of mount tree _can_ go
> unreachable when remote object dies; trying to pin them down is hopeless
> and the only sane way to deal with that is to dissolve the subtrees
> of mount when that happens.

I get it.

Miklos

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-07 14:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-07 11:13 [PATCH] don't invalidate non-directory mountpoints Miklos Szeredi
2005-10-07 14:30 ` Al Viro
2005-10-07 14:35   ` Miklos Szeredi
2005-10-07 14:41     ` Al Viro
2005-10-07 14:45       ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox