VFS: Differentiate mount flags (MS_*) from internal superblock flags

Differentiate the MS_* flags passed to mount(2) from the internal flags set
in the super_block's s_flags. s_flags are now called SB_*, with the names
and the values for the moment mirroring the MS_* flags that they're
equivalent to.

In this patch, just the headers are altered and some kernel code where
blind automated conversion isn't necessarily correct.

Note that this shows up some interesting issues:

(1) Some MS_* flags get translated to MNT_* flags (such as MS_NODEV ->
MNT_NODEV) without passing this on to the filesystem, but some
filesystems set such flags anyway.

(2) The ->remount_fs() methods of some filesystems adjust the *flags
argument by setting MS_* flags in it, such as MS_NOATIME - but these
flags are then scrubbed by do_remount_sb() (only the occupants of
MS_RMT_MASK are permitted: MS_RDONLY, MS_SYNCHRONOUS, MS_MANDLOCK,
MS_I_VERSION and MS_LAZYTIME)

I'm not sure what's the best way to solve all these cases.

Suggested-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>

+104 -71
+1 -1
Documentation/filesystems/porting
··· 228 228 --- 229 229 [mandatory] 230 230 231 - FS_NOMOUNT is gone. If you use it - just set MS_NOUSER in flags 231 + FS_NOMOUNT is gone. If you use it - just set SB_NOUSER in flags 232 232 (see rootfs for one kind of solution and bdev/socket/pipe for another). 233 233 234 234 ---
+31 -25
fs/namespace.c
··· 971 971 if (!mnt) 972 972 return ERR_PTR(-ENOMEM); 973 973 974 - if (flags & MS_KERNMOUNT) 974 + if (flags & SB_KERNMOUNT) 975 975 mnt->mnt.mnt_flags = MNT_INTERNAL; 976 976 977 977 root = mount_fs(type, flags, name, data); ··· 1003 1003 if (mountpoint->d_sb->s_user_ns != &init_user_ns) 1004 1004 return ERR_PTR(-EPERM); 1005 1005 1006 - return vfs_kern_mount(type, MS_SUBMOUNT, name, data); 1006 + return vfs_kern_mount(type, SB_SUBMOUNT, name, data); 1007 1007 } 1008 1008 EXPORT_SYMBOL_GPL(vfs_submount); 1009 1009 ··· 1535 1535 return -EPERM; 1536 1536 down_write(&sb->s_umount); 1537 1537 if (!sb_rdonly(sb)) 1538 - retval = do_remount_sb(sb, MS_RDONLY, NULL, 0); 1538 + retval = do_remount_sb(sb, SB_RDONLY, NULL, 0); 1539 1539 up_write(&sb->s_umount); 1540 1540 return retval; 1541 1541 } ··· 2059 2059 2060 2060 static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) 2061 2061 { 2062 - if (mnt->mnt.mnt_sb->s_flags & MS_NOUSER) 2062 + if (mnt->mnt.mnt_sb->s_flags & SB_NOUSER) 2063 2063 return -EINVAL; 2064 2064 2065 2065 if (d_is_dir(mp->m_dentry) != ··· 2073 2073 * Sanity check the flags to change_mnt_propagation. 2074 2074 */ 2075 2075 2076 - static int flags_to_propagation_type(int flags) 2076 + static int flags_to_propagation_type(int ms_flags) 2077 2077 { 2078 - int type = flags & ~(MS_REC | MS_SILENT); 2078 + int type = ms_flags & ~(MS_REC | MS_SILENT); 2079 2079 2080 2080 /* Fail if any non-propagation flags are set */ 2081 2081 if (type & ~(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) ··· 2089 2089 /* 2090 2090 * recursively change the type of the mountpoint. 2091 2091 */ 2092 - static int do_change_type(struct path *path, int flag) 2092 + static int do_change_type(struct path *path, int ms_flags) 2093 2093 { 2094 2094 struct mount *m; 2095 2095 struct mount *mnt = real_mount(path->mnt); 2096 - int recurse = flag & MS_REC; 2096 + int recurse = ms_flags & MS_REC; 2097 2097 int type; 2098 2098 int err = 0; 2099 2099 2100 2100 if (path->dentry != path->mnt->mnt_root) 2101 2101 return -EINVAL; 2102 2102 2103 - type = flags_to_propagation_type(flag); 2103 + type = flags_to_propagation_type(ms_flags); 2104 2104 if (!type) 2105 2105 return -EINVAL; 2106 2106 ··· 2222 2222 * If you've mounted a non-root directory somewhere and want to do remount 2223 2223 * on it - tough luck. 2224 2224 */ 2225 - static int do_remount(struct path *path, int flags, int mnt_flags, 2226 - void *data) 2225 + static int do_remount(struct path *path, int ms_flags, int sb_flags, 2226 + int mnt_flags, void *data) 2227 2227 { 2228 2228 int err; 2229 2229 struct super_block *sb = path->mnt->mnt_sb; ··· 2267 2267 return err; 2268 2268 2269 2269 down_write(&sb->s_umount); 2270 - if (flags & MS_BIND) 2271 - err = change_mount_flags(path->mnt, flags); 2270 + if (ms_flags & MS_BIND) 2271 + err = change_mount_flags(path->mnt, ms_flags); 2272 2272 else if (!capable(CAP_SYS_ADMIN)) 2273 2273 err = -EPERM; 2274 2274 else 2275 - err = do_remount_sb(sb, flags, data, 0); 2275 + err = do_remount_sb(sb, sb_flags, data, 0); 2276 2276 if (!err) { 2277 2277 lock_mount_hash(); 2278 2278 mnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK; ··· 2437 2437 * create a new mount for userspace and request it to be added into the 2438 2438 * namespace's tree 2439 2439 */ 2440 - static int do_new_mount(struct path *path, const char *fstype, int flags, 2440 + static int do_new_mount(struct path *path, const char *fstype, int sb_flags, 2441 2441 int mnt_flags, const char *name, void *data) 2442 2442 { 2443 2443 struct file_system_type *type; ··· 2451 2451 if (!type) 2452 2452 return -ENODEV; 2453 2453 2454 - mnt = vfs_kern_mount(type, flags, name, data); 2454 + mnt = vfs_kern_mount(type, sb_flags, name, data); 2455 2455 if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) && 2456 2456 !mnt->mnt_sb->s_subtype) 2457 2457 mnt = fs_set_subtype(mnt, fstype); ··· 2706 2706 const char *type_page, unsigned long flags, void *data_page) 2707 2707 { 2708 2708 struct path path; 2709 + unsigned int mnt_flags = 0, sb_flags; 2709 2710 int retval = 0; 2710 - int mnt_flags = 0; 2711 2711 2712 2712 /* Discard magic */ 2713 2713 if ((flags & MS_MGC_MSK) == MS_MGC_VAL) ··· 2716 2716 /* Basic sanity checks */ 2717 2717 if (data_page) 2718 2718 ((char *)data_page)[PAGE_SIZE - 1] = 0; 2719 + 2720 + if (flags & MS_NOUSER) 2721 + return -EINVAL; 2719 2722 2720 2723 /* ... and get the mountpoint */ 2721 2724 retval = user_path(dir_name, &path); ··· 2729 2726 type_page, flags, data_page); 2730 2727 if (!retval && !may_mount()) 2731 2728 retval = -EPERM; 2732 - if (!retval && (flags & MS_MANDLOCK) && !may_mandlock()) 2729 + if (!retval && (flags & SB_MANDLOCK) && !may_mandlock()) 2733 2730 retval = -EPERM; 2734 2731 if (retval) 2735 2732 goto dput_out; ··· 2751 2748 mnt_flags |= MNT_NODIRATIME; 2752 2749 if (flags & MS_STRICTATIME) 2753 2750 mnt_flags &= ~(MNT_RELATIME | MNT_NOATIME); 2754 - if (flags & MS_RDONLY) 2751 + if (flags & SB_RDONLY) 2755 2752 mnt_flags |= MNT_READONLY; 2756 2753 2757 2754 /* The default atime for remount is preservation */ ··· 2762 2759 mnt_flags |= path.mnt->mnt_flags & MNT_ATIME_MASK; 2763 2760 } 2764 2761 2765 - flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN | 2766 - MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT | 2767 - MS_STRICTATIME | MS_NOREMOTELOCK | MS_SUBMOUNT); 2762 + sb_flags = flags & (SB_RDONLY | 2763 + SB_SYNCHRONOUS | 2764 + SB_MANDLOCK | 2765 + SB_DIRSYNC | 2766 + SB_SILENT | 2767 + SB_POSIXACL); 2768 2768 2769 2769 if (flags & MS_REMOUNT) 2770 - retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags, 2770 + retval = do_remount(&path, flags, sb_flags, mnt_flags, 2771 2771 data_page); 2772 2772 else if (flags & MS_BIND) 2773 2773 retval = do_loopback(&path, dev_name, flags & MS_REC); ··· 2779 2773 else if (flags & MS_MOVE) 2780 2774 retval = do_move_mount(&path, dev_name); 2781 2775 else 2782 - retval = do_new_mount(&path, type_page, flags, mnt_flags, 2776 + retval = do_new_mount(&path, type_page, sb_flags, mnt_flags, 2783 2777 dev_name, data_page); 2784 2778 dput_out: 2785 2779 path_put(&path); ··· 3229 3223 struct vfsmount *kern_mount_data(struct file_system_type *type, void *data) 3230 3224 { 3231 3225 struct vfsmount *mnt; 3232 - mnt = vfs_kern_mount(type, MS_KERNMOUNT, type->name, data); 3226 + mnt = vfs_kern_mount(type, SB_KERNMOUNT, type->name, data); 3233 3227 if (!IS_ERR(mnt)) { 3234 3228 /* 3235 3229 * it is a longterm mount, don't release mnt until
+34 -34
fs/super.c
··· 360 360 s->s_count++; 361 361 spin_unlock(&sb_lock); 362 362 down_write(&s->s_umount); 363 - if ((s->s_flags & MS_BORN) && atomic_inc_not_zero(&s->s_active)) { 363 + if ((s->s_flags & SB_BORN) && atomic_inc_not_zero(&s->s_active)) { 364 364 put_super(s); 365 365 return 1; 366 366 } ··· 390 390 { 391 391 if (down_read_trylock(&sb->s_umount)) { 392 392 if (!hlist_unhashed(&sb->s_instances) && 393 - sb->s_root && (sb->s_flags & MS_BORN)) 393 + sb->s_root && (sb->s_flags & SB_BORN)) 394 394 return true; 395 395 up_read(&sb->s_umount); 396 396 } ··· 419 419 if (sb->s_root) { 420 420 shrink_dcache_for_umount(sb); 421 421 sync_filesystem(sb); 422 - sb->s_flags &= ~MS_ACTIVE; 422 + sb->s_flags &= ~SB_ACTIVE; 423 423 424 424 fsnotify_unmount_inodes(sb); 425 425 cgroup_writeback_umount(); ··· 472 472 struct super_block *old; 473 473 int err; 474 474 475 - if (!(flags & (MS_KERNMOUNT|MS_SUBMOUNT)) && 475 + if (!(flags & (SB_KERNMOUNT|SB_SUBMOUNT)) && 476 476 !(type->fs_flags & FS_USERNS_MOUNT) && 477 477 !capable(CAP_SYS_ADMIN)) 478 478 return ERR_PTR(-EPERM); ··· 502 502 } 503 503 if (!s) { 504 504 spin_unlock(&sb_lock); 505 - s = alloc_super(type, (flags & ~MS_SUBMOUNT), user_ns); 505 + s = alloc_super(type, (flags & ~SB_SUBMOUNT), user_ns); 506 506 if (!s) 507 507 return ERR_PTR(-ENOMEM); 508 508 goto retry; ··· 547 547 * mount through to here so always use &init_user_ns 548 548 * until that changes. 549 549 */ 550 - if (flags & MS_SUBMOUNT) 550 + if (flags & SB_SUBMOUNT) 551 551 user_ns = &init_user_ns; 552 552 553 553 /* Ensure the requestor has permissions over the target filesystem */ 554 - if (!(flags & (MS_KERNMOUNT|MS_SUBMOUNT)) && !ns_capable(user_ns, CAP_SYS_ADMIN)) 554 + if (!(flags & (SB_KERNMOUNT|SB_SUBMOUNT)) && !ns_capable(user_ns, CAP_SYS_ADMIN)) 555 555 return ERR_PTR(-EPERM); 556 556 557 557 return sget_userns(type, test, set, flags, user_ns, data); ··· 594 594 spin_unlock(&sb_lock); 595 595 596 596 down_read(&sb->s_umount); 597 - if (sb->s_root && (sb->s_flags & MS_BORN)) 597 + if (sb->s_root && (sb->s_flags & SB_BORN)) 598 598 f(sb, arg); 599 599 up_read(&sb->s_umount); 600 600 ··· 628 628 spin_unlock(&sb_lock); 629 629 630 630 down_read(&sb->s_umount); 631 - if (sb->s_root && (sb->s_flags & MS_BORN)) 631 + if (sb->s_root && (sb->s_flags & SB_BORN)) 632 632 f(sb, arg); 633 633 up_read(&sb->s_umount); 634 634 ··· 664 664 else 665 665 down_write(&sb->s_umount); 666 666 /* still alive? */ 667 - if (sb->s_root && (sb->s_flags & MS_BORN)) 667 + if (sb->s_root && (sb->s_flags & SB_BORN)) 668 668 return sb; 669 669 if (!excl) 670 670 up_read(&sb->s_umount); ··· 785 785 spin_unlock(&sb_lock); 786 786 down_read(&sb->s_umount); 787 787 /* still alive? */ 788 - if (sb->s_root && (sb->s_flags & MS_BORN)) 788 + if (sb->s_root && (sb->s_flags & SB_BORN)) 789 789 return sb; 790 790 up_read(&sb->s_umount); 791 791 /* nope, got unmounted */ ··· 801 801 /** 802 802 * do_remount_sb - asks filesystem to change mount options. 803 803 * @sb: superblock in question 804 - * @flags: numeric part of options 804 + * @sb_flags: revised superblock flags 805 805 * @data: the rest of options 806 806 * @force: whether or not to force the change 807 807 * 808 808 * Alters the mount options of a mounted file system. 809 809 */ 810 - int do_remount_sb(struct super_block *sb, int flags, void *data, int force) 810 + int do_remount_sb(struct super_block *sb, int sb_flags, void *data, int force) 811 811 { 812 812 int retval; 813 813 int remount_ro; ··· 816 816 return -EBUSY; 817 817 818 818 #ifdef CONFIG_BLOCK 819 - if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev)) 819 + if (!(sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev)) 820 820 return -EACCES; 821 821 #endif 822 822 823 - remount_ro = (flags & MS_RDONLY) && !sb_rdonly(sb); 823 + remount_ro = (sb_flags & SB_RDONLY) && !sb_rdonly(sb); 824 824 825 825 if (remount_ro) { 826 826 if (!hlist_empty(&sb->s_pins)) { ··· 831 831 return 0; 832 832 if (sb->s_writers.frozen != SB_UNFROZEN) 833 833 return -EBUSY; 834 - remount_ro = (flags & MS_RDONLY) && !sb_rdonly(sb); 834 + remount_ro = (sb_flags & SB_RDONLY) && !sb_rdonly(sb); 835 835 } 836 836 } 837 837 shrink_dcache_sb(sb); ··· 850 850 } 851 851 852 852 if (sb->s_op->remount_fs) { 853 - retval = sb->s_op->remount_fs(sb, &flags, data); 853 + retval = sb->s_op->remount_fs(sb, &sb_flags, data); 854 854 if (retval) { 855 855 if (!force) 856 856 goto cancel_readonly; ··· 859 859 sb->s_type->name, retval); 860 860 } 861 861 } 862 - sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); 862 + sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (sb_flags & MS_RMT_MASK); 863 863 /* Needs to be ordered wrt mnt_is_readonly() */ 864 864 smp_wmb(); 865 865 sb->s_readonly_remount = 0; ··· 892 892 sb->s_count++; 893 893 spin_unlock(&sb_lock); 894 894 down_write(&sb->s_umount); 895 - if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) && 895 + if (sb->s_root && sb->s_bdev && (sb->s_flags & SB_BORN) && 896 896 !sb_rdonly(sb)) { 897 897 /* 898 898 * What lock protects sb->s_flags?? 899 899 */ 900 - do_remount_sb(sb, MS_RDONLY, NULL, 1); 900 + do_remount_sb(sb, SB_RDONLY, NULL, 1); 901 901 } 902 902 up_write(&sb->s_umount); 903 903 spin_lock(&sb_lock); ··· 1023 1023 /* Don't allow mounting unless the caller has CAP_SYS_ADMIN 1024 1024 * over the namespace. 1025 1025 */ 1026 - if (!(flags & MS_KERNMOUNT) && !ns_capable(user_ns, CAP_SYS_ADMIN)) 1026 + if (!(flags & SB_KERNMOUNT) && !ns_capable(user_ns, CAP_SYS_ADMIN)) 1027 1027 return ERR_PTR(-EPERM); 1028 1028 1029 1029 sb = sget_userns(fs_type, ns_test_super, ns_set_super, flags, ··· 1033 1033 1034 1034 if (!sb->s_root) { 1035 1035 int err; 1036 - err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); 1036 + err = fill_super(sb, data, flags & SB_SILENT ? 1 : 0); 1037 1037 if (err) { 1038 1038 deactivate_locked_super(sb); 1039 1039 return ERR_PTR(err); 1040 1040 } 1041 1041 1042 - sb->s_flags |= MS_ACTIVE; 1042 + sb->s_flags |= SB_ACTIVE; 1043 1043 } 1044 1044 1045 1045 return dget(sb->s_root); ··· 1071 1071 fmode_t mode = FMODE_READ | FMODE_EXCL; 1072 1072 int error = 0; 1073 1073 1074 - if (!(flags & MS_RDONLY)) 1074 + if (!(flags & SB_RDONLY)) 1075 1075 mode |= FMODE_WRITE; 1076 1076 1077 1077 bdev = blkdev_get_by_path(dev_name, mode, fs_type); ··· 1089 1089 error = -EBUSY; 1090 1090 goto error_bdev; 1091 1091 } 1092 - s = sget(fs_type, test_bdev_super, set_bdev_super, flags | MS_NOSEC, 1092 + s = sget(fs_type, test_bdev_super, set_bdev_super, flags | SB_NOSEC, 1093 1093 bdev); 1094 1094 mutex_unlock(&bdev->bd_fsfreeze_mutex); 1095 1095 if (IS_ERR(s)) 1096 1096 goto error_s; 1097 1097 1098 1098 if (s->s_root) { 1099 - if ((flags ^ s->s_flags) & MS_RDONLY) { 1099 + if ((flags ^ s->s_flags) & SB_RDONLY) { 1100 1100 deactivate_locked_super(s); 1101 1101 error = -EBUSY; 1102 1102 goto error_bdev; ··· 1116 1116 s->s_mode = mode; 1117 1117 snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev); 1118 1118 sb_set_blocksize(s, block_size(bdev)); 1119 - error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); 1119 + error = fill_super(s, data, flags & SB_SILENT ? 1 : 0); 1120 1120 if (error) { 1121 1121 deactivate_locked_super(s); 1122 1122 goto error; 1123 1123 } 1124 1124 1125 - s->s_flags |= MS_ACTIVE; 1125 + s->s_flags |= SB_ACTIVE; 1126 1126 bdev->bd_super = s; 1127 1127 } 1128 1128 ··· 1162 1162 if (IS_ERR(s)) 1163 1163 return ERR_CAST(s); 1164 1164 1165 - error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); 1165 + error = fill_super(s, data, flags & SB_SILENT ? 1 : 0); 1166 1166 if (error) { 1167 1167 deactivate_locked_super(s); 1168 1168 return ERR_PTR(error); 1169 1169 } 1170 - s->s_flags |= MS_ACTIVE; 1170 + s->s_flags |= SB_ACTIVE; 1171 1171 return dget(s->s_root); 1172 1172 } 1173 1173 EXPORT_SYMBOL(mount_nodev); ··· 1188 1188 if (IS_ERR(s)) 1189 1189 return ERR_CAST(s); 1190 1190 if (!s->s_root) { 1191 - error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); 1191 + error = fill_super(s, data, flags & SB_SILENT ? 1 : 0); 1192 1192 if (error) { 1193 1193 deactivate_locked_super(s); 1194 1194 return ERR_PTR(error); 1195 1195 } 1196 - s->s_flags |= MS_ACTIVE; 1196 + s->s_flags |= SB_ACTIVE; 1197 1197 } else { 1198 1198 do_remount_sb(s, flags, data, 0); 1199 1199 } ··· 1227 1227 sb = root->d_sb; 1228 1228 BUG_ON(!sb); 1229 1229 WARN_ON(!sb->s_bdi); 1230 - sb->s_flags |= MS_BORN; 1230 + sb->s_flags |= SB_BORN; 1231 1231 1232 1232 error = security_sb_kern_mount(sb, flags, secdata); 1233 1233 if (error) ··· 1434 1434 return -EBUSY; 1435 1435 } 1436 1436 1437 - if (!(sb->s_flags & MS_BORN)) { 1437 + if (!(sb->s_flags & SB_BORN)) { 1438 1438 up_write(&sb->s_umount); 1439 1439 return 0; /* sic - it's "nothing to do" */ 1440 1440 }
+36 -9
include/linux/fs.h
··· 1270 1270 struct mm_struct; 1271 1271 1272 1272 /* 1273 + * sb->s_flags. Note that these mirror the equivalent MS_* flags where 1274 + * represented in both. 1275 + */ 1276 + #define SB_RDONLY 1 /* Mount read-only */ 1277 + #define SB_NOSUID 2 /* Ignore suid and sgid bits */ 1278 + #define SB_NODEV 4 /* Disallow access to device special files */ 1279 + #define SB_NOEXEC 8 /* Disallow program execution */ 1280 + #define SB_SYNCHRONOUS 16 /* Writes are synced at once */ 1281 + #define SB_MANDLOCK 64 /* Allow mandatory locks on an FS */ 1282 + #define SB_DIRSYNC 128 /* Directory modifications are synchronous */ 1283 + #define SB_NOATIME 1024 /* Do not update access times. */ 1284 + #define SB_NODIRATIME 2048 /* Do not update directory access times */ 1285 + #define SB_SILENT 32768 1286 + #define SB_POSIXACL (1<<16) /* VFS does not apply the umask */ 1287 + #define SB_KERNMOUNT (1<<22) /* this is a kern_mount call */ 1288 + #define SB_I_VERSION (1<<23) /* Update inode I_version field */ 1289 + #define SB_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ 1290 + 1291 + /* These sb flags are internal to the kernel */ 1292 + #define SB_SUBMOUNT (1<<26) 1293 + #define SB_NOREMOTELOCK (1<<27) 1294 + #define SB_NOSEC (1<<28) 1295 + #define SB_BORN (1<<29) 1296 + #define SB_ACTIVE (1<<30) 1297 + #define SB_NOUSER (1<<31) 1298 + 1299 + /* 1273 1300 * Umount options 1274 1301 */ 1275 1302 ··· 1862 1835 * possible to override it selectively if you really wanted to with some 1863 1836 * ioctl() that is not currently implemented. 1864 1837 * 1865 - * Exception: MS_RDONLY is always applied to the entire file system. 1838 + * Exception: SB_RDONLY is always applied to the entire file system. 1866 1839 * 1867 1840 * Unfortunately, it is possible to change a filesystems flags with it mounted 1868 1841 * with files in use. This means that all of the inodes will not have their ··· 1873 1846 1874 1847 static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags & MS_RDONLY; } 1875 1848 #define IS_RDONLY(inode) sb_rdonly((inode)->i_sb) 1876 - #define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \ 1849 + #define IS_SYNC(inode) (__IS_FLG(inode, SB_SYNCHRONOUS) || \ 1877 1850 ((inode)->i_flags & S_SYNC)) 1878 - #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ 1851 + #define IS_DIRSYNC(inode) (__IS_FLG(inode, SB_SYNCHRONOUS|SB_DIRSYNC) || \ 1879 1852 ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) 1880 - #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) 1881 - #define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) 1882 - #define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION) 1853 + #define IS_MANDLOCK(inode) __IS_FLG(inode, SB_MANDLOCK) 1854 + #define IS_NOATIME(inode) __IS_FLG(inode, SB_RDONLY|SB_NOATIME) 1855 + #define IS_I_VERSION(inode) __IS_FLG(inode, SB_I_VERSION) 1883 1856 1884 1857 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 1885 1858 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 1886 1859 #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) 1887 - #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) 1860 + #define IS_POSIXACL(inode) __IS_FLG(inode, SB_POSIXACL) 1888 1861 1889 1862 #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) 1890 1863 #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) ··· 2205 2178 } 2206 2179 2207 2180 /* 2208 - * ... and these candidates should be on MS_MANDLOCK mounted fs, 2181 + * ... and these candidates should be on SB_MANDLOCK mounted fs, 2209 2182 * otherwise these will be advisory locks 2210 2183 */ 2211 2184 ··· 3301 3274 3302 3275 static inline void inode_has_no_xattr(struct inode *inode) 3303 3276 { 3304 - if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) 3277 + if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & SB_NOSEC)) 3305 3278 inode->i_flags |= S_NOSEC; 3306 3279 } 3307 3280
+2 -2
init/do_mounts.c
··· 420 420 #endif 421 421 panic("VFS: Unable to mount root fs on %s", b); 422 422 } 423 - if (!(flags & MS_RDONLY)) { 424 - flags |= MS_RDONLY; 423 + if (!(flags & SB_RDONLY)) { 424 + flags |= SB_RDONLY; 425 425 goto retry; 426 426 } 427 427