mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-08-17 17:47:28 +00:00

When crossing into a new filesystem, the NFSv4 client will look up the new directory, and then call nfs4_server_capabilities() as well as nfs4_do_fsinfo() at least twice. This patch removes the duplicate calls, and reduces the initial lookup to retrieve just a minimal set of attributes. Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
40 lines
955 B
C
40 lines
955 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
|
|
* Written by David Howells (dhowells@redhat.com)
|
|
*/
|
|
|
|
#include <linux/nfs_fs.h>
|
|
#include "nfs4_fs.h"
|
|
#include "internal.h"
|
|
|
|
#define NFSDBG_FACILITY NFSDBG_CLIENT
|
|
|
|
int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh, bool auth_probe)
|
|
{
|
|
struct nfs_fattr *fattr = nfs_alloc_fattr();
|
|
int ret = -ENOMEM;
|
|
|
|
if (fattr == NULL)
|
|
goto out;
|
|
|
|
/* Start by getting the root filehandle from the server */
|
|
ret = nfs4_proc_get_rootfh(server, mntfh, fattr, auth_probe);
|
|
if (ret < 0) {
|
|
dprintk("nfs4_get_rootfh: getroot error = %d\n", -ret);
|
|
goto out;
|
|
}
|
|
|
|
if (!(fattr->valid & NFS_ATTR_FATTR_TYPE) || !S_ISDIR(fattr->mode)) {
|
|
printk(KERN_ERR "nfs4_get_rootfh:"
|
|
" getroot encountered non-directory\n");
|
|
ret = -ENOTDIR;
|
|
goto out;
|
|
}
|
|
|
|
memcpy(&server->fsid, &fattr->fsid, sizeof(server->fsid));
|
|
out:
|
|
nfs_free_fattr(fattr);
|
|
return ret;
|
|
}
|