patch for 2.1.51 d_umount

Bill Hawes (whawes@star.net)
Tue, 19 Aug 1997 13:37:40 -0400


This is a multi-part message in MIME format.
--------------CBE1DB83C9F9D96E748967A9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I posted this earlier to fix a problem in unmounting an initrd, but it
must have fallen through the cracks. If an initrd isn't being remounted
after changing roots, it gets unmounted. But as the root inode hasn't
been mounted on anything, it gets one too many dputs.

(I've also changed the name "covers" to "covered", as it always confuses
me. A root is mounted "on top of" a directory, therefore the directory
is "covered". Unless there's some other way of thinking about it ...)

Regards,
Bill
--------------CBE1DB83C9F9D96E748967A9
Content-Type: text/plain; charset=us-ascii; name="super_51-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="super_51-patch"

--- fs/super.c.old Thu Aug 14 18:44:06 1997
+++ fs/super.c Tue Aug 19 13:15:24 1997
@@ -553,7 +553,7 @@
static int d_umount(struct super_block * sb)
{
struct dentry * root = sb->s_root;
- struct dentry * covers = root->d_covers;
+ struct dentry * covered = root->d_covers;

if (root->d_count != 1)
return -EBUSY;
@@ -563,22 +563,23 @@

sb->s_root = NULL;

- covers->d_mounts = covers;
root->d_covers = root;
-
- dput(covers);
+ if (covered != root) {
+ covered->d_mounts = covered;
+ dput(covered);
+ }
dput(root);
return 0;
}

-static void d_mount(struct dentry *covers, struct dentry *dentry)
+static void d_mount(struct dentry *covered, struct dentry *dentry)
{
- if (covers->d_mounts != covers) {
+ if (covered->d_mounts != covered) {
printk("VFS: mount - already mounted\n");
return;
}
- covers->d_mounts = dentry;
- dentry->d_covers = covers;
+ covered->d_mounts = dentry;
+ dentry->d_covers = covered;
}

static int do_umount(kdev_t dev,int unmount_root)

--------------CBE1DB83C9F9D96E748967A9--