mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
Register .remount_fs handler
Register the missing .remount_fs handler. This handler isn't strictly required because the VFS does a pretty good job updating most of the MS_* flags. However, there's no harm in using the hook to call the registered zpl callback for various MS_* flags. Additionaly, this allows us to lay the ground work for more complicated argument parsing in the future.
This commit is contained in:
parent
03f9ba9d99
commit
0de19dad9c
@ -187,6 +187,7 @@ extern int zfs_register_callbacks(zfs_sb_t *zsb);
|
|||||||
extern void zfs_unregister_callbacks(zfs_sb_t *zsb);
|
extern void zfs_unregister_callbacks(zfs_sb_t *zsb);
|
||||||
extern int zfs_domount(struct super_block *sb, void *data, int silent);
|
extern int zfs_domount(struct super_block *sb, void *data, int silent);
|
||||||
extern int zfs_umount(struct super_block *sb);
|
extern int zfs_umount(struct super_block *sb);
|
||||||
|
extern int zfs_remount(struct super_block *sb, int *flags, char *data);
|
||||||
extern int zfs_root(zfs_sb_t *zsb, struct inode **ipp);
|
extern int zfs_root(zfs_sb_t *zsb, struct inode **ipp);
|
||||||
extern int zfs_statvfs(struct dentry *dentry, struct kstatfs *statp);
|
extern int zfs_statvfs(struct dentry *dentry, struct kstatfs *statp);
|
||||||
extern int zfs_vget(struct vfsmount *vfsp, struct inode **ipp, fid_t *fidp);
|
extern int zfs_vget(struct vfsmount *vfsp, struct inode **ipp, fid_t *fidp);
|
||||||
|
@ -1291,6 +1291,46 @@ zfs_umount(struct super_block *sb)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(zfs_umount);
|
EXPORT_SYMBOL(zfs_umount);
|
||||||
|
|
||||||
|
int
|
||||||
|
zfs_remount(struct super_block *sb, int *flags, char *data)
|
||||||
|
{
|
||||||
|
zfs_sb_t *zsb = sb->s_fs_info;
|
||||||
|
boolean_t readonly = B_FALSE;
|
||||||
|
boolean_t setuid = B_TRUE;
|
||||||
|
boolean_t exec = B_TRUE;
|
||||||
|
boolean_t devices = B_TRUE;
|
||||||
|
boolean_t atime = B_TRUE;
|
||||||
|
|
||||||
|
if (*flags & MS_RDONLY)
|
||||||
|
readonly = B_TRUE;
|
||||||
|
|
||||||
|
if (*flags & MS_NOSUID) {
|
||||||
|
devices = B_FALSE;
|
||||||
|
setuid = B_FALSE;
|
||||||
|
} else {
|
||||||
|
if (*flags & MS_NODEV)
|
||||||
|
devices = B_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*flags & MS_NOEXEC)
|
||||||
|
exec = B_FALSE;
|
||||||
|
|
||||||
|
if (*flags & MS_NOATIME)
|
||||||
|
atime = B_FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Invoke our callbacks to set required flags.
|
||||||
|
*/
|
||||||
|
readonly_changed_cb(zsb, readonly);
|
||||||
|
setuid_changed_cb(zsb, setuid);
|
||||||
|
exec_changed_cb(zsb, exec);
|
||||||
|
devices_changed_cb(zsb, devices);
|
||||||
|
atime_changed_cb(zsb, atime);
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(zfs_remount);
|
||||||
|
|
||||||
int
|
int
|
||||||
zfs_vget(struct vfsmount *vfsp, struct inode **ipp, fid_t *fidp)
|
zfs_vget(struct vfsmount *vfsp, struct inode **ipp, fid_t *fidp)
|
||||||
{
|
{
|
||||||
|
@ -129,6 +129,16 @@ zpl_statfs(struct dentry *dentry, struct kstatfs *statp)
|
|||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
zpl_remount_fs(struct super_block *sb, int *flags, char *data)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
error = -zfs_remount(sb, flags, data);
|
||||||
|
ASSERT3S(error, <=, 0);
|
||||||
|
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zpl_show_options(struct seq_file *seq, struct vfsmount *vfsp)
|
zpl_show_options(struct seq_file *seq, struct vfsmount *vfsp)
|
||||||
{
|
{
|
||||||
@ -197,7 +207,7 @@ const struct super_operations zpl_super_operations = {
|
|||||||
.freeze_fs = NULL,
|
.freeze_fs = NULL,
|
||||||
.unfreeze_fs = NULL,
|
.unfreeze_fs = NULL,
|
||||||
.statfs = zpl_statfs,
|
.statfs = zpl_statfs,
|
||||||
.remount_fs = NULL,
|
.remount_fs = zpl_remount_fs,
|
||||||
.show_options = zpl_show_options,
|
.show_options = zpl_show_options,
|
||||||
.show_stats = NULL,
|
.show_stats = NULL,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user