diff options
author | David Howells <dhowells@redhat.com> | 2012-06-25 07:55:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:38:34 -0400 |
commit | 9249e17fe094d853d1ef7475dd559a2cc7e23d42 (patch) | |
tree | fa80a6044c14b38994d232c0e05cb7365800adf2 | |
parent | f015f1267b23d3530d3f874243fb83cb5f443005 (diff) |
VFS: Pass mount flags to sget()
Pass mount flags to sget() so that it can use them in initialising a new
superblock before the set function is called. They could also be passed to the
compare function.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/mtd/mtdsuper.c | 4 | ||||
-rw-r--r-- | fs/9p/vfs_super.c | 4 | ||||
-rw-r--r-- | fs/afs/super.c | 3 | ||||
-rw-r--r-- | fs/btrfs/super.c | 4 | ||||
-rw-r--r-- | fs/ceph/super.c | 2 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 9 | ||||
-rw-r--r-- | fs/devpts/inode.c | 6 | ||||
-rw-r--r-- | fs/ecryptfs/main.c | 3 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 5 | ||||
-rw-r--r-- | fs/libfs.c | 4 | ||||
-rw-r--r-- | fs/logfs/super.c | 3 | ||||
-rw-r--r-- | fs/nfs/super.c | 2 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 4 | ||||
-rw-r--r-- | fs/proc/root.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/procfs.c | 2 | ||||
-rw-r--r-- | fs/super.c | 22 | ||||
-rw-r--r-- | fs/sysfs/mount.c | 3 | ||||
-rw-r--r-- | fs/ubifs/super.c | 3 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | kernel/cgroup.c | 2 |
20 files changed, 40 insertions, 50 deletions
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c index a90bfe79916d..334da5f583c0 100644 --- a/drivers/mtd/mtdsuper.c +++ b/drivers/mtd/mtdsuper.c | |||
@@ -63,7 +63,7 @@ static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags, | |||
63 | struct super_block *sb; | 63 | struct super_block *sb; |
64 | int ret; | 64 | int ret; |
65 | 65 | ||
66 | sb = sget(fs_type, get_sb_mtd_compare, get_sb_mtd_set, mtd); | 66 | sb = sget(fs_type, get_sb_mtd_compare, get_sb_mtd_set, flags, mtd); |
67 | if (IS_ERR(sb)) | 67 | if (IS_ERR(sb)) |
68 | goto out_error; | 68 | goto out_error; |
69 | 69 | ||
@@ -74,8 +74,6 @@ static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags, | |||
74 | pr_debug("MTDSB: New superblock for device %d (\"%s\")\n", | 74 | pr_debug("MTDSB: New superblock for device %d (\"%s\")\n", |
75 | mtd->index, mtd->name); | 75 | mtd->index, mtd->name); |
76 | 76 | ||
77 | sb->s_flags = flags; | ||
78 | |||
79 | ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); | 77 | ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); |
80 | if (ret < 0) { | 78 | if (ret < 0) { |
81 | deactivate_locked_super(sb); | 79 | deactivate_locked_super(sb); |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 8c92a9ba8330..137d50396898 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -89,7 +89,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | |||
89 | if (v9ses->cache) | 89 | if (v9ses->cache) |
90 | sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024)/PAGE_CACHE_SIZE; | 90 | sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024)/PAGE_CACHE_SIZE; |
91 | 91 | ||
92 | sb->s_flags = flags | MS_ACTIVE | MS_DIRSYNC | MS_NOATIME; | 92 | sb->s_flags |= MS_ACTIVE | MS_DIRSYNC | MS_NOATIME; |
93 | if (!v9ses->cache) | 93 | if (!v9ses->cache) |
94 | sb->s_flags |= MS_SYNCHRONOUS; | 94 | sb->s_flags |= MS_SYNCHRONOUS; |
95 | 95 | ||
@@ -137,7 +137,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
137 | goto close_session; | 137 | goto close_session; |
138 | } | 138 | } |
139 | 139 | ||
140 | sb = sget(fs_type, NULL, v9fs_set_super, v9ses); | 140 | sb = sget(fs_type, NULL, v9fs_set_super, flags, v9ses); |
141 | if (IS_ERR(sb)) { | 141 | if (IS_ERR(sb)) { |
142 | retval = PTR_ERR(sb); | 142 | retval = PTR_ERR(sb); |
143 | goto clunk_fid; | 143 | goto clunk_fid; |
diff --git a/fs/afs/super.c b/fs/afs/super.c index f02b31e7e648..df8c6047c2a1 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
@@ -395,7 +395,7 @@ static struct dentry *afs_mount(struct file_system_type *fs_type, | |||
395 | as->volume = vol; | 395 | as->volume = vol; |
396 | 396 | ||
397 | /* allocate a deviceless superblock */ | 397 | /* allocate a deviceless superblock */ |
398 | sb = sget(fs_type, afs_test_super, afs_set_super, as); | 398 | sb = sget(fs_type, afs_test_super, afs_set_super, flags, as); |
399 | if (IS_ERR(sb)) { | 399 | if (IS_ERR(sb)) { |
400 | ret = PTR_ERR(sb); | 400 | ret = PTR_ERR(sb); |
401 | afs_put_volume(vol); | 401 | afs_put_volume(vol); |
@@ -406,7 +406,6 @@ static struct dentry *afs_mount(struct file_system_type *fs_type, | |||
406 | if (!sb->s_root) { | 406 | if (!sb->s_root) { |
407 | /* initial superblock/root creation */ | 407 | /* initial superblock/root creation */ |
408 | _debug("create"); | 408 | _debug("create"); |
409 | sb->s_flags = flags; | ||
410 | ret = afs_fill_super(sb, ¶ms); | 409 | ret = afs_fill_super(sb, ¶ms); |
411 | if (ret < 0) { | 410 | if (ret < 0) { |
412 | deactivate_locked_super(sb); | 411 | deactivate_locked_super(sb); |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index e23991574fdf..b19d75567728 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -1068,7 +1068,8 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | bdev = fs_devices->latest_bdev; | 1070 | bdev = fs_devices->latest_bdev; |
1071 | s = sget(fs_type, btrfs_test_super, btrfs_set_super, fs_info); | 1071 | s = sget(fs_type, btrfs_test_super, btrfs_set_super, flags | MS_NOSEC, |
1072 | fs_info); | ||
1072 | if (IS_ERR(s)) { | 1073 | if (IS_ERR(s)) { |
1073 | error = PTR_ERR(s); | 1074 | error = PTR_ERR(s); |
1074 | goto error_close_devices; | 1075 | goto error_close_devices; |
@@ -1082,7 +1083,6 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
1082 | } else { | 1083 | } else { |
1083 | char b[BDEVNAME_SIZE]; | 1084 | char b[BDEVNAME_SIZE]; |
1084 | 1085 | ||
1085 | s->s_flags = flags | MS_NOSEC; | ||
1086 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); | 1086 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); |
1087 | btrfs_sb(s)->bdev_holder = fs_type; | 1087 | btrfs_sb(s)->bdev_holder = fs_type; |
1088 | error = btrfs_fill_super(s, fs_devices, data, | 1088 | error = btrfs_fill_super(s, fs_devices, data, |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 1e67dd7305a4..7076109f014d 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
@@ -871,7 +871,7 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type, | |||
871 | 871 | ||
872 | if (ceph_test_opt(fsc->client, NOSHARE)) | 872 | if (ceph_test_opt(fsc->client, NOSHARE)) |
873 | compare_super = NULL; | 873 | compare_super = NULL; |
874 | sb = sget(fs_type, compare_super, ceph_set_super, fsc); | 874 | sb = sget(fs_type, compare_super, ceph_set_super, flags, fsc); |
875 | if (IS_ERR(sb)) { | 875 | if (IS_ERR(sb)) { |
876 | res = ERR_CAST(sb); | 876 | res = ERR_CAST(sb); |
877 | goto out; | 877 | goto out; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index c0c2751a7573..a7610cfedf0a 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -637,7 +637,10 @@ cifs_do_mount(struct file_system_type *fs_type, | |||
637 | mnt_data.cifs_sb = cifs_sb; | 637 | mnt_data.cifs_sb = cifs_sb; |
638 | mnt_data.flags = flags; | 638 | mnt_data.flags = flags; |
639 | 639 | ||
640 | sb = sget(fs_type, cifs_match_super, cifs_set_super, &mnt_data); | 640 | /* BB should we make this contingent on mount parm? */ |
641 | flags |= MS_NODIRATIME | MS_NOATIME; | ||
642 | |||
643 | sb = sget(fs_type, cifs_match_super, cifs_set_super, flags, &mnt_data); | ||
641 | if (IS_ERR(sb)) { | 644 | if (IS_ERR(sb)) { |
642 | root = ERR_CAST(sb); | 645 | root = ERR_CAST(sb); |
643 | cifs_umount(cifs_sb); | 646 | cifs_umount(cifs_sb); |
@@ -648,10 +651,6 @@ cifs_do_mount(struct file_system_type *fs_type, | |||
648 | cFYI(1, "Use existing superblock"); | 651 | cFYI(1, "Use existing superblock"); |
649 | cifs_umount(cifs_sb); | 652 | cifs_umount(cifs_sb); |
650 | } else { | 653 | } else { |
651 | sb->s_flags = flags; | ||
652 | /* BB should we make this contingent on mount parm? */ | ||
653 | sb->s_flags |= MS_NODIRATIME | MS_NOATIME; | ||
654 | |||
655 | rc = cifs_read_super(sb); | 654 | rc = cifs_read_super(sb); |
656 | if (rc) { | 655 | if (rc) { |
657 | root = ERR_PTR(rc); | 656 | root = ERR_PTR(rc); |
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 979c1e309c73..14afbabe6546 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
@@ -439,15 +439,15 @@ static struct dentry *devpts_mount(struct file_system_type *fs_type, | |||
439 | return ERR_PTR(error); | 439 | return ERR_PTR(error); |
440 | 440 | ||
441 | if (opts.newinstance) | 441 | if (opts.newinstance) |
442 | s = sget(fs_type, NULL, set_anon_super, NULL); | 442 | s = sget(fs_type, NULL, set_anon_super, flags, NULL); |
443 | else | 443 | else |
444 | s = sget(fs_type, compare_init_pts_sb, set_anon_super, NULL); | 444 | s = sget(fs_type, compare_init_pts_sb, set_anon_super, flags, |
445 | NULL); | ||
445 | 446 | ||
446 | if (IS_ERR(s)) | 447 | if (IS_ERR(s)) |
447 | return ERR_CAST(s); | 448 | return ERR_CAST(s); |
448 | 449 | ||
449 | if (!s->s_root) { | 450 | if (!s->s_root) { |
450 | s->s_flags = flags; | ||
451 | error = devpts_fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 451 | error = devpts_fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
452 | if (error) | 452 | if (error) |
453 | goto out_undo_sget; | 453 | goto out_undo_sget; |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 68954937a071..7edeb3d893c1 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -499,13 +499,12 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags | |||
499 | goto out; | 499 | goto out; |
500 | } | 500 | } |
501 | 501 | ||
502 | s = sget(fs_type, NULL, set_anon_super, NULL); | 502 | s = sget(fs_type, NULL, set_anon_super, flags, NULL); |
503 | if (IS_ERR(s)) { | 503 | if (IS_ERR(s)) { |
504 | rc = PTR_ERR(s); | 504 | rc = PTR_ERR(s); |
505 | goto out; | 505 | goto out; |
506 | } | 506 | } |
507 | 507 | ||
508 | s->s_flags = flags; | ||
509 | rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); | 508 | rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); |
510 | if (rc) | 509 | if (rc) |
511 | goto out1; | 510 | goto out1; |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index b8c250fc4922..6c906078f657 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -1286,7 +1286,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags, | |||
1286 | error = -EBUSY; | 1286 | error = -EBUSY; |
1287 | goto error_bdev; | 1287 | goto error_bdev; |
1288 | } | 1288 | } |
1289 | s = sget(fs_type, test_gfs2_super, set_gfs2_super, bdev); | 1289 | s = sget(fs_type, test_gfs2_super, set_gfs2_super, flags, bdev); |
1290 | mutex_unlock(&bdev->bd_fsfreeze_mutex); | 1290 | mutex_unlock(&bdev->bd_fsfreeze_mutex); |
1291 | error = PTR_ERR(s); | 1291 | error = PTR_ERR(s); |
1292 | if (IS_ERR(s)) | 1292 | if (IS_ERR(s)) |
@@ -1316,7 +1316,6 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags, | |||
1316 | } else { | 1316 | } else { |
1317 | char b[BDEVNAME_SIZE]; | 1317 | char b[BDEVNAME_SIZE]; |
1318 | 1318 | ||
1319 | s->s_flags = flags; | ||
1320 | s->s_mode = mode; | 1319 | s->s_mode = mode; |
1321 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); | 1320 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); |
1322 | sb_set_blocksize(s, block_size(bdev)); | 1321 | sb_set_blocksize(s, block_size(bdev)); |
@@ -1360,7 +1359,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type, | |||
1360 | dev_name, error); | 1359 | dev_name, error); |
1361 | return ERR_PTR(error); | 1360 | return ERR_PTR(error); |
1362 | } | 1361 | } |
1363 | s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, | 1362 | s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags, |
1364 | path.dentry->d_inode->i_sb->s_bdev); | 1363 | path.dentry->d_inode->i_sb->s_bdev); |
1365 | path_put(&path); | 1364 | path_put(&path); |
1366 | if (IS_ERR(s)) { | 1365 | if (IS_ERR(s)) { |
diff --git a/fs/libfs.c b/fs/libfs.c index ebd03f6910d5..a74cb1725ac6 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -222,15 +222,15 @@ struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name, | |||
222 | const struct super_operations *ops, | 222 | const struct super_operations *ops, |
223 | const struct dentry_operations *dops, unsigned long magic) | 223 | const struct dentry_operations *dops, unsigned long magic) |
224 | { | 224 | { |
225 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); | 225 | struct super_block *s; |
226 | struct dentry *dentry; | 226 | struct dentry *dentry; |
227 | struct inode *root; | 227 | struct inode *root; |
228 | struct qstr d_name = QSTR_INIT(name, strlen(name)); | 228 | struct qstr d_name = QSTR_INIT(name, strlen(name)); |
229 | 229 | ||
230 | s = sget(fs_type, NULL, set_anon_super, MS_NOUSER, NULL); | ||
230 | if (IS_ERR(s)) | 231 | if (IS_ERR(s)) |
231 | return ERR_CAST(s); | 232 | return ERR_CAST(s); |
232 | 233 | ||
233 | s->s_flags = MS_NOUSER; | ||
234 | s->s_maxbytes = MAX_LFS_FILESIZE; | 234 | s->s_maxbytes = MAX_LFS_FILESIZE; |
235 | s->s_blocksize = PAGE_SIZE; | 235 | s->s_blocksize = PAGE_SIZE; |
236 | s->s_blocksize_bits = PAGE_SHIFT; | 236 | s->s_blocksize_bits = PAGE_SHIFT; |
diff --git a/fs/logfs/super.c b/fs/logfs/super.c index 97bca623d893..345c24b8a6f8 100644 --- a/fs/logfs/super.c +++ b/fs/logfs/super.c | |||
@@ -519,7 +519,7 @@ static struct dentry *logfs_get_sb_device(struct logfs_super *super, | |||
519 | log_super("LogFS: Start mount %x\n", mount_count++); | 519 | log_super("LogFS: Start mount %x\n", mount_count++); |
520 | 520 | ||
521 | err = -EINVAL; | 521 | err = -EINVAL; |
522 | sb = sget(type, logfs_sb_test, logfs_sb_set, super); | 522 | sb = sget(type, logfs_sb_test, logfs_sb_set, flags | MS_NOATIME, super); |
523 | if (IS_ERR(sb)) { | 523 | if (IS_ERR(sb)) { |
524 | super->s_devops->put_device(super); | 524 | super->s_devops->put_device(super); |
525 | kfree(super); | 525 | kfree(super); |
@@ -542,7 +542,6 @@ static struct dentry *logfs_get_sb_device(struct logfs_super *super, | |||
542 | sb->s_maxbytes = (1ull << 43) - 1; | 542 | sb->s_maxbytes = (1ull << 43) - 1; |
543 | sb->s_max_links = LOGFS_LINK_MAX; | 543 | sb->s_max_links = LOGFS_LINK_MAX; |
544 | sb->s_op = &logfs_super_operations; | 544 | sb->s_op = &logfs_super_operations; |
545 | sb->s_flags = flags | MS_NOATIME; | ||
546 | 545 | ||
547 | err = logfs_read_sb(sb, sb->s_flags & MS_RDONLY); | 546 | err = logfs_read_sb(sb, sb->s_flags & MS_RDONLY); |
548 | if (err) | 547 | if (err) |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 06228192f64e..8b2a2977b720 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -2419,7 +2419,7 @@ static struct dentry *nfs_fs_mount_common(struct file_system_type *fs_type, | |||
2419 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; | 2419 | sb_mntdata.mntflags |= MS_SYNCHRONOUS; |
2420 | 2420 | ||
2421 | /* Get a superblock - note that we may end up sharing one that already exists */ | 2421 | /* Get a superblock - note that we may end up sharing one that already exists */ |
2422 | s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata); | 2422 | s = sget(fs_type, compare_super, nfs_set_super, flags, &sb_mntdata); |
2423 | if (IS_ERR(s)) { | 2423 | if (IS_ERR(s)) { |
2424 | mntroot = ERR_CAST(s); | 2424 | mntroot = ERR_CAST(s); |
2425 | goto out_err_nosb; | 2425 | goto out_err_nosb; |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 1099a76cee59..d57c42f974ea 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -1288,7 +1288,8 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | |||
1288 | err = -EBUSY; | 1288 | err = -EBUSY; |
1289 | goto failed; | 1289 | goto failed; |
1290 | } | 1290 | } |
1291 | s = sget(fs_type, nilfs_test_bdev_super, nilfs_set_bdev_super, sd.bdev); | 1291 | s = sget(fs_type, nilfs_test_bdev_super, nilfs_set_bdev_super, flags, |
1292 | sd.bdev); | ||
1292 | mutex_unlock(&sd.bdev->bd_fsfreeze_mutex); | 1293 | mutex_unlock(&sd.bdev->bd_fsfreeze_mutex); |
1293 | if (IS_ERR(s)) { | 1294 | if (IS_ERR(s)) { |
1294 | err = PTR_ERR(s); | 1295 | err = PTR_ERR(s); |
@@ -1301,7 +1302,6 @@ nilfs_mount(struct file_system_type *fs_type, int flags, | |||
1301 | s_new = true; | 1302 | s_new = true; |
1302 | 1303 | ||
1303 | /* New superblock instance created */ | 1304 | /* New superblock instance created */ |
1304 | s->s_flags = flags; | ||
1305 | s->s_mode = mode; | 1305 | s->s_mode = mode; |
1306 | strlcpy(s->s_id, bdevname(sd.bdev, b), sizeof(s->s_id)); | 1306 | strlcpy(s->s_id, bdevname(sd.bdev, b), sizeof(s->s_id)); |
1307 | sb_set_blocksize(s, block_size(sd.bdev)); | 1307 | sb_set_blocksize(s, block_size(sd.bdev)); |
diff --git a/fs/proc/root.c b/fs/proc/root.c index 568b20290c75..9a2d9fd7cadd 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -111,7 +111,7 @@ static struct dentry *proc_mount(struct file_system_type *fs_type, | |||
111 | options = data; | 111 | options = data; |
112 | } | 112 | } |
113 | 113 | ||
114 | sb = sget(fs_type, proc_test_super, proc_set_super, ns); | 114 | sb = sget(fs_type, proc_test_super, proc_set_super, flags, ns); |
115 | if (IS_ERR(sb)) | 115 | if (IS_ERR(sb)) |
116 | return ERR_CAST(sb); | 116 | return ERR_CAST(sb); |
117 | 117 | ||
@@ -121,7 +121,6 @@ static struct dentry *proc_mount(struct file_system_type *fs_type, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | if (!sb->s_root) { | 123 | if (!sb->s_root) { |
124 | sb->s_flags = flags; | ||
125 | err = proc_fill_super(sb); | 124 | err = proc_fill_super(sb); |
126 | if (err) { | 125 | if (err) { |
127 | deactivate_locked_super(sb); | 126 | deactivate_locked_super(sb); |
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index 2c1ade692cc8..e60e87035bb3 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -403,7 +403,7 @@ static void *r_start(struct seq_file *m, loff_t * pos) | |||
403 | if (l) | 403 | if (l) |
404 | return NULL; | 404 | return NULL; |
405 | 405 | ||
406 | if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, s))) | 406 | if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, s))) |
407 | return NULL; | 407 | return NULL; |
408 | 408 | ||
409 | up_write(&s->s_umount); | 409 | up_write(&s->s_umount); |
diff --git a/fs/super.c b/fs/super.c index cf001775617f..c743fb3be4b8 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -105,11 +105,12 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc) | |||
105 | /** | 105 | /** |
106 | * alloc_super - create new superblock | 106 | * alloc_super - create new superblock |
107 | * @type: filesystem type superblock should belong to | 107 | * @type: filesystem type superblock should belong to |
108 | * @flags: the mount flags | ||
108 | * | 109 | * |
109 | * Allocates and initializes a new &struct super_block. alloc_super() | 110 | * Allocates and initializes a new &struct super_block. alloc_super() |
110 | * returns a pointer new superblock or %NULL if allocation had failed. | 111 | * returns a pointer new superblock or %NULL if allocation had failed. |
111 | */ | 112 | */ |
112 | static struct super_block *alloc_super(struct file_system_type *type) | 113 | static struct super_block *alloc_super(struct file_system_type *type, int flags) |
113 | { | 114 | { |
114 | struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); | 115 | struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); |
115 | static const struct super_operations default_op; | 116 | static const struct super_operations default_op; |
@@ -136,6 +137,7 @@ static struct super_block *alloc_super(struct file_system_type *type) | |||
136 | #else | 137 | #else |
137 | INIT_LIST_HEAD(&s->s_files); | 138 | INIT_LIST_HEAD(&s->s_files); |
138 | #endif | 139 | #endif |
140 | s->s_flags = flags; | ||
139 | s->s_bdi = &default_backing_dev_info; | 141 | s->s_bdi = &default_backing_dev_info; |
140 | INIT_HLIST_NODE(&s->s_instances); | 142 | INIT_HLIST_NODE(&s->s_instances); |
141 | INIT_HLIST_BL_HEAD(&s->s_anon); | 143 | INIT_HLIST_BL_HEAD(&s->s_anon); |
@@ -415,11 +417,13 @@ EXPORT_SYMBOL(generic_shutdown_super); | |||
415 | * @type: filesystem type superblock should belong to | 417 | * @type: filesystem type superblock should belong to |
416 | * @test: comparison callback | 418 | * @test: comparison callback |
417 | * @set: setup callback | 419 | * @set: setup callback |
420 | * @flags: mount flags | ||
418 | * @data: argument to each of them | 421 | * @data: argument to each of them |
419 | */ | 422 | */ |
420 | struct super_block *sget(struct file_system_type *type, | 423 | struct super_block *sget(struct file_system_type *type, |
421 | int (*test)(struct super_block *,void *), | 424 | int (*test)(struct super_block *,void *), |
422 | int (*set)(struct super_block *,void *), | 425 | int (*set)(struct super_block *,void *), |
426 | int flags, | ||
423 | void *data) | 427 | void *data) |
424 | { | 428 | { |
425 | struct super_block *s = NULL; | 429 | struct super_block *s = NULL; |
@@ -450,7 +454,7 @@ retry: | |||
450 | } | 454 | } |
451 | if (!s) { | 455 | if (!s) { |
452 | spin_unlock(&sb_lock); | 456 | spin_unlock(&sb_lock); |
453 | s = alloc_super(type); | 457 | s = alloc_super(type, flags); |
454 | if (!s) | 458 | if (!s) |
455 | return ERR_PTR(-ENOMEM); | 459 | return ERR_PTR(-ENOMEM); |
456 | goto retry; | 460 | goto retry; |
@@ -925,13 +929,12 @@ struct dentry *mount_ns(struct file_system_type *fs_type, int flags, | |||
925 | { | 929 | { |
926 | struct super_block *sb; | 930 | struct super_block *sb; |
927 | 931 | ||
928 | sb = sget(fs_type, ns_test_super, ns_set_super, data); | 932 | sb = sget(fs_type, ns_test_super, ns_set_super, flags, data); |
929 | if (IS_ERR(sb)) | 933 | if (IS_ERR(sb)) |
930 | return ERR_CAST(sb); | 934 | return ERR_CAST(sb); |
931 | 935 | ||
932 | if (!sb->s_root) { | 936 | if (!sb->s_root) { |
933 | int err; | 937 | int err; |
934 | sb->s_flags = flags; | ||
935 | err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); | 938 | err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); |
936 | if (err) { | 939 | if (err) { |
937 | deactivate_locked_super(sb); | 940 | deactivate_locked_super(sb); |
@@ -992,7 +995,8 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
992 | error = -EBUSY; | 995 | error = -EBUSY; |
993 | goto error_bdev; | 996 | goto error_bdev; |
994 | } | 997 | } |
995 | s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); | 998 | s = sget(fs_type, test_bdev_super, set_bdev_super, flags | MS_NOSEC, |
999 | bdev); | ||
996 | mutex_unlock(&bdev->bd_fsfreeze_mutex); | 1000 | mutex_unlock(&bdev->bd_fsfreeze_mutex); |
997 | if (IS_ERR(s)) | 1001 | if (IS_ERR(s)) |
998 | goto error_s; | 1002 | goto error_s; |
@@ -1017,7 +1021,6 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
1017 | } else { | 1021 | } else { |
1018 | char b[BDEVNAME_SIZE]; | 1022 | char b[BDEVNAME_SIZE]; |
1019 | 1023 | ||
1020 | s->s_flags = flags | MS_NOSEC; | ||
1021 | s->s_mode = mode; | 1024 | s->s_mode = mode; |
1022 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); | 1025 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); |
1023 | sb_set_blocksize(s, block_size(bdev)); | 1026 | sb_set_blocksize(s, block_size(bdev)); |
@@ -1062,13 +1065,11 @@ struct dentry *mount_nodev(struct file_system_type *fs_type, | |||
1062 | int (*fill_super)(struct super_block *, void *, int)) | 1065 | int (*fill_super)(struct super_block *, void *, int)) |
1063 | { | 1066 | { |
1064 | int error; | 1067 | int error; |
1065 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); | 1068 | struct super_block *s = sget(fs_type, NULL, set_anon_super, flags, NULL); |
1066 | 1069 | ||
1067 | if (IS_ERR(s)) | 1070 | if (IS_ERR(s)) |
1068 | return ERR_CAST(s); | 1071 | return ERR_CAST(s); |
1069 | 1072 | ||
1070 | s->s_flags = flags; | ||
1071 | |||
1072 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 1073 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
1073 | if (error) { | 1074 | if (error) { |
1074 | deactivate_locked_super(s); | 1075 | deactivate_locked_super(s); |
@@ -1091,11 +1092,10 @@ struct dentry *mount_single(struct file_system_type *fs_type, | |||
1091 | struct super_block *s; | 1092 | struct super_block *s; |
1092 | int error; | 1093 | int error; |
1093 | 1094 | ||
1094 | s = sget(fs_type, compare_single, set_anon_super, NULL); | 1095 | s = sget(fs_type, compare_single, set_anon_super, flags, NULL); |
1095 | if (IS_ERR(s)) | 1096 | if (IS_ERR(s)) |
1096 | return ERR_CAST(s); | 1097 | return ERR_CAST(s); |
1097 | if (!s->s_root) { | 1098 | if (!s->s_root) { |
1098 | s->s_flags = flags; | ||
1099 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 1099 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
1100 | if (error) { | 1100 | if (error) { |
1101 | deactivate_locked_super(s); | 1101 | deactivate_locked_super(s); |
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index c15a7a3572e9..71eb7e253927 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -118,13 +118,12 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type, | |||
118 | for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++) | 118 | for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++) |
119 | info->ns[type] = kobj_ns_grab_current(type); | 119 | info->ns[type] = kobj_ns_grab_current(type); |
120 | 120 | ||
121 | sb = sget(fs_type, sysfs_test_super, sysfs_set_super, info); | 121 | sb = sget(fs_type, sysfs_test_super, sysfs_set_super, flags, info); |
122 | if (IS_ERR(sb) || sb->s_fs_info != info) | 122 | if (IS_ERR(sb) || sb->s_fs_info != info) |
123 | free_sysfs_super_info(info); | 123 | free_sysfs_super_info(info); |
124 | if (IS_ERR(sb)) | 124 | if (IS_ERR(sb)) |
125 | return ERR_CAST(sb); | 125 | return ERR_CAST(sb); |
126 | if (!sb->s_root) { | 126 | if (!sb->s_root) { |
127 | sb->s_flags = flags; | ||
128 | error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); | 127 | error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); |
129 | if (error) { | 128 | if (error) { |
130 | deactivate_locked_super(sb); | 129 | deactivate_locked_super(sb); |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 5862dd9d2784..1c766c39c038 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -2136,7 +2136,7 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, | |||
2136 | 2136 | ||
2137 | dbg_gen("opened ubi%d_%d", c->vi.ubi_num, c->vi.vol_id); | 2137 | dbg_gen("opened ubi%d_%d", c->vi.ubi_num, c->vi.vol_id); |
2138 | 2138 | ||
2139 | sb = sget(fs_type, sb_test, sb_set, c); | 2139 | sb = sget(fs_type, sb_test, sb_set, flags, c); |
2140 | if (IS_ERR(sb)) { | 2140 | if (IS_ERR(sb)) { |
2141 | err = PTR_ERR(sb); | 2141 | err = PTR_ERR(sb); |
2142 | kfree(c); | 2142 | kfree(c); |
@@ -2153,7 +2153,6 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, | |||
2153 | goto out_deact; | 2153 | goto out_deact; |
2154 | } | 2154 | } |
2155 | } else { | 2155 | } else { |
2156 | sb->s_flags = flags; | ||
2157 | err = ubifs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); | 2156 | err = ubifs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); |
2158 | if (err) | 2157 | if (err) |
2159 | goto out_deact; | 2158 | goto out_deact; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 2f857e9eeb3a..48548bdd7722 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1914,7 +1914,7 @@ void free_anon_bdev(dev_t); | |||
1914 | struct super_block *sget(struct file_system_type *type, | 1914 | struct super_block *sget(struct file_system_type *type, |
1915 | int (*test)(struct super_block *,void *), | 1915 | int (*test)(struct super_block *,void *), |
1916 | int (*set)(struct super_block *,void *), | 1916 | int (*set)(struct super_block *,void *), |
1917 | void *data); | 1917 | int flags, void *data); |
1918 | extern struct dentry *mount_pseudo(struct file_system_type *, char *, | 1918 | extern struct dentry *mount_pseudo(struct file_system_type *, char *, |
1919 | const struct super_operations *ops, | 1919 | const struct super_operations *ops, |
1920 | const struct dentry_operations *dops, | 1920 | const struct dentry_operations *dops, |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 0cd1314acdaf..af2b5641fc8b 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1587,7 +1587,7 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, | |||
1587 | opts.new_root = new_root; | 1587 | opts.new_root = new_root; |
1588 | 1588 | ||
1589 | /* Locate an existing or new sb for this hierarchy */ | 1589 | /* Locate an existing or new sb for this hierarchy */ |
1590 | sb = sget(fs_type, cgroup_test_super, cgroup_set_super, &opts); | 1590 | sb = sget(fs_type, cgroup_test_super, cgroup_set_super, 0, &opts); |
1591 | if (IS_ERR(sb)) { | 1591 | if (IS_ERR(sb)) { |
1592 | ret = PTR_ERR(sb); | 1592 | ret = PTR_ERR(sb); |
1593 | cgroup_drop_root(opts.new_root); | 1593 | cgroup_drop_root(opts.new_root); |