ChangeSet 1.2231.1.123, 2005/03/28 19:50:45-08:00, [EMAIL PROTECTED]
[PATCH] Can't unmount bad inode
This patch fixes a problem when a inode which is the root of a mount
becomes bad (make_bad_inode()). In this case follow_link will return
-EIO, so the name resolution fails, and umount won't work. The
solution is just to remove the follow_link method from bad_inode_ops.
Any filesystem operation (other than unmount) will still fail, since
every other method returns -EIO.
A test case for this is:
1) export an smbfs on host A and mount the share on host B
2) create directory X on A under the exported directory
3) bind mount X to Y on B (Y need not be under the share)
4) remove directory X, and create regular file X (same name) on A
5) stat X on B, this will make X a bad inode (file type changed)
6) umount Y
Without the patch applied, umount won't succeed, and a reboot is
necessary to get rid of the mount.
With the patch applied, umount will succeed.
The same is true for any filesystem which uses make_bad_inode() to
mark an existing inode bad (NFS, SMBFS, FUSE, etc...).
Signed-off-by: Miklos Szeredi <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
bad_inode.c | 14 ++------------
1 files changed, 2 insertions(+), 12 deletions(-)
diff -Nru a/fs/bad_inode.c b/fs/bad_inode.c
--- a/fs/bad_inode.c 2005-03-28 21:33:43 -08:00
+++ b/fs/bad_inode.c 2005-03-28 21:33:43 -08:00
@@ -15,17 +15,6 @@
#include <linux/smp_lock.h>
#include <linux/namei.h>
-/*
- * The follow_link operation is special: it must behave as a no-op
- * so that a bad root inode can at least be unmounted. To do this
- * we must dput() the base and return the dentry with a dget().
- */
-static int bad_follow_link(struct dentry *dent, struct nameidata *nd)
-{
- nd_set_link(nd, ERR_PTR(-EIO));
- return 0;
-}
-
static int return_EIO(void)
{
return -EIO;
@@ -70,7 +59,8 @@
.mknod = EIO_ERROR,
.rename = EIO_ERROR,
.readlink = EIO_ERROR,
- .follow_link = bad_follow_link,
+ /* follow_link must be no-op, otherwise unmounting this inode
+ won't work */
.truncate = EIO_ERROR,
.permission = EIO_ERROR,
.getattr = EIO_ERROR,
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html