Commit 0655960f authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

NFS: Clean up error handling in nfs_get_sb

The error return logic in nfs_get_sb now matches nfs4_get_sb, and is more maintainable.
A subsequent patch will take advantage of this simplification.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 29eb981a
...@@ -633,13 +633,13 @@ static int nfs_get_sb(struct file_system_type *fs_type, ...@@ -633,13 +633,13 @@ static int nfs_get_sb(struct file_system_type *fs_type,
/* Validate the mount data */ /* Validate the mount data */
error = nfs_validate_mount_data(data, &mntfh); error = nfs_validate_mount_data(data, &mntfh);
if (error < 0) if (error < 0)
return error; goto out;
/* Get a volume representation */ /* Get a volume representation */
server = nfs_create_server(data, &mntfh); server = nfs_create_server(data, &mntfh);
if (IS_ERR(server)) { if (IS_ERR(server)) {
error = PTR_ERR(server); error = PTR_ERR(server);
goto out_err_noserver; goto out;
} }
/* 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 */
...@@ -669,17 +669,19 @@ static int nfs_get_sb(struct file_system_type *fs_type, ...@@ -669,17 +669,19 @@ static int nfs_get_sb(struct file_system_type *fs_type,
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
mnt->mnt_sb = s; mnt->mnt_sb = s;
mnt->mnt_root = mntroot; mnt->mnt_root = mntroot;
return 0; error = 0;
out:
return error;
out_err_nosb: out_err_nosb:
nfs_free_server(server); nfs_free_server(server);
out_err_noserver: goto out;
return error;
error_splat_super: error_splat_super:
up_write(&s->s_umount); up_write(&s->s_umount);
deactivate_super(s); deactivate_super(s);
return error; goto out;
} }
/* /*
......
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