diff options
Diffstat (limited to 'fs/super.c')
-rw-r--r-- | fs/super.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/fs/super.c b/fs/super.c index 221cfa1f4e92..166c4ee0d0ed 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -360,7 +360,7 @@ static int grab_super(struct super_block *s) __releases(sb_lock) | |||
360 | s->s_count++; | 360 | s->s_count++; |
361 | spin_unlock(&sb_lock); | 361 | spin_unlock(&sb_lock); |
362 | down_write(&s->s_umount); | 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 | put_super(s); | 364 | put_super(s); |
365 | return 1; | 365 | return 1; |
366 | } | 366 | } |
@@ -390,7 +390,7 @@ bool trylock_super(struct super_block *sb) | |||
390 | { | 390 | { |
391 | if (down_read_trylock(&sb->s_umount)) { | 391 | if (down_read_trylock(&sb->s_umount)) { |
392 | if (!hlist_unhashed(&sb->s_instances) && | 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 | return true; | 394 | return true; |
395 | up_read(&sb->s_umount); | 395 | up_read(&sb->s_umount); |
396 | } | 396 | } |
@@ -419,7 +419,7 @@ void generic_shutdown_super(struct super_block *sb) | |||
419 | if (sb->s_root) { | 419 | if (sb->s_root) { |
420 | shrink_dcache_for_umount(sb); | 420 | shrink_dcache_for_umount(sb); |
421 | sync_filesystem(sb); | 421 | sync_filesystem(sb); |
422 | sb->s_flags &= ~MS_ACTIVE; | 422 | sb->s_flags &= ~SB_ACTIVE; |
423 | 423 | ||
424 | fsnotify_unmount_inodes(sb); | 424 | fsnotify_unmount_inodes(sb); |
425 | cgroup_writeback_umount(); | 425 | cgroup_writeback_umount(); |
@@ -472,7 +472,7 @@ struct super_block *sget_userns(struct file_system_type *type, | |||
472 | struct super_block *old; | 472 | struct super_block *old; |
473 | int err; | 473 | int err; |
474 | 474 | ||
475 | if (!(flags & (MS_KERNMOUNT|MS_SUBMOUNT)) && | 475 | if (!(flags & (SB_KERNMOUNT|SB_SUBMOUNT)) && |
476 | !(type->fs_flags & FS_USERNS_MOUNT) && | 476 | !(type->fs_flags & FS_USERNS_MOUNT) && |
477 | !capable(CAP_SYS_ADMIN)) | 477 | !capable(CAP_SYS_ADMIN)) |
478 | return ERR_PTR(-EPERM); | 478 | return ERR_PTR(-EPERM); |
@@ -502,7 +502,7 @@ retry: | |||
502 | } | 502 | } |
503 | if (!s) { | 503 | if (!s) { |
504 | spin_unlock(&sb_lock); | 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 | if (!s) | 506 | if (!s) |
507 | return ERR_PTR(-ENOMEM); | 507 | return ERR_PTR(-ENOMEM); |
508 | goto retry; | 508 | goto retry; |
@@ -547,11 +547,11 @@ struct super_block *sget(struct file_system_type *type, | |||
547 | * mount through to here so always use &init_user_ns | 547 | * mount through to here so always use &init_user_ns |
548 | * until that changes. | 548 | * until that changes. |
549 | */ | 549 | */ |
550 | if (flags & MS_SUBMOUNT) | 550 | if (flags & SB_SUBMOUNT) |
551 | user_ns = &init_user_ns; | 551 | user_ns = &init_user_ns; |
552 | 552 | ||
553 | /* Ensure the requestor has permissions over the target filesystem */ | 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 | return ERR_PTR(-EPERM); | 555 | return ERR_PTR(-EPERM); |
556 | 556 | ||
557 | return sget_userns(type, test, set, flags, user_ns, data); | 557 | return sget_userns(type, test, set, flags, user_ns, data); |
@@ -594,7 +594,7 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg) | |||
594 | spin_unlock(&sb_lock); | 594 | spin_unlock(&sb_lock); |
595 | 595 | ||
596 | down_read(&sb->s_umount); | 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 | f(sb, arg); | 598 | f(sb, arg); |
599 | up_read(&sb->s_umount); | 599 | up_read(&sb->s_umount); |
600 | 600 | ||
@@ -628,7 +628,7 @@ void iterate_supers_type(struct file_system_type *type, | |||
628 | spin_unlock(&sb_lock); | 628 | spin_unlock(&sb_lock); |
629 | 629 | ||
630 | down_read(&sb->s_umount); | 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 | f(sb, arg); | 632 | f(sb, arg); |
633 | up_read(&sb->s_umount); | 633 | up_read(&sb->s_umount); |
634 | 634 | ||
@@ -664,7 +664,7 @@ rescan: | |||
664 | else | 664 | else |
665 | down_write(&sb->s_umount); | 665 | down_write(&sb->s_umount); |
666 | /* still alive? */ | 666 | /* still alive? */ |
667 | if (sb->s_root && (sb->s_flags & MS_BORN)) | 667 | if (sb->s_root && (sb->s_flags & SB_BORN)) |
668 | return sb; | 668 | return sb; |
669 | if (!excl) | 669 | if (!excl) |
670 | up_read(&sb->s_umount); | 670 | up_read(&sb->s_umount); |
@@ -785,7 +785,7 @@ rescan: | |||
785 | spin_unlock(&sb_lock); | 785 | spin_unlock(&sb_lock); |
786 | down_read(&sb->s_umount); | 786 | down_read(&sb->s_umount); |
787 | /* still alive? */ | 787 | /* still alive? */ |
788 | if (sb->s_root && (sb->s_flags & MS_BORN)) | 788 | if (sb->s_root && (sb->s_flags & SB_BORN)) |
789 | return sb; | 789 | return sb; |
790 | up_read(&sb->s_umount); | 790 | up_read(&sb->s_umount); |
791 | /* nope, got unmounted */ | 791 | /* nope, got unmounted */ |
@@ -801,13 +801,13 @@ rescan: | |||
801 | /** | 801 | /** |
802 | * do_remount_sb - asks filesystem to change mount options. | 802 | * do_remount_sb - asks filesystem to change mount options. |
803 | * @sb: superblock in question | 803 | * @sb: superblock in question |
804 | * @flags: numeric part of options | 804 | * @sb_flags: revised superblock flags |
805 | * @data: the rest of options | 805 | * @data: the rest of options |
806 | * @force: whether or not to force the change | 806 | * @force: whether or not to force the change |
807 | * | 807 | * |
808 | * Alters the mount options of a mounted file system. | 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 | int retval; | 812 | int retval; |
813 | int remount_ro; | 813 | int remount_ro; |
@@ -816,11 +816,11 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
816 | return -EBUSY; | 816 | return -EBUSY; |
817 | 817 | ||
818 | #ifdef CONFIG_BLOCK | 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 | return -EACCES; | 820 | return -EACCES; |
821 | #endif | 821 | #endif |
822 | 822 | ||
823 | remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); | 823 | remount_ro = (sb_flags & SB_RDONLY) && !sb_rdonly(sb); |
824 | 824 | ||
825 | if (remount_ro) { | 825 | if (remount_ro) { |
826 | if (!hlist_empty(&sb->s_pins)) { | 826 | if (!hlist_empty(&sb->s_pins)) { |
@@ -831,7 +831,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
831 | return 0; | 831 | return 0; |
832 | if (sb->s_writers.frozen != SB_UNFROZEN) | 832 | if (sb->s_writers.frozen != SB_UNFROZEN) |
833 | return -EBUSY; | 833 | return -EBUSY; |
834 | remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); | 834 | remount_ro = (sb_flags & SB_RDONLY) && !sb_rdonly(sb); |
835 | } | 835 | } |
836 | } | 836 | } |
837 | shrink_dcache_sb(sb); | 837 | shrink_dcache_sb(sb); |
@@ -850,7 +850,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
850 | } | 850 | } |
851 | 851 | ||
852 | if (sb->s_op->remount_fs) { | 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 | if (retval) { | 854 | if (retval) { |
855 | if (!force) | 855 | if (!force) |
856 | goto cancel_readonly; | 856 | goto cancel_readonly; |
@@ -859,7 +859,7 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
859 | sb->s_type->name, retval); | 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 | /* Needs to be ordered wrt mnt_is_readonly() */ | 863 | /* Needs to be ordered wrt mnt_is_readonly() */ |
864 | smp_wmb(); | 864 | smp_wmb(); |
865 | sb->s_readonly_remount = 0; | 865 | sb->s_readonly_remount = 0; |
@@ -892,12 +892,12 @@ static void do_emergency_remount(struct work_struct *work) | |||
892 | sb->s_count++; | 892 | sb->s_count++; |
893 | spin_unlock(&sb_lock); | 893 | spin_unlock(&sb_lock); |
894 | down_write(&sb->s_umount); | 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 | !(sb->s_flags & MS_RDONLY)) { | 896 | !sb_rdonly(sb)) { |
897 | /* | 897 | /* |
898 | * What lock protects sb->s_flags?? | 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 | up_write(&sb->s_umount); | 902 | up_write(&sb->s_umount); |
903 | spin_lock(&sb_lock); | 903 | spin_lock(&sb_lock); |
@@ -1023,7 +1023,7 @@ struct dentry *mount_ns(struct file_system_type *fs_type, | |||
1023 | /* Don't allow mounting unless the caller has CAP_SYS_ADMIN | 1023 | /* Don't allow mounting unless the caller has CAP_SYS_ADMIN |
1024 | * over the namespace. | 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 | return ERR_PTR(-EPERM); | 1027 | return ERR_PTR(-EPERM); |
1028 | 1028 | ||
1029 | sb = sget_userns(fs_type, ns_test_super, ns_set_super, flags, | 1029 | sb = sget_userns(fs_type, ns_test_super, ns_set_super, flags, |
@@ -1033,13 +1033,13 @@ struct dentry *mount_ns(struct file_system_type *fs_type, | |||
1033 | 1033 | ||
1034 | if (!sb->s_root) { | 1034 | if (!sb->s_root) { |
1035 | int err; | 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 | if (err) { | 1037 | if (err) { |
1038 | deactivate_locked_super(sb); | 1038 | deactivate_locked_super(sb); |
1039 | return ERR_PTR(err); | 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 | return dget(sb->s_root); | 1045 | return dget(sb->s_root); |
@@ -1071,7 +1071,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
1071 | fmode_t mode = FMODE_READ | FMODE_EXCL; | 1071 | fmode_t mode = FMODE_READ | FMODE_EXCL; |
1072 | int error = 0; | 1072 | int error = 0; |
1073 | 1073 | ||
1074 | if (!(flags & MS_RDONLY)) | 1074 | if (!(flags & SB_RDONLY)) |
1075 | mode |= FMODE_WRITE; | 1075 | mode |= FMODE_WRITE; |
1076 | 1076 | ||
1077 | bdev = blkdev_get_by_path(dev_name, mode, fs_type); | 1077 | bdev = blkdev_get_by_path(dev_name, mode, fs_type); |
@@ -1089,14 +1089,14 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
1089 | error = -EBUSY; | 1089 | error = -EBUSY; |
1090 | goto error_bdev; | 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 | bdev); | 1093 | bdev); |
1094 | mutex_unlock(&bdev->bd_fsfreeze_mutex); | 1094 | mutex_unlock(&bdev->bd_fsfreeze_mutex); |
1095 | if (IS_ERR(s)) | 1095 | if (IS_ERR(s)) |
1096 | goto error_s; | 1096 | goto error_s; |
1097 | 1097 | ||
1098 | if (s->s_root) { | 1098 | if (s->s_root) { |
1099 | if ((flags ^ s->s_flags) & MS_RDONLY) { | 1099 | if ((flags ^ s->s_flags) & SB_RDONLY) { |
1100 | deactivate_locked_super(s); | 1100 | deactivate_locked_super(s); |
1101 | error = -EBUSY; | 1101 | error = -EBUSY; |
1102 | goto error_bdev; | 1102 | goto error_bdev; |
@@ -1116,13 +1116,13 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
1116 | s->s_mode = mode; | 1116 | s->s_mode = mode; |
1117 | snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev); | 1117 | snprintf(s->s_id, sizeof(s->s_id), "%pg", bdev); |
1118 | sb_set_blocksize(s, block_size(bdev)); | 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 | if (error) { | 1120 | if (error) { |
1121 | deactivate_locked_super(s); | 1121 | deactivate_locked_super(s); |
1122 | goto error; | 1122 | goto error; |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | s->s_flags |= MS_ACTIVE; | 1125 | s->s_flags |= SB_ACTIVE; |
1126 | bdev->bd_super = s; | 1126 | bdev->bd_super = s; |
1127 | } | 1127 | } |
1128 | 1128 | ||
@@ -1162,12 +1162,12 @@ struct dentry *mount_nodev(struct file_system_type *fs_type, | |||
1162 | if (IS_ERR(s)) | 1162 | if (IS_ERR(s)) |
1163 | return ERR_CAST(s); | 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 | if (error) { | 1166 | if (error) { |
1167 | deactivate_locked_super(s); | 1167 | deactivate_locked_super(s); |
1168 | return ERR_PTR(error); | 1168 | return ERR_PTR(error); |
1169 | } | 1169 | } |
1170 | s->s_flags |= MS_ACTIVE; | 1170 | s->s_flags |= SB_ACTIVE; |
1171 | return dget(s->s_root); | 1171 | return dget(s->s_root); |
1172 | } | 1172 | } |
1173 | EXPORT_SYMBOL(mount_nodev); | 1173 | EXPORT_SYMBOL(mount_nodev); |
@@ -1188,12 +1188,12 @@ struct dentry *mount_single(struct file_system_type *fs_type, | |||
1188 | if (IS_ERR(s)) | 1188 | if (IS_ERR(s)) |
1189 | return ERR_CAST(s); | 1189 | return ERR_CAST(s); |
1190 | if (!s->s_root) { | 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 | if (error) { | 1192 | if (error) { |
1193 | deactivate_locked_super(s); | 1193 | deactivate_locked_super(s); |
1194 | return ERR_PTR(error); | 1194 | return ERR_PTR(error); |
1195 | } | 1195 | } |
1196 | s->s_flags |= MS_ACTIVE; | 1196 | s->s_flags |= SB_ACTIVE; |
1197 | } else { | 1197 | } else { |
1198 | do_remount_sb(s, flags, data, 0); | 1198 | do_remount_sb(s, flags, data, 0); |
1199 | } | 1199 | } |
@@ -1227,7 +1227,7 @@ mount_fs(struct file_system_type *type, int flags, const char *name, void *data) | |||
1227 | sb = root->d_sb; | 1227 | sb = root->d_sb; |
1228 | BUG_ON(!sb); | 1228 | BUG_ON(!sb); |
1229 | WARN_ON(!sb->s_bdi); | 1229 | WARN_ON(!sb->s_bdi); |
1230 | sb->s_flags |= MS_BORN; | 1230 | sb->s_flags |= SB_BORN; |
1231 | 1231 | ||
1232 | error = security_sb_kern_mount(sb, flags, secdata); | 1232 | error = security_sb_kern_mount(sb, flags, secdata); |
1233 | if (error) | 1233 | if (error) |
@@ -1434,12 +1434,12 @@ int freeze_super(struct super_block *sb) | |||
1434 | return -EBUSY; | 1434 | return -EBUSY; |
1435 | } | 1435 | } |
1436 | 1436 | ||
1437 | if (!(sb->s_flags & MS_BORN)) { | 1437 | if (!(sb->s_flags & SB_BORN)) { |
1438 | up_write(&sb->s_umount); | 1438 | up_write(&sb->s_umount); |
1439 | return 0; /* sic - it's "nothing to do" */ | 1439 | return 0; /* sic - it's "nothing to do" */ |
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | if (sb->s_flags & MS_RDONLY) { | 1442 | if (sb_rdonly(sb)) { |
1443 | /* Nothing to do really... */ | 1443 | /* Nothing to do really... */ |
1444 | sb->s_writers.frozen = SB_FREEZE_COMPLETE; | 1444 | sb->s_writers.frozen = SB_FREEZE_COMPLETE; |
1445 | up_write(&sb->s_umount); | 1445 | up_write(&sb->s_umount); |
@@ -1502,7 +1502,7 @@ int thaw_super(struct super_block *sb) | |||
1502 | return -EINVAL; | 1502 | return -EINVAL; |
1503 | } | 1503 | } |
1504 | 1504 | ||
1505 | if (sb->s_flags & MS_RDONLY) { | 1505 | if (sb_rdonly(sb)) { |
1506 | sb->s_writers.frozen = SB_UNFROZEN; | 1506 | sb->s_writers.frozen = SB_UNFROZEN; |
1507 | goto out; | 1507 | goto out; |
1508 | } | 1508 | } |