diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 22:16:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 22:16:57 -0400 |
commit | 1fad1e9a747687a7399bf58e87974f9b1bbcae06 (patch) | |
tree | fde2dc9a35321e21c99e06d4b79d5fa06fd34679 /fs/nfs/nfs4getroot.c | |
parent | bbeb0af25f493261c15ceee176c99b7fd6fd5479 (diff) | |
parent | f44106e2173f08ccb1c9195d85a6c22388b461c1 (diff) |
Merge tag 'nfs-for-3.6-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client updates from Trond Myklebust:
"Features include:
- More preparatory patches for modularising NFSv2/v3/v4. Split out
the various NFSv2/v3/v4-specific code into separate files
- More preparation for the NFSv4 migration code
- Ensure that OPEN(O_CREATE) observes the pNFS mds threshold
parameters
- pNFS fast failover when the data servers are down
- Various cleanups and debugging patches"
* tag 'nfs-for-3.6-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (67 commits)
nfs: fix fl_type tests in NFSv4 code
NFS: fix pnfs regression with directio writes
NFS: fix pnfs regression with directio reads
sunrpc: clnt: Add missing braces
nfs: fix stub return type warnings
NFS: exit_nfs_v4() shouldn't be an __exit function
SUNRPC: Add a missing spin_unlock to gss_mech_list_pseudoflavors
NFS: Split out NFS v4 client functions
NFS: Split out the NFS v4 filesystem types
NFS: Create a single nfs_clone_super() function
NFS: Split out NFS v4 server creating code
NFS: Initialize the NFS v4 client from init_nfs_v4()
NFS: Move the v4 getroot code to nfs4getroot.c
NFS: Split out NFS v4 file operations
NFS: Initialize v4 sysctls from nfs_init_v4()
NFS: Create an init_nfs_v4() function
NFS: Split out NFS v4 inode operations
NFS: Split out NFS v3 inode operations
NFS: Split out NFS v2 inode operations
NFS: Clean up nfs4_proc_setclientid() and friends
...
Diffstat (limited to 'fs/nfs/nfs4getroot.c')
-rw-r--r-- | fs/nfs/nfs4getroot.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/fs/nfs/nfs4getroot.c b/fs/nfs/nfs4getroot.c new file mode 100644 index 000000000000..6a83780e0ce6 --- /dev/null +++ b/fs/nfs/nfs4getroot.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. | ||
3 | * Written by David Howells (dhowells@redhat.com) | ||
4 | */ | ||
5 | |||
6 | #include <linux/nfs_fs.h> | ||
7 | #include "nfs4_fs.h" | ||
8 | |||
9 | #define NFSDBG_FACILITY NFSDBG_CLIENT | ||
10 | |||
11 | int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh) | ||
12 | { | ||
13 | struct nfs_fsinfo fsinfo; | ||
14 | int ret = -ENOMEM; | ||
15 | |||
16 | dprintk("--> nfs4_get_rootfh()\n"); | ||
17 | |||
18 | fsinfo.fattr = nfs_alloc_fattr(); | ||
19 | if (fsinfo.fattr == NULL) | ||
20 | goto out; | ||
21 | |||
22 | /* Start by getting the root filehandle from the server */ | ||
23 | ret = nfs4_proc_get_rootfh(server, mntfh, &fsinfo); | ||
24 | if (ret < 0) { | ||
25 | dprintk("nfs4_get_rootfh: getroot error = %d\n", -ret); | ||
26 | goto out; | ||
27 | } | ||
28 | |||
29 | if (!(fsinfo.fattr->valid & NFS_ATTR_FATTR_TYPE) | ||
30 | || !S_ISDIR(fsinfo.fattr->mode)) { | ||
31 | printk(KERN_ERR "nfs4_get_rootfh:" | ||
32 | " getroot encountered non-directory\n"); | ||
33 | ret = -ENOTDIR; | ||
34 | goto out; | ||
35 | } | ||
36 | |||
37 | if (fsinfo.fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) { | ||
38 | printk(KERN_ERR "nfs4_get_rootfh:" | ||
39 | " getroot obtained referral\n"); | ||
40 | ret = -EREMOTE; | ||
41 | goto out; | ||
42 | } | ||
43 | |||
44 | memcpy(&server->fsid, &fsinfo.fattr->fsid, sizeof(server->fsid)); | ||
45 | out: | ||
46 | nfs_free_fattr(fsinfo.fattr); | ||
47 | dprintk("<-- nfs4_get_rootfh() = %d\n", ret); | ||
48 | return ret; | ||
49 | } | ||