Chunk #1:
Switches special case in do_umount() to do_remount_sb() (from
do_remount()); takes all per-superblock steps of remount into remount_sb().
That will allow to clean the lookup logics in the do_remount()/do_lookup()/
do_mount() (next chunk).
Please, apply.
Al
diff -urN S6-pre1/fs/super.c S6-pre1-do_remount/fs/super.c
--- S6-pre1/fs/super.c Tue Jun 5 06:21:52 2001
+++ S6-pre1-do_remount/fs/super.c Tue Jun 5 08:14:29 2001
@@ -55,7 +55,6 @@
extern int root_mountflags;
static int do_remount_sb(struct super_block *sb, int flags, char * data);
-static int do_remount(const char *dir, int flags, char * data);
/* this is initialized in init/main.c */
kdev_t ROOT_DEV;
@@ -923,6 +922,10 @@
if (!(flags & MS_RDONLY) && sb->s_dev && is_read_only(sb->s_dev))
return -EACCES;
/*flags |= MS_RDONLY;*/
+ if (flags & MS_RDONLY)
+ acct_auto_close(sb->s_dev);
+ shrink_dcache_sb(sb);
+ fsync_dev(sb->s_dev);
/* If we are remounting RDONLY, make sure there are no rw files open */
if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY))
if (!fs_may_remount_ro(sb))
@@ -1004,11 +1007,14 @@
* call reboot(9). Then init(8) could umount root and exec /reboot.
*/
if (mnt == current->fs->rootmnt) {
+ int retval = 0;
/*
* Special case for "unmounting" root ...
* we just try to remount it readonly.
*/
- return do_remount("/", MS_RDONLY, NULL);
+ if (!(sb->s_flags & MS_RDONLY))
+ retval = do_remount_sb(sb, MS_RDONLY, 0);
+ return retval;
}
spin_lock(&dcache_lock);
@@ -1202,24 +1208,14 @@
if (path_init(dir, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
retval = path_walk(dir, &nd);
- if (!retval) {
- struct super_block * sb = nd.dentry->d_inode->i_sb;
- retval = -ENODEV;
- if (sb) {
- retval = -EINVAL;
- if (nd.dentry == sb->s_root) {
- /*
- * Shrink the dcache and sync the device.
- */
- shrink_dcache_sb(sb);
- fsync_dev(sb->s_dev);
- if (flags & MS_RDONLY)
- acct_auto_close(sb->s_dev);
- retval = do_remount_sb(sb, flags, data);
- }
- }
- path_release(&nd);
- }
+ if (retval)
+ return retval;
+
+ retval = -EINVAL;
+ if (nd.dentry == nd.mnt->mnt_root)
+ retval = do_remount_sb(nd.mnt->mnt_sb, flags, data);
+
+ path_release(&nd);
return retval;
}
-
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/