Re: [PATCH] fsync on unmounting root

Alexander Viro (viro@math.psu.edu)
Thu, 4 Jan 2001 13:58:47 -0500 (EST)


On Thu, 4 Jan 2001, Chris Mason wrote:

> Hi guys,
>
> Looks like the prerelease, and at least test13 don't fsync the device when
> someone does an unmount on /
>
> mount -o remount works, just unmounting the root misses the fsync.
>
> This patch works for me:
>
> -chris
>
> --- linux/fs/super.c.1 Thu Jan 4 13:38:55 2001
> +++ linux/fs/super.c Thu Jan 4 13:38:39 2001
> @@ -1031,8 +1031,12 @@
> * we just try to remount it readonly.
> */
> mntput(mnt);
> - if (!(sb->s_flags & MS_RDONLY))
> + if (!(sb->s_flags & MS_RDONLY)) {
> + shrink_dcache_sb(sb);
> + fsync_dev(sb->s_dev);
> + acct_auto_close(sb->s_dev);
> retval = do_remount_sb(sb, MS_RDONLY, 0);
> + }

I have a better suggestion:

if (mnt == current->fs->rootmnt && !umount_root) {
mntput(mnt);
return do_remount("/", 0, NULL);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/