public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fsync on unmounting root
@ 2001-01-04 18:47 Chris Mason
  2001-01-04 18:58 ` Alexander Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Mason @ 2001-01-04 18:47 UTC (permalink / raw)
  To: viro, linux-kernel

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);
+		}
 		return retval;
 	}
 

-
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/

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

* Re: [PATCH] fsync on unmounting root
  2001-01-04 18:47 [PATCH] fsync on unmounting root Chris Mason
@ 2001-01-04 18:58 ` Alexander Viro
  2001-01-04 19:27   ` Chris Mason
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Viro @ 2001-01-04 18:58 UTC (permalink / raw)
  To: Chris Mason; +Cc: linux-kernel



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/

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

* Re: [PATCH] fsync on unmounting root
  2001-01-04 18:58 ` Alexander Viro
@ 2001-01-04 19:27   ` Chris Mason
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Mason @ 2001-01-04 19:27 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-kernel



On Thursday, January 04, 2001 01:58:47 PM -0500 Alexander Viro
<viro@math.psu.edu> wrote:
> On Thu, 4 Jan 2001, Chris Mason wrote:
> 
>> 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.
>> [snip]
> 
> I have a better suggestion: 
> 
>         if (mnt == current->fs->rootmnt && !umount_root) {
>                 mntput(mnt);
>		 return do_remount("/", 0, NULL);
>	 }
> 

Ok, but I thought we would need an MS_RDONLY in there somewhere...How about
this:

-chris

--- linux/fs/super.c.1	Thu Jan  4 13:38:55 2001
+++ linux/fs/super.c	Thu Jan  4 14:14:04 2001
@@ -54,6 +54,7 @@
 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;
@@ -1025,15 +1026,12 @@
 	 * call reboot(9). Then init(8) could umount root and exec /reboot.
 	 */
 	if (mnt == current->fs->rootmnt && !umount_root) {
-		int retval = 0;
 		/*
 		 * Special case for "unmounting" root ...
 		 * we just try to remount it readonly.
 		 */
 		mntput(mnt);
-		if (!(sb->s_flags & MS_RDONLY)) 
-			retval = do_remount_sb(sb, MS_RDONLY, 0);
-		return retval;
+		return do_remount("/", MS_RDONLY, NULL);
 	}
 
 	spin_lock(&dcache_lock);

-
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/

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

end of thread, other threads:[~2001-01-04 19:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-04 18:47 [PATCH] fsync on unmounting root Chris Mason
2001-01-04 18:58 ` Alexander Viro
2001-01-04 19:27   ` Chris Mason

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