Miklos Szeredi 4ed5e82fe7 vfs: protect remounting superblock read-only
Currently remouting superblock read-only is racy in a major way.

With the per mount read-only infrastructure it is now possible to
prevent most races, which this patch attempts.

Before starting the remount read-only, iterate through all mounts
belonging to the superblock and if none of them have any pending
writes, set sb->s_readonly_remount.  This indicates that remount is in
progress and no further write requests are allowed.  If the remount
succeeds set MS_RDONLY and reset s_readonly_remount.

If the remounting is unsuccessful just reset s_readonly_remount.
This can result in transient EROFS errors, despite the fact the
remount failed.  Unfortunately hodling off writes is difficult as
remount itself may touch the filesystem (e.g. through load_nls())
which would deadlock.

A later patch deals with delayed writes due to nlink going to zero.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Tested-by: Toshiyuki Okajima <toshi.okajima@jp.fujitsu.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-01-06 23:20:12 -05:00
..
2012-01-03 22:55:01 -05:00
2012-01-03 22:55:04 -05:00
2012-01-03 22:54:53 -05:00
2012-01-03 22:54:53 -05:00
2012-01-03 22:54:07 -05:00
2012-01-03 22:54:53 -05:00
2012-01-03 22:54:57 -05:00
2012-01-03 22:54:56 -05:00
2012-01-03 22:55:05 -05:00
2012-01-03 22:55:10 -05:00
2012-01-03 22:54:54 -05:00
2012-01-03 22:55:05 -05:00
2012-01-03 22:55:08 -05:00
2012-01-03 22:55:06 -05:00
2012-01-03 22:54:59 -05:00
2011-03-31 11:26:23 -03:00
2012-01-03 22:55:01 -05:00
2012-01-03 22:55:07 -05:00
2012-01-03 22:55:03 -05:00
2011-11-02 16:07:03 -07:00
2012-01-03 22:55:11 -05:00
2012-01-03 22:54:54 -05:00
2011-11-16 09:21:50 +01:00
2012-01-03 22:54:07 -05:00
2012-01-03 22:54:07 -05:00
2012-01-03 22:57:09 -05:00
2012-01-03 22:52:35 -05:00
2011-07-26 16:49:47 -07:00
2012-01-03 22:52:39 -05:00
2012-01-03 22:54:07 -05:00
2012-01-03 22:55:11 -05:00
2011-03-21 00:16:08 -04:00
2012-01-03 22:54:06 -05:00
2012-01-03 22:54:07 -05:00
2011-05-26 10:01:43 -06:00
2012-01-03 22:52:41 -05:00
2011-10-31 17:30:44 -07:00
2012-01-03 22:52:40 -05:00
2012-01-03 22:54:07 -05:00
2011-11-02 12:53:43 +01:00
2012-01-03 22:53:07 -05:00
2012-01-03 22:54:07 -05:00
2012-01-03 22:52:40 -05:00