Skip to content

Commit 2ed4b95

Browse files
chuckleverTrond Myklebust
authored andcommitted
NFS: Clean up nfs4_proc_get_rootfh
The long lines with no vertical white space make this function difficult for humans to read. Add a proper documenting comment while we're here. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 75bc882 commit 2ed4b95

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

‎fs/nfs/nfs4proc.c‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,24 +2547,36 @@ static int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
25472547
return status;
25482548
}
25492549

2550-
/*
2551-
* get the file handle for the "/" directory on the server
2550+
static int nfs4_do_find_root_sec(struct nfs_server *server,
2551+
struct nfs_fh *fhandle, struct nfs_fsinfo *info)
2552+
{
2553+
int mv = server->nfs_client->cl_minorversion;
2554+
return nfs_v4_minor_ops[mv]->find_root_sec(server, fhandle, info);
2555+
}
2556+
2557+
/**
2558+
* nfs4_proc_get_rootfh - get file handle for server's pseudoroot
2559+
* @server: initialized nfs_server handle
2560+
* @fhandle: we fill in the pseudo-fs root file handle
2561+
* @info: we fill in an FSINFO struct
2562+
*
2563+
* Returns zero on success, or a negative errno.
25522564
*/
25532565
int nfs4_proc_get_rootfh(struct nfs_server *server, struct nfs_fh *fhandle,
25542566
struct nfs_fsinfo *info)
25552567
{
2556-
int minor_version = server->nfs_client->cl_minorversion;
2557-
int status = nfs4_lookup_root(server, fhandle, info);
2558-
if ((status == -NFS4ERR_WRONGSEC) && !(server->flags & NFS_MOUNT_SECFLAVOUR))
2559-
/*
2560-
* A status of -NFS4ERR_WRONGSEC will be mapped to -EPERM
2561-
* by nfs4_map_errors() as this function exits.
2562-
*/
2563-
status = nfs_v4_minor_ops[minor_version]->find_root_sec(server, fhandle, info);
2568+
int status;
2569+
2570+
status = nfs4_lookup_root(server, fhandle, info);
2571+
if ((status == -NFS4ERR_WRONGSEC) &&
2572+
!(server->flags & NFS_MOUNT_SECFLAVOUR))
2573+
status = nfs4_do_find_root_sec(server, fhandle, info);
2574+
25642575
if (status == 0)
25652576
status = nfs4_server_capabilities(server, fhandle);
25662577
if (status == 0)
25672578
status = nfs4_do_fsinfo(server, fhandle, info);
2579+
25682580
return nfs4_map_errors(status);
25692581
}
25702582

0 commit comments

Comments
 (0)