[CIFS] Remove unused cifs_oplock_cachep
[safe/jmp/linux-2.6] / fs / super.c
index 19eb70b..f35ac60 100644 (file)
@@ -568,7 +568,7 @@ out:
 int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
 {
        int retval;
-       int remount_rw;
+       int remount_rw, remount_ro;
 
        if (sb->s_frozen != SB_UNFROZEN)
                return -EBUSY;
@@ -583,9 +583,12 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
        shrink_dcache_sb(sb);
        sync_filesystem(sb);
 
+       remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY);
+       remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY);
+
        /* If we are remounting RDONLY and current sb is read/write,
           make sure there are no rw files opened */
-       if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) {
+       if (remount_ro) {
                if (force)
                        mark_files_ro(sb);
                else if (!fs_may_remount_ro(sb))
@@ -594,7 +597,6 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
                if (retval < 0 && retval != -ENOSYS)
                        return -EBUSY;
        }
-       remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY);
 
        if (sb->s_op->remount_fs) {
                retval = sb->s_op->remount_fs(sb, &flags, data);
@@ -604,6 +606,16 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
        sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
        if (remount_rw)
                vfs_dq_quota_on_remount(sb);
+       /*
+        * Some filesystems modify their metadata via some other path than the
+        * bdev buffer cache (eg. use a private mapping, or directories in
+        * pagecache, etc). Also file data modifications go via their own
+        * mappings. So If we try to mount readonly then copy the filesystem
+        * from bdev, we could get stale data, so invalidate it to give a best
+        * effort at coherency.
+        */
+       if (remount_ro && sb->s_bdev)
+               invalidate_bdev(sb->s_bdev);
        return 0;
 }
 
@@ -901,8 +913,9 @@ int get_sb_single(struct file_system_type *fs_type,
                        return error;
                }
                s->s_flags |= MS_ACTIVE;
+       } else {
+               do_remount_sb(s, flags, data, 0);
        }
-       do_remount_sb(s, flags, data, 0);
        simple_set_mnt(mnt, s);
        return 0;
 }
@@ -924,6 +937,9 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
        if (!mnt)
                goto out;
 
+       if (flags & MS_KERNMOUNT)
+               mnt->mnt_flags = MNT_INTERNAL;
+
        if (data && !(type->fs_flags & FS_BINARY_MOUNTDATA)) {
                secdata = alloc_secdata();
                if (!secdata)