NFS: Move details of nfs4_get_sb() to a helper
Clean up: Refactor nfs4_get_sb() to allow its guts to be invoked by nfs_get_sb(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
7630c852e1
commit
a6fe23be90
1 changed files with 33 additions and 15 deletions
|
@ -274,6 +274,8 @@ static const struct super_operations nfs_sops = {
|
|||
#ifdef CONFIG_NFS_V4
|
||||
static int nfs4_validate_text_mount_data(void *options,
|
||||
struct nfs_parsed_mount_data *args, const char *dev_name);
|
||||
static int nfs4_try_mount(int flags, const char *dev_name,
|
||||
struct nfs_parsed_mount_data *data, struct vfsmount *mnt);
|
||||
static int nfs4_get_sb(struct file_system_type *fs_type,
|
||||
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt);
|
||||
static int nfs4_remote_get_sb(struct file_system_type *fs_type,
|
||||
|
@ -2565,25 +2567,15 @@ out_err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the superblock for an NFS4 mountpoint
|
||||
*/
|
||||
static int nfs4_get_sb(struct file_system_type *fs_type,
|
||||
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt)
|
||||
static int nfs4_try_mount(int flags, const char *dev_name,
|
||||
struct nfs_parsed_mount_data *data,
|
||||
struct vfsmount *mnt)
|
||||
{
|
||||
struct nfs_parsed_mount_data *data;
|
||||
char *export_path;
|
||||
struct vfsmount *root_mnt;
|
||||
int error = -ENOMEM;
|
||||
int error;
|
||||
|
||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
if (data == NULL)
|
||||
goto out_free_data;
|
||||
|
||||
/* Validate the mount data */
|
||||
error = nfs4_validate_mount_data(raw_data, data, dev_name);
|
||||
if (error < 0)
|
||||
goto out;
|
||||
dfprintk(MOUNT, "--> nfs4_try_mount()\n");
|
||||
|
||||
export_path = data->nfs_server.export_path;
|
||||
data->nfs_server.export_path = "/";
|
||||
|
@ -2597,6 +2589,32 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
|
|||
|
||||
error = nfs_follow_remote_path(root_mnt, export_path, mnt);
|
||||
|
||||
out:
|
||||
dfprintk(MOUNT, "<-- nfs4_try_mount() = %d%s\n", error,
|
||||
error != 0 ? " [error]" : "");
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the superblock for an NFS4 mountpoint
|
||||
*/
|
||||
static int nfs4_get_sb(struct file_system_type *fs_type,
|
||||
int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt)
|
||||
{
|
||||
struct nfs_parsed_mount_data *data;
|
||||
int error = -ENOMEM;
|
||||
|
||||
data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
if (data == NULL)
|
||||
goto out_free_data;
|
||||
|
||||
/* Validate the mount data */
|
||||
error = nfs4_validate_mount_data(raw_data, data, dev_name);
|
||||
if (error < 0)
|
||||
goto out;
|
||||
|
||||
error = nfs4_try_mount(flags, dev_name, data, mnt);
|
||||
|
||||
out:
|
||||
kfree(data->client_address);
|
||||
kfree(data->nfs_server.export_path);
|
||||
|
|
Loading…
Reference in a new issue