saner calling conventions for nfs_fs_mount_common()

Allow it to take ERR_PTR() for server and return ERR_CAST() of it in
such case.  All callers used to open-code that...

Reviewed-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Al Viro 2019-12-10 07:30:49 -05:00 коммит произвёл Anna Schumaker
Родитель 95e20af9fb
Коммит 444a52960c
2 изменённых файлов: 5 добавлений и 22 удалений

Просмотреть файл

@ -110,21 +110,12 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags,
{ {
struct nfs_mount_info *mount_info = info; struct nfs_mount_info *mount_info = info;
struct nfs_server *server; struct nfs_server *server;
struct dentry *mntroot = ERR_PTR(-ENOMEM);
mount_info->set_security = nfs_set_sb_security; mount_info->set_security = nfs_set_sb_security;
/* Get a volume representation */ /* Get a volume representation */
server = nfs4_create_server(mount_info, &nfs_v4); server = nfs4_create_server(mount_info, &nfs_v4);
if (IS_ERR(server)) { return nfs_fs_mount_common(server, flags, dev_name, mount_info, &nfs_v4);
mntroot = ERR_CAST(server);
goto out;
}
mntroot = nfs_fs_mount_common(server, flags, dev_name, mount_info, &nfs_v4);
out:
return mntroot;
} }
static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type, static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type,
@ -280,11 +271,6 @@ nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags,
/* create a new volume representation */ /* create a new volume representation */
server = nfs4_create_referral_server(mount_info.cloned, mount_info.mntfh); server = nfs4_create_referral_server(mount_info.cloned, mount_info.mntfh);
if (IS_ERR(server)) {
mntroot = ERR_CAST(server);
goto out;
}
mntroot = nfs_fs_mount_common(server, flags, dev_name, &mount_info, &nfs_v4); mntroot = nfs_fs_mount_common(server, flags, dev_name, &mount_info, &nfs_v4);
out: out:
nfs_free_fhandle(mount_info.mntfh); nfs_free_fhandle(mount_info.mntfh);

Просмотреть файл

@ -1903,9 +1903,6 @@ struct dentry *nfs_try_mount(int flags, const char *dev_name,
else else
server = nfs_mod->rpc_ops->create_server(mount_info, nfs_mod); server = nfs_mod->rpc_ops->create_server(mount_info, nfs_mod);
if (IS_ERR(server))
return ERR_CAST(server);
return nfs_fs_mount_common(server, flags, dev_name, mount_info, nfs_mod); return nfs_fs_mount_common(server, flags, dev_name, mount_info, nfs_mod);
} }
EXPORT_SYMBOL_GPL(nfs_try_mount); EXPORT_SYMBOL_GPL(nfs_try_mount);
@ -2666,6 +2663,9 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server,
}; };
int error; int error;
if (IS_ERR(server))
return ERR_CAST(server);
if (server->flags & NFS_MOUNT_UNSHARED) if (server->flags & NFS_MOUNT_UNSHARED)
compare_super = NULL; compare_super = NULL;
@ -2814,10 +2814,7 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags,
/* create a new volume representation */ /* create a new volume representation */
server = nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor); server = nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor);
if (IS_ERR(server)) mntroot = nfs_fs_mount_common(server, flags,
mntroot = ERR_CAST(server);
else
mntroot = nfs_fs_mount_common(server, flags,
dev_name, &mount_info, nfs_mod); dev_name, &mount_info, nfs_mod);
dprintk("<-- nfs_xdev_mount() = %ld\n", dprintk("<-- nfs_xdev_mount() = %ld\n",