| // 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> |
| #define NFSDBG_FACILITY NFSDBG_CLIENT |
| int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh, bool auth_probe) |
| struct nfs_fsinfo fsinfo; |
| fsinfo.fattr = nfs_alloc_fattr(); |
| if (fsinfo.fattr == NULL) |
| /* Start by getting the root filehandle from the server */ |
| ret = nfs4_proc_get_rootfh(server, mntfh, &fsinfo, auth_probe); |
| dprintk("nfs4_get_rootfh: getroot error = %d\n", -ret); |
| if (!(fsinfo.fattr->valid & NFS_ATTR_FATTR_TYPE) |
| || !S_ISDIR(fsinfo.fattr->mode)) { |
| printk(KERN_ERR "nfs4_get_rootfh:" |
| " getroot encountered non-directory\n"); |
| memcpy(&server->fsid, &fsinfo.fattr->fsid, sizeof(server->fsid)); |
| nfs_free_fattr(fsinfo.fattr); |