enforce ->sync_fs is only called for rw superblock

Make sure a superblock really is writeable by checking MS_RDONLY
under s_umount.  sync_filesystems needed some re-arragement for
that, but all but one sync_filesystem caller had the correct locking
already so that we could add that check there.  cachefiles grew
s_umount locking.

I've also added a WARN_ON to sync_filesystem to assert this for
future callers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Christoph Hellwig 2009-05-05 15:41:25 +02:00 committed by Al Viro
parent e500475338
commit 5af7926ff3
5 changed files with 27 additions and 25 deletions

View file

@ -394,9 +394,6 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
struct btrfs_root *root = btrfs_sb(sb);
int ret;
if (sb->s_flags & MS_RDONLY)
return 0;
if (!wait) {
filemap_flush(root->fs_info->btree_inode->i_mapping);
return 0;