Commit 9249e17f authored by David Howells's avatar David Howells Committed by Al Viro

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: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent f015f126
...@@ -63,7 +63,7 @@ static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags, ...@@ -63,7 +63,7 @@ static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags,
struct super_block *sb; struct super_block *sb;
int ret; int ret;
sb = sget(fs_type, get_sb_mtd_compare, get_sb_mtd_set, mtd); sb = sget(fs_type, get_sb_mtd_compare, get_sb_mtd_set, flags, mtd);
if (IS_ERR(sb)) if (IS_ERR(sb))
goto out_error; goto out_error;
...@@ -74,8 +74,6 @@ static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags, ...@@ -74,8 +74,6 @@ static struct dentry *mount_mtd_aux(struct file_system_type *fs_type, int flags,
pr_debug("MTDSB: New superblock for device %d (\"%s\")\n", pr_debug("MTDSB: New superblock for device %d (\"%s\")\n",
mtd->index, mtd->name); mtd->index, mtd->name);
sb->s_flags = flags;
ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
if (ret < 0) { if (ret < 0) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
......
...@@ -89,7 +89,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, ...@@ -89,7 +89,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
if (v9ses->cache) if (v9ses->cache)
sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024)/PAGE_CACHE_SIZE; sb->s_bdi->ra_pages = (VM_MAX_READAHEAD * 1024)/PAGE_CACHE_SIZE;
sb->s_flags = flags | MS_ACTIVE | MS_DIRSYNC | MS_NOATIME; sb->s_flags |= MS_ACTIVE | MS_DIRSYNC | MS_NOATIME;
if (!v9ses->cache) if (!v9ses->cache)
sb->s_flags |= MS_SYNCHRONOUS; sb->s_flags |= MS_SYNCHRONOUS;
...@@ -137,7 +137,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, ...@@ -137,7 +137,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
goto close_session; goto close_session;
} }
sb = sget(fs_type, NULL, v9fs_set_super, v9ses); sb = sget(fs_type, NULL, v9fs_set_super, flags, v9ses);
if (IS_ERR(sb)) { if (IS_ERR(sb)) {
retval = PTR_ERR(sb); retval = PTR_ERR(sb);
goto clunk_fid; goto clunk_fid;
......
...@@ -395,7 +395,7 @@ static struct dentry *afs_mount(struct file_system_type *fs_type, ...@@ -395,7 +395,7 @@ static struct dentry *afs_mount(struct file_system_type *fs_type,
as->volume = vol; as->volume = vol;
/* allocate a deviceless superblock */ /* allocate a deviceless superblock */
sb = sget(fs_type, afs_test_super, afs_set_super, as); sb = sget(fs_type, afs_test_super, afs_set_super, flags, as);
if (IS_ERR(sb)) { if (IS_ERR(sb)) {
ret = PTR_ERR(sb); ret = PTR_ERR(sb);
afs_put_volume(vol); afs_put_volume(vol);
...@@ -406,7 +406,6 @@ static struct dentry *afs_mount(struct file_system_type *fs_type, ...@@ -406,7 +406,6 @@ static struct dentry *afs_mount(struct file_system_type *fs_type,
if (!sb->s_root) { if (!sb->s_root) {
/* initial superblock/root creation */ /* initial superblock/root creation */
_debug("create"); _debug("create");
sb->s_flags = flags;
ret = afs_fill_super(sb, &params); ret = afs_fill_super(sb, &params);
if (ret < 0) { if (ret < 0) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
......
...@@ -1068,7 +1068,8 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, ...@@ -1068,7 +1068,8 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
} }
bdev = fs_devices->latest_bdev; bdev = fs_devices->latest_bdev;
s = sget(fs_type, btrfs_test_super, btrfs_set_super, fs_info); s = sget(fs_type, btrfs_test_super, btrfs_set_super, flags | MS_NOSEC,
fs_info);
if (IS_ERR(s)) { if (IS_ERR(s)) {
error = PTR_ERR(s); error = PTR_ERR(s);
goto error_close_devices; goto error_close_devices;
...@@ -1082,7 +1083,6 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, ...@@ -1082,7 +1083,6 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
} else { } else {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
s->s_flags = flags | MS_NOSEC;
strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
btrfs_sb(s)->bdev_holder = fs_type; btrfs_sb(s)->bdev_holder = fs_type;
error = btrfs_fill_super(s, fs_devices, data, error = btrfs_fill_super(s, fs_devices, data,
......
...@@ -871,7 +871,7 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type, ...@@ -871,7 +871,7 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type,
if (ceph_test_opt(fsc->client, NOSHARE)) if (ceph_test_opt(fsc->client, NOSHARE))
compare_super = NULL; compare_super = NULL;
sb = sget(fs_type, compare_super, ceph_set_super, fsc); sb = sget(fs_type, compare_super, ceph_set_super, flags, fsc);
if (IS_ERR(sb)) { if (IS_ERR(sb)) {
res = ERR_CAST(sb); res = ERR_CAST(sb);
goto out; goto out;
......
...@@ -637,7 +637,10 @@ cifs_do_mount(struct file_system_type *fs_type, ...@@ -637,7 +637,10 @@ cifs_do_mount(struct file_system_type *fs_type,
mnt_data.cifs_sb = cifs_sb; mnt_data.cifs_sb = cifs_sb;
mnt_data.flags = flags; mnt_data.flags = flags;
sb = sget(fs_type, cifs_match_super, cifs_set_super, &mnt_data); /* BB should we make this contingent on mount parm? */
flags |= MS_NODIRATIME | MS_NOATIME;
sb = sget(fs_type, cifs_match_super, cifs_set_super, flags, &mnt_data);
if (IS_ERR(sb)) { if (IS_ERR(sb)) {
root = ERR_CAST(sb); root = ERR_CAST(sb);
cifs_umount(cifs_sb); cifs_umount(cifs_sb);
...@@ -648,10 +651,6 @@ cifs_do_mount(struct file_system_type *fs_type, ...@@ -648,10 +651,6 @@ cifs_do_mount(struct file_system_type *fs_type,
cFYI(1, "Use existing superblock"); cFYI(1, "Use existing superblock");
cifs_umount(cifs_sb); cifs_umount(cifs_sb);
} else { } else {
sb->s_flags = flags;
/* BB should we make this contingent on mount parm? */
sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
rc = cifs_read_super(sb); rc = cifs_read_super(sb);
if (rc) { if (rc) {
root = ERR_PTR(rc); root = ERR_PTR(rc);
......
...@@ -439,15 +439,15 @@ static struct dentry *devpts_mount(struct file_system_type *fs_type, ...@@ -439,15 +439,15 @@ static struct dentry *devpts_mount(struct file_system_type *fs_type,
return ERR_PTR(error); return ERR_PTR(error);
if (opts.newinstance) if (opts.newinstance)
s = sget(fs_type, NULL, set_anon_super, NULL); s = sget(fs_type, NULL, set_anon_super, flags, NULL);
else else
s = sget(fs_type, compare_init_pts_sb, set_anon_super, NULL); s = sget(fs_type, compare_init_pts_sb, set_anon_super, flags,
NULL);
if (IS_ERR(s)) if (IS_ERR(s))
return ERR_CAST(s); return ERR_CAST(s);
if (!s->s_root) { if (!s->s_root) {
s->s_flags = flags;
error = devpts_fill_super(s, data, flags & MS_SILENT ? 1 : 0); error = devpts_fill_super(s, data, flags & MS_SILENT ? 1 : 0);
if (error) if (error)
goto out_undo_sget; goto out_undo_sget;
......
...@@ -499,13 +499,12 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags ...@@ -499,13 +499,12 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
goto out; goto out;
} }
s = sget(fs_type, NULL, set_anon_super, NULL); s = sget(fs_type, NULL, set_anon_super, flags, NULL);
if (IS_ERR(s)) { if (IS_ERR(s)) {
rc = PTR_ERR(s); rc = PTR_ERR(s);
goto out; goto out;
} }
s->s_flags = flags;
rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs", BDI_CAP_MAP_COPY);
if (rc) if (rc)
goto out1; goto out1;
......
...@@ -1286,7 +1286,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags, ...@@ -1286,7 +1286,7 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
error = -EBUSY; error = -EBUSY;
goto error_bdev; goto error_bdev;
} }
s = sget(fs_type, test_gfs2_super, set_gfs2_super, bdev); s = sget(fs_type, test_gfs2_super, set_gfs2_super, flags, bdev);
mutex_unlock(&bdev->bd_fsfreeze_mutex); mutex_unlock(&bdev->bd_fsfreeze_mutex);
error = PTR_ERR(s); error = PTR_ERR(s);
if (IS_ERR(s)) if (IS_ERR(s))
...@@ -1316,7 +1316,6 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags, ...@@ -1316,7 +1316,6 @@ static struct dentry *gfs2_mount(struct file_system_type *fs_type, int flags,
} else { } else {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
s->s_flags = flags;
s->s_mode = mode; s->s_mode = mode;
strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
sb_set_blocksize(s, block_size(bdev)); sb_set_blocksize(s, block_size(bdev));
...@@ -1360,7 +1359,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type, ...@@ -1360,7 +1359,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
dev_name, error); dev_name, error);
return ERR_PTR(error); return ERR_PTR(error);
} }
s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags,
path.dentry->d_inode->i_sb->s_bdev); path.dentry->d_inode->i_sb->s_bdev);
path_put(&path); path_put(&path);
if (IS_ERR(s)) { if (IS_ERR(s)) {
......
...@@ -222,15 +222,15 @@ struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name, ...@@ -222,15 +222,15 @@ struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name,
const struct super_operations *ops, const struct super_operations *ops,
const struct dentry_operations *dops, unsigned long magic) const struct dentry_operations *dops, unsigned long magic)
{ {
struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); struct super_block *s;
struct dentry *dentry; struct dentry *dentry;
struct inode *root; struct inode *root;
struct qstr d_name = QSTR_INIT(name, strlen(name)); struct qstr d_name = QSTR_INIT(name, strlen(name));
s = sget(fs_type, NULL, set_anon_super, MS_NOUSER, NULL);
if (IS_ERR(s)) if (IS_ERR(s))
return ERR_CAST(s); return ERR_CAST(s);
s->s_flags = MS_NOUSER;
s->s_maxbytes = MAX_LFS_FILESIZE; s->s_maxbytes = MAX_LFS_FILESIZE;
s->s_blocksize = PAGE_SIZE; s->s_blocksize = PAGE_SIZE;
s->s_blocksize_bits = PAGE_SHIFT; s->s_blocksize_bits = PAGE_SHIFT;
......
...@@ -519,7 +519,7 @@ static struct dentry *logfs_get_sb_device(struct logfs_super *super, ...@@ -519,7 +519,7 @@ static struct dentry *logfs_get_sb_device(struct logfs_super *super,
log_super("LogFS: Start mount %x\n", mount_count++); log_super("LogFS: Start mount %x\n", mount_count++);
err = -EINVAL; err = -EINVAL;
sb = sget(type, logfs_sb_test, logfs_sb_set, super); sb = sget(type, logfs_sb_test, logfs_sb_set, flags | MS_NOATIME, super);
if (IS_ERR(sb)) { if (IS_ERR(sb)) {
super->s_devops->put_device(super); super->s_devops->put_device(super);
kfree(super); kfree(super);
...@@ -542,7 +542,6 @@ static struct dentry *logfs_get_sb_device(struct logfs_super *super, ...@@ -542,7 +542,6 @@ static struct dentry *logfs_get_sb_device(struct logfs_super *super,
sb->s_maxbytes = (1ull << 43) - 1; sb->s_maxbytes = (1ull << 43) - 1;
sb->s_max_links = LOGFS_LINK_MAX; sb->s_max_links = LOGFS_LINK_MAX;
sb->s_op = &logfs_super_operations; sb->s_op = &logfs_super_operations;
sb->s_flags = flags | MS_NOATIME;
err = logfs_read_sb(sb, sb->s_flags & MS_RDONLY); err = logfs_read_sb(sb, sb->s_flags & MS_RDONLY);
if (err) if (err)
......
...@@ -2419,7 +2419,7 @@ static struct dentry *nfs_fs_mount_common(struct file_system_type *fs_type, ...@@ -2419,7 +2419,7 @@ static struct dentry *nfs_fs_mount_common(struct file_system_type *fs_type,
sb_mntdata.mntflags |= MS_SYNCHRONOUS; sb_mntdata.mntflags |= MS_SYNCHRONOUS;
/* Get a superblock - note that we may end up sharing one that already exists */ /* Get a superblock - note that we may end up sharing one that already exists */
s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata); s = sget(fs_type, compare_super, nfs_set_super, flags, &sb_mntdata);
if (IS_ERR(s)) { if (IS_ERR(s)) {
mntroot = ERR_CAST(s); mntroot = ERR_CAST(s);
goto out_err_nosb; goto out_err_nosb;
......
...@@ -1288,7 +1288,8 @@ nilfs_mount(struct file_system_type *fs_type, int flags, ...@@ -1288,7 +1288,8 @@ nilfs_mount(struct file_system_type *fs_type, int flags,
err = -EBUSY; err = -EBUSY;
goto failed; goto failed;
} }
s = sget(fs_type, nilfs_test_bdev_super, nilfs_set_bdev_super, sd.bdev); s = sget(fs_type, nilfs_test_bdev_super, nilfs_set_bdev_super, flags,
sd.bdev);
mutex_unlock(&sd.bdev->bd_fsfreeze_mutex); mutex_unlock(&sd.bdev->bd_fsfreeze_mutex);
if (IS_ERR(s)) { if (IS_ERR(s)) {
err = PTR_ERR(s); err = PTR_ERR(s);
...@@ -1301,7 +1302,6 @@ nilfs_mount(struct file_system_type *fs_type, int flags, ...@@ -1301,7 +1302,6 @@ nilfs_mount(struct file_system_type *fs_type, int flags,
s_new = true; s_new = true;
/* New superblock instance created */ /* New superblock instance created */
s->s_flags = flags;
s->s_mode = mode; s->s_mode = mode;
strlcpy(s->s_id, bdevname(sd.bdev, b), sizeof(s->s_id)); strlcpy(s->s_id, bdevname(sd.bdev, b), sizeof(s->s_id));
sb_set_blocksize(s, block_size(sd.bdev)); sb_set_blocksize(s, block_size(sd.bdev));
......
...@@ -111,7 +111,7 @@ static struct dentry *proc_mount(struct file_system_type *fs_type, ...@@ -111,7 +111,7 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
options = data; options = data;
} }
sb = sget(fs_type, proc_test_super, proc_set_super, ns); sb = sget(fs_type, proc_test_super, proc_set_super, flags, ns);
if (IS_ERR(sb)) if (IS_ERR(sb))
return ERR_CAST(sb); return ERR_CAST(sb);
...@@ -121,7 +121,6 @@ static struct dentry *proc_mount(struct file_system_type *fs_type, ...@@ -121,7 +121,6 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
} }
if (!sb->s_root) { if (!sb->s_root) {
sb->s_flags = flags;
err = proc_fill_super(sb); err = proc_fill_super(sb);
if (err) { if (err) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
......
...@@ -403,7 +403,7 @@ static void *r_start(struct seq_file *m, loff_t * pos) ...@@ -403,7 +403,7 @@ static void *r_start(struct seq_file *m, loff_t * pos)
if (l) if (l)
return NULL; return NULL;
if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, s))) if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, s)))
return NULL; return NULL;
up_write(&s->s_umount); up_write(&s->s_umount);
......
...@@ -105,11 +105,12 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc) ...@@ -105,11 +105,12 @@ static int prune_super(struct shrinker *shrink, struct shrink_control *sc)
/** /**
* alloc_super - create new superblock * alloc_super - create new superblock
* @type: filesystem type superblock should belong to * @type: filesystem type superblock should belong to
* @flags: the mount flags
* *
* Allocates and initializes a new &struct super_block. alloc_super() * Allocates and initializes a new &struct super_block. alloc_super()
* returns a pointer new superblock or %NULL if allocation had failed. * returns a pointer new superblock or %NULL if allocation had failed.
*/ */
static struct super_block *alloc_super(struct file_system_type *type) static struct super_block *alloc_super(struct file_system_type *type, int flags)
{ {
struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER);
static const struct super_operations default_op; static const struct super_operations default_op;
...@@ -136,6 +137,7 @@ static struct super_block *alloc_super(struct file_system_type *type) ...@@ -136,6 +137,7 @@ static struct super_block *alloc_super(struct file_system_type *type)
#else #else
INIT_LIST_HEAD(&s->s_files); INIT_LIST_HEAD(&s->s_files);
#endif #endif
s->s_flags = flags;
s->s_bdi = &default_backing_dev_info; s->s_bdi = &default_backing_dev_info;
INIT_HLIST_NODE(&s->s_instances); INIT_HLIST_NODE(&s->s_instances);
INIT_HLIST_BL_HEAD(&s->s_anon); INIT_HLIST_BL_HEAD(&s->s_anon);
...@@ -415,11 +417,13 @@ EXPORT_SYMBOL(generic_shutdown_super); ...@@ -415,11 +417,13 @@ EXPORT_SYMBOL(generic_shutdown_super);
* @type: filesystem type superblock should belong to * @type: filesystem type superblock should belong to
* @test: comparison callback * @test: comparison callback
* @set: setup callback * @set: setup callback
* @flags: mount flags
* @data: argument to each of them * @data: argument to each of them
*/ */
struct super_block *sget(struct file_system_type *type, struct super_block *sget(struct file_system_type *type,
int (*test)(struct super_block *,void *), int (*test)(struct super_block *,void *),
int (*set)(struct super_block *,void *), int (*set)(struct super_block *,void *),
int flags,
void *data) void *data)
{ {
struct super_block *s = NULL; struct super_block *s = NULL;
...@@ -450,7 +454,7 @@ struct super_block *sget(struct file_system_type *type, ...@@ -450,7 +454,7 @@ struct super_block *sget(struct file_system_type *type,
} }
if (!s) { if (!s) {
spin_unlock(&sb_lock); spin_unlock(&sb_lock);
s = alloc_super(type); s = alloc_super(type, flags);
if (!s) if (!s)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
goto retry; goto retry;
...@@ -925,13 +929,12 @@ struct dentry *mount_ns(struct file_system_type *fs_type, int flags, ...@@ -925,13 +929,12 @@ struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
{ {
struct super_block *sb; struct super_block *sb;
sb = sget(fs_type, ns_test_super, ns_set_super, data); sb = sget(fs_type, ns_test_super, ns_set_super, flags, data);
if (IS_ERR(sb)) if (IS_ERR(sb))
return ERR_CAST(sb); return ERR_CAST(sb);
if (!sb->s_root) { if (!sb->s_root) {
int err; int err;
sb->s_flags = flags;
err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
if (err) { if (err) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
...@@ -992,7 +995,8 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, ...@@ -992,7 +995,8 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,
error = -EBUSY; error = -EBUSY;
goto error_bdev; goto error_bdev;
} }
s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); s = sget(fs_type, test_bdev_super, set_bdev_super, flags | MS_NOSEC,
bdev);
mutex_unlock(&bdev->bd_fsfreeze_mutex); mutex_unlock(&bdev->bd_fsfreeze_mutex);
if (IS_ERR(s)) if (IS_ERR(s))
goto error_s; goto error_s;
...@@ -1017,7 +1021,6 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, ...@@ -1017,7 +1021,6 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,
} else { } else {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
s->s_flags = flags | MS_NOSEC;
s->s_mode = mode; s->s_mode = mode;
strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
sb_set_blocksize(s, block_size(bdev)); sb_set_blocksize(s, block_size(bdev));
...@@ -1062,13 +1065,11 @@ struct dentry *mount_nodev(struct file_system_type *fs_type, ...@@ -1062,13 +1065,11 @@ struct dentry *mount_nodev(struct file_system_type *fs_type,
int (*fill_super)(struct super_block *, void *, int)) int (*fill_super)(struct super_block *, void *, int))
{ {
int error; int error;
struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); struct super_block *s = sget(fs_type, NULL, set_anon_super, flags, NULL);
if (IS_ERR(s)) if (IS_ERR(s))
return ERR_CAST(s); return ERR_CAST(s);
s->s_flags = flags;
error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
if (error) { if (error) {
deactivate_locked_super(s); deactivate_locked_super(s);
...@@ -1091,11 +1092,10 @@ struct dentry *mount_single(struct file_system_type *fs_type, ...@@ -1091,11 +1092,10 @@ struct dentry *mount_single(struct file_system_type *fs_type,
struct super_block *s; struct super_block *s;
int error; int error;
s = sget(fs_type, compare_single, set_anon_super, NULL); s = sget(fs_type, compare_single, set_anon_super, flags, NULL);
if (IS_ERR(s)) if (IS_ERR(s))
return ERR_CAST(s); return ERR_CAST(s);
if (!s->s_root) { if (!s->s_root) {
s->s_flags = flags;
error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
if (error) { if (error) {
deactivate_locked_super(s); deactivate_locked_super(s);
......
...@@ -118,13 +118,12 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type, ...@@ -118,13 +118,12 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type,
for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++) for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++)
info->ns[type] = kobj_ns_grab_current(type); info->ns[type] = kobj_ns_grab_current(type);
sb = sget(fs_type, sysfs_test_super, sysfs_set_super, info); sb = sget(fs_type, sysfs_test_super, sysfs_set_super, flags, info);
if (IS_ERR(sb) || sb->s_fs_info != info) if (IS_ERR(sb) || sb->s_fs_info != info)
free_sysfs_super_info(info); free_sysfs_super_info(info);
if (IS_ERR(sb)) if (IS_ERR(sb))
return ERR_CAST(sb); return ERR_CAST(sb);
if (!sb->s_root) { if (!sb->s_root) {
sb->s_flags = flags;
error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
if (error) { if (error) {
deactivate_locked_super(sb); deactivate_locked_super(sb);
......
...@@ -2136,7 +2136,7 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, ...@@ -2136,7 +2136,7 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
dbg_gen("opened ubi%d_%d", c->vi.ubi_num, c->vi.vol_id); dbg_gen("opened ubi%d_%d", c->vi.ubi_num, c->vi.vol_id);
sb = sget(fs_type, sb_test, sb_set, c); sb = sget(fs_type, sb_test, sb_set, flags, c);
if (IS_ERR(sb)) { if (IS_ERR(sb)) {
err = PTR_ERR(sb); err = PTR_ERR(sb);
kfree(c); kfree(c);
...@@ -2153,7 +2153,6 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, ...@@ -2153,7 +2153,6 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
goto out_deact; goto out_deact;
} }
} else { } else {
sb->s_flags = flags;
err = ubifs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); err = ubifs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
if (err) if (err)
goto out_deact; goto out_deact;
......
...@@ -1914,7 +1914,7 @@ void free_anon_bdev(dev_t); ...@@ -1914,7 +1914,7 @@ void free_anon_bdev(dev_t);
struct super_block *sget(struct file_system_type *type, struct super_block *sget(struct file_system_type *type,
int (*test)(struct super_block *,void *), int (*test)(struct super_block *,void *),
int (*set)(struct super_block *,void *), int (*set)(struct super_block *,void *),
void *data); int flags, void *data);
extern struct dentry *mount_pseudo(struct file_system_type *, char *, extern struct dentry *mount_pseudo(struct file_system_type *, char *,
const struct super_operations *ops, const struct super_operations *ops,
const struct dentry_operations *dops, const struct dentry_operations *dops,
......
...@@ -1587,7 +1587,7 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, ...@@ -1587,7 +1587,7 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
opts.new_root = new_root; opts.new_root = new_root;
/* Locate an existing or new sb for this hierarchy */ /* Locate an existing or new sb for this hierarchy */
sb = sget(fs_type, cgroup_test_super, cgroup_set_super, &opts); sb = sget(fs_type, cgroup_test_super, cgroup_set_super, 0, &opts);
if (IS_ERR(sb)) { if (IS_ERR(sb)) {
ret = PTR_ERR(sb); ret = PTR_ERR(sb);
cgroup_drop_root(opts.new_root); cgroup_drop_root(opts.new_root);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment