[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <155862815043.26654.10359128329402412912.stgit@warthog.procyon.org.uk>
Date: Thu, 23 May 2019 17:15:50 +0100
From: David Howells <dhowells@...hat.com>
To: trond.myklebust@...merspace.com, anna.schumaker@...app.com
Cc: Al Viro <viro@...iv.linux.org.uk>, dhowells@...hat.com,
viro@...iv.linux.org.uk, linux-nfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 01/23] saner calling conventions for nfs_fs_mount_common()
From: Al Viro <viro@...iv.linux.org.uk>
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@...hat.com>
Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
fs/nfs/nfs4super.c | 16 +---------------
fs/nfs/super.c | 11 ++++-------
2 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c
index 689977e148cb..a392e9454287 100644
--- a/fs/nfs/nfs4super.c
+++ b/fs/nfs/nfs4super.c
@@ -109,21 +109,12 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags,
{
struct nfs_mount_info *mount_info = info;
struct nfs_server *server;
- struct dentry *mntroot = ERR_PTR(-ENOMEM);
mount_info->set_security = nfs_set_sb_security;
/* Get a volume representation */
server = nfs4_create_server(mount_info, &nfs_v4);
- if (IS_ERR(server)) {
- mntroot = ERR_CAST(server);
- goto out;
- }
-
- mntroot = nfs_fs_mount_common(server, flags, dev_name, mount_info, &nfs_v4);
-
-out:
- return mntroot;
+ return nfs_fs_mount_common(server, flags, dev_name, mount_info, &nfs_v4);
}
static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type,
@@ -279,11 +270,6 @@ nfs4_remote_referral_mount(struct file_system_type *fs_type, int flags,
/* create a new volume representation */
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);
out:
nfs_free_fhandle(mount_info.mntfh);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index d6c687419a81..e4108e20af0f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1881,9 +1881,6 @@ struct dentry *nfs_try_mount(int flags, const char *dev_name,
else
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);
}
EXPORT_SYMBOL_GPL(nfs_try_mount);
@@ -2618,6 +2615,9 @@ struct dentry *nfs_fs_mount_common(struct nfs_server *server,
};
int error;
+ if (IS_ERR(server))
+ return ERR_CAST(server);
+
if (server->flags & NFS_MOUNT_UNSHARED)
compare_super = NULL;
@@ -2766,10 +2766,7 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags,
/* create a new volume representation */
server = nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor);
- if (IS_ERR(server))
- mntroot = ERR_CAST(server);
- else
- mntroot = nfs_fs_mount_common(server, flags,
+ mntroot = nfs_fs_mount_common(server, flags,
dev_name, &mount_info, nfs_mod);
dprintk("<-- nfs_xdev_mount() = %ld\n",
Powered by blists - more mailing lists