David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/nfs/super.c |
| 3 | * |
| 4 | * Copyright (C) 1992 Rick Sladkey |
| 5 | * |
| 6 | * nfs superblock handling functions |
| 7 | * |
| 8 | * Modularised by Alan Cox <Alan.Cox@linux.org>, while hacking some |
| 9 | * experimental NFS changes. Modularisation taken straight from SYS5 fs. |
| 10 | * |
| 11 | * Change to nfs_read_super() to permit NFS mounts to multi-homed hosts. |
| 12 | * J.S.Peatfield@damtp.cam.ac.uk |
| 13 | * |
| 14 | * Split from inode.c by David Howells <dhowells@redhat.com> |
| 15 | * |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 16 | * - superblocks are indexed on server only - all inodes, dentries, etc. associated with a |
| 17 | * particular server are held in the same superblock |
| 18 | * - NFS superblocks can have several effective roots to the dentry tree |
| 19 | * - directory type roots are spliced into the tree when a path from one root reaches the root |
| 20 | * of another (see nfs_lookup()) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 21 | */ |
| 22 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 23 | #include <linux/module.h> |
| 24 | #include <linux/init.h> |
| 25 | |
| 26 | #include <linux/time.h> |
| 27 | #include <linux/kernel.h> |
| 28 | #include <linux/mm.h> |
| 29 | #include <linux/string.h> |
| 30 | #include <linux/stat.h> |
| 31 | #include <linux/errno.h> |
| 32 | #include <linux/unistd.h> |
| 33 | #include <linux/sunrpc/clnt.h> |
| 34 | #include <linux/sunrpc/stats.h> |
| 35 | #include <linux/sunrpc/metrics.h> |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 36 | #include <linux/sunrpc/xprtsock.h> |
\"Talpey, Thomas\ | 2cf7ff7 | 2007-09-10 13:49:41 -0400 | [diff] [blame] | 37 | #include <linux/sunrpc/xprtrdma.h> |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 38 | #include <linux/nfs_fs.h> |
| 39 | #include <linux/nfs_mount.h> |
| 40 | #include <linux/nfs4_mount.h> |
| 41 | #include <linux/lockd/bind.h> |
| 42 | #include <linux/smp_lock.h> |
| 43 | #include <linux/seq_file.h> |
| 44 | #include <linux/mount.h> |
| 45 | #include <linux/nfs_idmap.h> |
| 46 | #include <linux/vfs.h> |
| 47 | #include <linux/inet.h> |
Chuck Lever | fd00a8f | 2007-12-10 14:57:38 -0500 | [diff] [blame] | 48 | #include <linux/in6.h> |
| 49 | #include <net/ipv6.h> |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 50 | #include <linux/nfs_xdr.h> |
Adrian Bunk | b5d5dfb | 2007-02-12 00:53:40 -0800 | [diff] [blame] | 51 | #include <linux/magic.h> |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 52 | #include <linux/parser.h> |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 53 | |
| 54 | #include <asm/system.h> |
| 55 | #include <asm/uaccess.h> |
| 56 | |
| 57 | #include "nfs4_fs.h" |
| 58 | #include "callback.h" |
| 59 | #include "delegation.h" |
| 60 | #include "iostat.h" |
| 61 | #include "internal.h" |
| 62 | |
| 63 | #define NFSDBG_FACILITY NFSDBG_VFS |
| 64 | |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 65 | enum { |
| 66 | /* Mount options that take no arguments */ |
| 67 | Opt_soft, Opt_hard, |
| 68 | Opt_intr, Opt_nointr, |
| 69 | Opt_posix, Opt_noposix, |
| 70 | Opt_cto, Opt_nocto, |
| 71 | Opt_ac, Opt_noac, |
| 72 | Opt_lock, Opt_nolock, |
| 73 | Opt_v2, Opt_v3, |
\"Talpey, Thomas\ | 2cf7ff7 | 2007-09-10 13:49:41 -0400 | [diff] [blame] | 74 | Opt_udp, Opt_tcp, Opt_rdma, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 75 | Opt_acl, Opt_noacl, |
| 76 | Opt_rdirplus, Opt_nordirplus, |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 77 | Opt_sharecache, Opt_nosharecache, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 78 | |
| 79 | /* Mount options that take integer arguments */ |
| 80 | Opt_port, |
| 81 | Opt_rsize, Opt_wsize, Opt_bsize, |
| 82 | Opt_timeo, Opt_retrans, |
| 83 | Opt_acregmin, Opt_acregmax, |
| 84 | Opt_acdirmin, Opt_acdirmax, |
| 85 | Opt_actimeo, |
| 86 | Opt_namelen, |
| 87 | Opt_mountport, |
Chuck Lever | e887cbc | 2007-10-26 13:32:29 -0400 | [diff] [blame] | 88 | Opt_mountvers, |
Chuck Lever | ad879ce | 2007-10-26 13:32:24 -0400 | [diff] [blame] | 89 | Opt_nfsvers, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 90 | |
| 91 | /* Mount options that take string arguments */ |
Chuck Lever | 3383203 | 2007-12-10 14:59:13 -0500 | [diff] [blame] | 92 | Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost, |
Chuck Lever | 0ac8377 | 2007-09-11 18:01:04 -0400 | [diff] [blame] | 93 | Opt_addr, Opt_mountaddr, Opt_clientaddr, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 94 | |
| 95 | /* Mount options that are ignored */ |
| 96 | Opt_userspace, Opt_deprecated, |
| 97 | |
| 98 | Opt_err |
| 99 | }; |
| 100 | |
| 101 | static match_table_t nfs_mount_option_tokens = { |
| 102 | { Opt_userspace, "bg" }, |
| 103 | { Opt_userspace, "fg" }, |
| 104 | { Opt_soft, "soft" }, |
| 105 | { Opt_hard, "hard" }, |
| 106 | { Opt_intr, "intr" }, |
| 107 | { Opt_nointr, "nointr" }, |
| 108 | { Opt_posix, "posix" }, |
| 109 | { Opt_noposix, "noposix" }, |
| 110 | { Opt_cto, "cto" }, |
| 111 | { Opt_nocto, "nocto" }, |
| 112 | { Opt_ac, "ac" }, |
| 113 | { Opt_noac, "noac" }, |
| 114 | { Opt_lock, "lock" }, |
| 115 | { Opt_nolock, "nolock" }, |
| 116 | { Opt_v2, "v2" }, |
| 117 | { Opt_v3, "v3" }, |
| 118 | { Opt_udp, "udp" }, |
| 119 | { Opt_tcp, "tcp" }, |
\"Talpey, Thomas\ | 2cf7ff7 | 2007-09-10 13:49:41 -0400 | [diff] [blame] | 120 | { Opt_rdma, "rdma" }, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 121 | { Opt_acl, "acl" }, |
| 122 | { Opt_noacl, "noacl" }, |
| 123 | { Opt_rdirplus, "rdirplus" }, |
| 124 | { Opt_nordirplus, "nordirplus" }, |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 125 | { Opt_sharecache, "sharecache" }, |
| 126 | { Opt_nosharecache, "nosharecache" }, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 127 | |
| 128 | { Opt_port, "port=%u" }, |
| 129 | { Opt_rsize, "rsize=%u" }, |
| 130 | { Opt_wsize, "wsize=%u" }, |
| 131 | { Opt_bsize, "bsize=%u" }, |
| 132 | { Opt_timeo, "timeo=%u" }, |
| 133 | { Opt_retrans, "retrans=%u" }, |
| 134 | { Opt_acregmin, "acregmin=%u" }, |
| 135 | { Opt_acregmax, "acregmax=%u" }, |
| 136 | { Opt_acdirmin, "acdirmin=%u" }, |
| 137 | { Opt_acdirmax, "acdirmax=%u" }, |
| 138 | { Opt_actimeo, "actimeo=%u" }, |
| 139 | { Opt_userspace, "retry=%u" }, |
| 140 | { Opt_namelen, "namlen=%u" }, |
| 141 | { Opt_mountport, "mountport=%u" }, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 142 | { Opt_mountvers, "mountvers=%u" }, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 143 | { Opt_nfsvers, "nfsvers=%u" }, |
| 144 | { Opt_nfsvers, "vers=%u" }, |
| 145 | |
| 146 | { Opt_sec, "sec=%s" }, |
| 147 | { Opt_proto, "proto=%s" }, |
| 148 | { Opt_mountproto, "mountproto=%s" }, |
| 149 | { Opt_addr, "addr=%s" }, |
| 150 | { Opt_clientaddr, "clientaddr=%s" }, |
Chuck Lever | 3383203 | 2007-12-10 14:59:13 -0500 | [diff] [blame] | 151 | { Opt_mounthost, "mounthost=%s" }, |
Chuck Lever | 0ac8377 | 2007-09-11 18:01:04 -0400 | [diff] [blame] | 152 | { Opt_mountaddr, "mountaddr=%s" }, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 153 | |
| 154 | { Opt_err, NULL } |
| 155 | }; |
| 156 | |
| 157 | enum { |
\"Talpey, Thomas\ | 2cf7ff7 | 2007-09-10 13:49:41 -0400 | [diff] [blame] | 158 | Opt_xprt_udp, Opt_xprt_tcp, Opt_xprt_rdma, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 159 | |
| 160 | Opt_xprt_err |
| 161 | }; |
| 162 | |
| 163 | static match_table_t nfs_xprt_protocol_tokens = { |
| 164 | { Opt_xprt_udp, "udp" }, |
| 165 | { Opt_xprt_tcp, "tcp" }, |
\"Talpey, Thomas\ | 2cf7ff7 | 2007-09-10 13:49:41 -0400 | [diff] [blame] | 166 | { Opt_xprt_rdma, "rdma" }, |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 167 | |
| 168 | { Opt_xprt_err, NULL } |
| 169 | }; |
| 170 | |
| 171 | enum { |
| 172 | Opt_sec_none, Opt_sec_sys, |
| 173 | Opt_sec_krb5, Opt_sec_krb5i, Opt_sec_krb5p, |
| 174 | Opt_sec_lkey, Opt_sec_lkeyi, Opt_sec_lkeyp, |
| 175 | Opt_sec_spkm, Opt_sec_spkmi, Opt_sec_spkmp, |
| 176 | |
| 177 | Opt_sec_err |
| 178 | }; |
| 179 | |
| 180 | static match_table_t nfs_secflavor_tokens = { |
| 181 | { Opt_sec_none, "none" }, |
| 182 | { Opt_sec_none, "null" }, |
| 183 | { Opt_sec_sys, "sys" }, |
| 184 | |
| 185 | { Opt_sec_krb5, "krb5" }, |
| 186 | { Opt_sec_krb5i, "krb5i" }, |
| 187 | { Opt_sec_krb5p, "krb5p" }, |
| 188 | |
| 189 | { Opt_sec_lkey, "lkey" }, |
| 190 | { Opt_sec_lkeyi, "lkeyi" }, |
| 191 | { Opt_sec_lkeyp, "lkeyp" }, |
| 192 | |
| 193 | { Opt_sec_err, NULL } |
| 194 | }; |
| 195 | |
| 196 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 197 | static void nfs_umount_begin(struct vfsmount *, int); |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 198 | static int nfs_statfs(struct dentry *, struct kstatfs *); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 199 | static int nfs_show_options(struct seq_file *, struct vfsmount *); |
| 200 | static int nfs_show_stats(struct seq_file *, struct vfsmount *); |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 201 | static int nfs_get_sb(struct file_system_type *, int, const char *, void *, struct vfsmount *); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 202 | static int nfs_xdev_get_sb(struct file_system_type *fs_type, |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 203 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 204 | static void nfs_kill_super(struct super_block *); |
Steve Dickson | ef818a2 | 2007-11-08 04:05:04 -0500 | [diff] [blame] | 205 | static void nfs_put_super(struct super_block *); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 206 | |
| 207 | static struct file_system_type nfs_fs_type = { |
| 208 | .owner = THIS_MODULE, |
| 209 | .name = "nfs", |
| 210 | .get_sb = nfs_get_sb, |
| 211 | .kill_sb = nfs_kill_super, |
Mark Fasheh | 349457c | 2006-09-08 14:22:21 -0700 | [diff] [blame] | 212 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 213 | }; |
| 214 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 215 | struct file_system_type nfs_xdev_fs_type = { |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 216 | .owner = THIS_MODULE, |
| 217 | .name = "nfs", |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 218 | .get_sb = nfs_xdev_get_sb, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 219 | .kill_sb = nfs_kill_super, |
Mark Fasheh | 349457c | 2006-09-08 14:22:21 -0700 | [diff] [blame] | 220 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 221 | }; |
| 222 | |
Josef 'Jeff' Sipek | ee9b6d6 | 2007-02-12 00:55:41 -0800 | [diff] [blame] | 223 | static const struct super_operations nfs_sops = { |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 224 | .alloc_inode = nfs_alloc_inode, |
| 225 | .destroy_inode = nfs_destroy_inode, |
| 226 | .write_inode = nfs_write_inode, |
Steve Dickson | ef818a2 | 2007-11-08 04:05:04 -0500 | [diff] [blame] | 227 | .put_super = nfs_put_super, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 228 | .statfs = nfs_statfs, |
| 229 | .clear_inode = nfs_clear_inode, |
| 230 | .umount_begin = nfs_umount_begin, |
| 231 | .show_options = nfs_show_options, |
| 232 | .show_stats = nfs_show_stats, |
| 233 | }; |
| 234 | |
| 235 | #ifdef CONFIG_NFS_V4 |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 236 | static int nfs4_get_sb(struct file_system_type *fs_type, |
| 237 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 238 | static int nfs4_xdev_get_sb(struct file_system_type *fs_type, |
| 239 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); |
| 240 | static int nfs4_referral_get_sb(struct file_system_type *fs_type, |
| 241 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 242 | static void nfs4_kill_super(struct super_block *sb); |
| 243 | |
| 244 | static struct file_system_type nfs4_fs_type = { |
| 245 | .owner = THIS_MODULE, |
| 246 | .name = "nfs4", |
| 247 | .get_sb = nfs4_get_sb, |
| 248 | .kill_sb = nfs4_kill_super, |
Mark Fasheh | 349457c | 2006-09-08 14:22:21 -0700 | [diff] [blame] | 249 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 250 | }; |
| 251 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 252 | struct file_system_type nfs4_xdev_fs_type = { |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 253 | .owner = THIS_MODULE, |
| 254 | .name = "nfs4", |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 255 | .get_sb = nfs4_xdev_get_sb, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 256 | .kill_sb = nfs4_kill_super, |
Mark Fasheh | 349457c | 2006-09-08 14:22:21 -0700 | [diff] [blame] | 257 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 258 | }; |
| 259 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 260 | struct file_system_type nfs4_referral_fs_type = { |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 261 | .owner = THIS_MODULE, |
| 262 | .name = "nfs4", |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 263 | .get_sb = nfs4_referral_get_sb, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 264 | .kill_sb = nfs4_kill_super, |
Mark Fasheh | 349457c | 2006-09-08 14:22:21 -0700 | [diff] [blame] | 265 | .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 266 | }; |
| 267 | |
Josef 'Jeff' Sipek | ee9b6d6 | 2007-02-12 00:55:41 -0800 | [diff] [blame] | 268 | static const struct super_operations nfs4_sops = { |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 269 | .alloc_inode = nfs_alloc_inode, |
| 270 | .destroy_inode = nfs_destroy_inode, |
| 271 | .write_inode = nfs_write_inode, |
| 272 | .statfs = nfs_statfs, |
| 273 | .clear_inode = nfs4_clear_inode, |
| 274 | .umount_begin = nfs_umount_begin, |
| 275 | .show_options = nfs_show_options, |
| 276 | .show_stats = nfs_show_stats, |
| 277 | }; |
| 278 | #endif |
| 279 | |
Rusty Russell | 8e1f936 | 2007-07-17 04:03:17 -0700 | [diff] [blame] | 280 | static struct shrinker acl_shrinker = { |
| 281 | .shrink = nfs_access_cache_shrinker, |
| 282 | .seeks = DEFAULT_SEEKS, |
| 283 | }; |
Trond Myklebust | 979df72 | 2006-07-25 11:28:19 -0400 | [diff] [blame] | 284 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 285 | /* |
| 286 | * Register the NFS filesystems |
| 287 | */ |
| 288 | int __init register_nfs_fs(void) |
| 289 | { |
| 290 | int ret; |
| 291 | |
| 292 | ret = register_filesystem(&nfs_fs_type); |
| 293 | if (ret < 0) |
| 294 | goto error_0; |
| 295 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 296 | ret = nfs_register_sysctl(); |
| 297 | if (ret < 0) |
| 298 | goto error_1; |
Peter Zijlstra | 89a0914 | 2007-03-16 13:38:26 -0800 | [diff] [blame] | 299 | #ifdef CONFIG_NFS_V4 |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 300 | ret = register_filesystem(&nfs4_fs_type); |
| 301 | if (ret < 0) |
| 302 | goto error_2; |
| 303 | #endif |
Rusty Russell | 8e1f936 | 2007-07-17 04:03:17 -0700 | [diff] [blame] | 304 | register_shrinker(&acl_shrinker); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 305 | return 0; |
| 306 | |
| 307 | #ifdef CONFIG_NFS_V4 |
| 308 | error_2: |
| 309 | nfs_unregister_sysctl(); |
Peter Zijlstra | 89a0914 | 2007-03-16 13:38:26 -0800 | [diff] [blame] | 310 | #endif |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 311 | error_1: |
| 312 | unregister_filesystem(&nfs_fs_type); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 313 | error_0: |
| 314 | return ret; |
| 315 | } |
| 316 | |
| 317 | /* |
| 318 | * Unregister the NFS filesystems |
| 319 | */ |
| 320 | void __exit unregister_nfs_fs(void) |
| 321 | { |
Rusty Russell | 8e1f936 | 2007-07-17 04:03:17 -0700 | [diff] [blame] | 322 | unregister_shrinker(&acl_shrinker); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 323 | #ifdef CONFIG_NFS_V4 |
| 324 | unregister_filesystem(&nfs4_fs_type); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 325 | #endif |
Alexey Dobriyan | 49af7ee | 2007-09-18 22:46:40 -0700 | [diff] [blame] | 326 | nfs_unregister_sysctl(); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 327 | unregister_filesystem(&nfs_fs_type); |
| 328 | } |
| 329 | |
Steve Dickson | ef818a2 | 2007-11-08 04:05:04 -0500 | [diff] [blame] | 330 | void nfs_sb_active(struct nfs_server *server) |
| 331 | { |
| 332 | atomic_inc(&server->active); |
| 333 | } |
| 334 | |
| 335 | void nfs_sb_deactive(struct nfs_server *server) |
| 336 | { |
| 337 | if (atomic_dec_and_test(&server->active)) |
| 338 | wake_up(&server->active_wq); |
| 339 | } |
| 340 | |
| 341 | static void nfs_put_super(struct super_block *sb) |
| 342 | { |
| 343 | struct nfs_server *server = NFS_SB(sb); |
| 344 | /* |
| 345 | * Make sure there are no outstanding ops to this server. |
| 346 | * If so, wait for them to finish before allowing the |
| 347 | * unmount to continue. |
| 348 | */ |
| 349 | wait_event(server->active_wq, atomic_read(&server->active) == 0); |
| 350 | } |
| 351 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 352 | /* |
| 353 | * Deliver file system statistics to userspace |
| 354 | */ |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 355 | static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 356 | { |
David Howells | 0c7d90c | 2006-08-22 20:06:10 -0400 | [diff] [blame] | 357 | struct nfs_server *server = NFS_SB(dentry->d_sb); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 358 | unsigned char blockbits; |
| 359 | unsigned long blockres; |
David Howells | 0c7d90c | 2006-08-22 20:06:10 -0400 | [diff] [blame] | 360 | struct nfs_fh *fh = NFS_FH(dentry->d_inode); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 361 | struct nfs_fattr fattr; |
| 362 | struct nfs_fsstat res = { |
| 363 | .fattr = &fattr, |
| 364 | }; |
| 365 | int error; |
| 366 | |
| 367 | lock_kernel(); |
| 368 | |
David Howells | 8fa5c00 | 2006-08-22 20:06:12 -0400 | [diff] [blame] | 369 | error = server->nfs_client->rpc_ops->statfs(server, fh, &res); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 370 | if (error < 0) |
| 371 | goto out_err; |
Amnon Aaronsohn | 1a0ba9a | 2007-04-09 22:05:26 -0700 | [diff] [blame] | 372 | buf->f_type = NFS_SUPER_MAGIC; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 373 | |
| 374 | /* |
| 375 | * Current versions of glibc do not correctly handle the |
| 376 | * case where f_frsize != f_bsize. Eventually we want to |
| 377 | * report the value of wtmult in this field. |
| 378 | */ |
David Howells | 0c7d90c | 2006-08-22 20:06:10 -0400 | [diff] [blame] | 379 | buf->f_frsize = dentry->d_sb->s_blocksize; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 380 | |
| 381 | /* |
| 382 | * On most *nix systems, f_blocks, f_bfree, and f_bavail |
| 383 | * are reported in units of f_frsize. Linux hasn't had |
| 384 | * an f_frsize field in its statfs struct until recently, |
| 385 | * thus historically Linux's sys_statfs reports these |
| 386 | * fields in units of f_bsize. |
| 387 | */ |
David Howells | 0c7d90c | 2006-08-22 20:06:10 -0400 | [diff] [blame] | 388 | buf->f_bsize = dentry->d_sb->s_blocksize; |
| 389 | blockbits = dentry->d_sb->s_blocksize_bits; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 390 | blockres = (1 << blockbits) - 1; |
| 391 | buf->f_blocks = (res.tbytes + blockres) >> blockbits; |
| 392 | buf->f_bfree = (res.fbytes + blockres) >> blockbits; |
| 393 | buf->f_bavail = (res.abytes + blockres) >> blockbits; |
| 394 | |
| 395 | buf->f_files = res.tfiles; |
| 396 | buf->f_ffree = res.afiles; |
| 397 | |
| 398 | buf->f_namelen = server->namelen; |
Amnon Aaronsohn | 1a0ba9a | 2007-04-09 22:05:26 -0700 | [diff] [blame] | 399 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 400 | unlock_kernel(); |
| 401 | return 0; |
| 402 | |
| 403 | out_err: |
| 404 | dprintk("%s: statfs error = %d\n", __FUNCTION__, -error); |
Amnon Aaronsohn | 1a0ba9a | 2007-04-09 22:05:26 -0700 | [diff] [blame] | 405 | unlock_kernel(); |
| 406 | return error; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 407 | } |
| 408 | |
David Howells | 7d4e274 | 2006-08-22 20:06:07 -0400 | [diff] [blame] | 409 | /* |
| 410 | * Map the security flavour number to a name |
| 411 | */ |
Trond Myklebust | 81039f1 | 2006-06-09 09:34:34 -0400 | [diff] [blame] | 412 | static const char *nfs_pseudoflavour_to_name(rpc_authflavor_t flavour) |
| 413 | { |
David Howells | 7d4e274 | 2006-08-22 20:06:07 -0400 | [diff] [blame] | 414 | static const struct { |
Trond Myklebust | 81039f1 | 2006-06-09 09:34:34 -0400 | [diff] [blame] | 415 | rpc_authflavor_t flavour; |
| 416 | const char *str; |
| 417 | } sec_flavours[] = { |
| 418 | { RPC_AUTH_NULL, "null" }, |
| 419 | { RPC_AUTH_UNIX, "sys" }, |
| 420 | { RPC_AUTH_GSS_KRB5, "krb5" }, |
| 421 | { RPC_AUTH_GSS_KRB5I, "krb5i" }, |
| 422 | { RPC_AUTH_GSS_KRB5P, "krb5p" }, |
| 423 | { RPC_AUTH_GSS_LKEY, "lkey" }, |
| 424 | { RPC_AUTH_GSS_LKEYI, "lkeyi" }, |
| 425 | { RPC_AUTH_GSS_LKEYP, "lkeyp" }, |
| 426 | { RPC_AUTH_GSS_SPKM, "spkm" }, |
| 427 | { RPC_AUTH_GSS_SPKMI, "spkmi" }, |
| 428 | { RPC_AUTH_GSS_SPKMP, "spkmp" }, |
Chuck Lever | 4d81cd1 | 2007-07-01 12:12:40 -0400 | [diff] [blame] | 429 | { UINT_MAX, "unknown" } |
Trond Myklebust | 81039f1 | 2006-06-09 09:34:34 -0400 | [diff] [blame] | 430 | }; |
| 431 | int i; |
| 432 | |
Chuck Lever | 4d81cd1 | 2007-07-01 12:12:40 -0400 | [diff] [blame] | 433 | for (i = 0; sec_flavours[i].flavour != UINT_MAX; i++) { |
Trond Myklebust | 81039f1 | 2006-06-09 09:34:34 -0400 | [diff] [blame] | 434 | if (sec_flavours[i].flavour == flavour) |
| 435 | break; |
| 436 | } |
| 437 | return sec_flavours[i].str; |
| 438 | } |
| 439 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 440 | /* |
| 441 | * Describe the mount options in force on this server representation |
| 442 | */ |
| 443 | static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss, int showdefaults) |
| 444 | { |
David Howells | 509de81 | 2006-08-22 20:06:11 -0400 | [diff] [blame] | 445 | static const struct proc_nfs_info { |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 446 | int flag; |
David Howells | 509de81 | 2006-08-22 20:06:11 -0400 | [diff] [blame] | 447 | const char *str; |
| 448 | const char *nostr; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 449 | } nfs_info[] = { |
| 450 | { NFS_MOUNT_SOFT, ",soft", ",hard" }, |
Chuck Lever | bcf3561 | 2007-09-24 15:39:55 -0400 | [diff] [blame] | 451 | { NFS_MOUNT_INTR, ",intr", ",nointr" }, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 452 | { NFS_MOUNT_NOCTO, ",nocto", "" }, |
| 453 | { NFS_MOUNT_NOAC, ",noac", "" }, |
| 454 | { NFS_MOUNT_NONLM, ",nolock", "" }, |
| 455 | { NFS_MOUNT_NOACL, ",noacl", "" }, |
Steve Dickson | 74dd34e | 2007-04-14 17:01:15 -0400 | [diff] [blame] | 456 | { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" }, |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 457 | { NFS_MOUNT_UNSHARED, ",nosharecache", ""}, |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 458 | { 0, NULL, NULL } |
| 459 | }; |
David Howells | 509de81 | 2006-08-22 20:06:11 -0400 | [diff] [blame] | 460 | const struct proc_nfs_info *nfs_infop; |
David Howells | 8fa5c00 | 2006-08-22 20:06:12 -0400 | [diff] [blame] | 461 | struct nfs_client *clp = nfss->nfs_client; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 462 | |
David Howells | 8fa5c00 | 2006-08-22 20:06:12 -0400 | [diff] [blame] | 463 | seq_printf(m, ",vers=%d", clp->rpc_ops->version); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 464 | seq_printf(m, ",rsize=%d", nfss->rsize); |
| 465 | seq_printf(m, ",wsize=%d", nfss->wsize); |
| 466 | if (nfss->acregmin != 3*HZ || showdefaults) |
| 467 | seq_printf(m, ",acregmin=%d", nfss->acregmin/HZ); |
| 468 | if (nfss->acregmax != 60*HZ || showdefaults) |
| 469 | seq_printf(m, ",acregmax=%d", nfss->acregmax/HZ); |
| 470 | if (nfss->acdirmin != 30*HZ || showdefaults) |
| 471 | seq_printf(m, ",acdirmin=%d", nfss->acdirmin/HZ); |
| 472 | if (nfss->acdirmax != 60*HZ || showdefaults) |
| 473 | seq_printf(m, ",acdirmax=%d", nfss->acdirmax/HZ); |
| 474 | for (nfs_infop = nfs_info; nfs_infop->flag; nfs_infop++) { |
| 475 | if (nfss->flags & nfs_infop->flag) |
| 476 | seq_puts(m, nfs_infop->str); |
| 477 | else |
| 478 | seq_puts(m, nfs_infop->nostr); |
| 479 | } |
\"Talpey, Thomas\ | 56928ed | 2007-09-10 13:48:47 -0400 | [diff] [blame] | 480 | seq_printf(m, ",proto=%s", |
| 481 | rpc_peeraddr2str(nfss->client, RPC_DISPLAY_PROTO)); |
David Howells | 5006a76 | 2006-08-22 20:06:12 -0400 | [diff] [blame] | 482 | seq_printf(m, ",timeo=%lu", 10U * clp->retrans_timeo / HZ); |
| 483 | seq_printf(m, ",retrans=%u", clp->retrans_count); |
Trond Myklebust | 81039f1 | 2006-06-09 09:34:34 -0400 | [diff] [blame] | 484 | seq_printf(m, ",sec=%s", nfs_pseudoflavour_to_name(nfss->client->cl_auth->au_flavor)); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 485 | } |
| 486 | |
| 487 | /* |
| 488 | * Describe the mount options on this VFS mountpoint |
| 489 | */ |
| 490 | static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt) |
| 491 | { |
| 492 | struct nfs_server *nfss = NFS_SB(mnt->mnt_sb); |
| 493 | |
| 494 | nfs_show_mount_options(m, nfss, 0); |
| 495 | |
Chuck Lever | 5d8515c | 2007-12-10 14:57:16 -0500 | [diff] [blame] | 496 | seq_printf(m, ",addr=%s", |
| 497 | rpc_peeraddr2str(nfss->nfs_client->cl_rpcclient, |
| 498 | RPC_DISPLAY_ADDR)); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 499 | |
| 500 | return 0; |
| 501 | } |
| 502 | |
| 503 | /* |
| 504 | * Present statistical information for this VFS mountpoint |
| 505 | */ |
| 506 | static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt) |
| 507 | { |
| 508 | int i, cpu; |
| 509 | struct nfs_server *nfss = NFS_SB(mnt->mnt_sb); |
| 510 | struct rpc_auth *auth = nfss->client->cl_auth; |
| 511 | struct nfs_iostats totals = { }; |
| 512 | |
| 513 | seq_printf(m, "statvers=%s", NFS_IOSTAT_VERS); |
| 514 | |
| 515 | /* |
| 516 | * Display all mount option settings |
| 517 | */ |
| 518 | seq_printf(m, "\n\topts:\t"); |
| 519 | seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? "ro" : "rw"); |
| 520 | seq_puts(m, mnt->mnt_sb->s_flags & MS_SYNCHRONOUS ? ",sync" : ""); |
| 521 | seq_puts(m, mnt->mnt_sb->s_flags & MS_NOATIME ? ",noatime" : ""); |
| 522 | seq_puts(m, mnt->mnt_sb->s_flags & MS_NODIRATIME ? ",nodiratime" : ""); |
| 523 | nfs_show_mount_options(m, nfss, 1); |
| 524 | |
| 525 | seq_printf(m, "\n\tage:\t%lu", (jiffies - nfss->mount_time) / HZ); |
| 526 | |
| 527 | seq_printf(m, "\n\tcaps:\t"); |
| 528 | seq_printf(m, "caps=0x%x", nfss->caps); |
| 529 | seq_printf(m, ",wtmult=%d", nfss->wtmult); |
| 530 | seq_printf(m, ",dtsize=%d", nfss->dtsize); |
| 531 | seq_printf(m, ",bsize=%d", nfss->bsize); |
| 532 | seq_printf(m, ",namelen=%d", nfss->namelen); |
| 533 | |
| 534 | #ifdef CONFIG_NFS_V4 |
Trond Myklebust | 40c55319 | 2007-12-14 14:56:07 -0500 | [diff] [blame] | 535 | if (nfss->nfs_client->rpc_ops->version == 4) { |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 536 | seq_printf(m, "\n\tnfsv4:\t"); |
| 537 | seq_printf(m, "bm0=0x%x", nfss->attr_bitmask[0]); |
| 538 | seq_printf(m, ",bm1=0x%x", nfss->attr_bitmask[1]); |
| 539 | seq_printf(m, ",acl=0x%x", nfss->acl_bitmask); |
| 540 | } |
| 541 | #endif |
| 542 | |
| 543 | /* |
| 544 | * Display security flavor in effect for this mount |
| 545 | */ |
| 546 | seq_printf(m, "\n\tsec:\tflavor=%d", auth->au_ops->au_flavor); |
| 547 | if (auth->au_flavor) |
| 548 | seq_printf(m, ",pseudoflavor=%d", auth->au_flavor); |
| 549 | |
| 550 | /* |
| 551 | * Display superblock I/O counters |
| 552 | */ |
| 553 | for_each_possible_cpu(cpu) { |
| 554 | struct nfs_iostats *stats; |
| 555 | |
| 556 | preempt_disable(); |
| 557 | stats = per_cpu_ptr(nfss->io_stats, cpu); |
| 558 | |
| 559 | for (i = 0; i < __NFSIOS_COUNTSMAX; i++) |
| 560 | totals.events[i] += stats->events[i]; |
| 561 | for (i = 0; i < __NFSIOS_BYTESMAX; i++) |
| 562 | totals.bytes[i] += stats->bytes[i]; |
| 563 | |
| 564 | preempt_enable(); |
| 565 | } |
| 566 | |
| 567 | seq_printf(m, "\n\tevents:\t"); |
| 568 | for (i = 0; i < __NFSIOS_COUNTSMAX; i++) |
| 569 | seq_printf(m, "%lu ", totals.events[i]); |
| 570 | seq_printf(m, "\n\tbytes:\t"); |
| 571 | for (i = 0; i < __NFSIOS_BYTESMAX; i++) |
| 572 | seq_printf(m, "%Lu ", totals.bytes[i]); |
| 573 | seq_printf(m, "\n"); |
| 574 | |
| 575 | rpc_print_iostats(m, nfss->client); |
| 576 | |
| 577 | return 0; |
| 578 | } |
| 579 | |
| 580 | /* |
| 581 | * Begin unmount by attempting to remove all automounted mountpoints we added |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 582 | * in response to xdev traversals and referrals |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 583 | */ |
| 584 | static void nfs_umount_begin(struct vfsmount *vfsmnt, int flags) |
| 585 | { |
Trond Myklebust | fc6ae3c | 2007-06-05 19:13:47 -0400 | [diff] [blame] | 586 | struct nfs_server *server = NFS_SB(vfsmnt->mnt_sb); |
| 587 | struct rpc_clnt *rpc; |
| 588 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 589 | shrink_submounts(vfsmnt, &nfs_automount_list); |
Trond Myklebust | fc6ae3c | 2007-06-05 19:13:47 -0400 | [diff] [blame] | 590 | |
| 591 | if (!(flags & MNT_FORCE)) |
| 592 | return; |
| 593 | /* -EIO all pending I/O */ |
| 594 | rpc = server->client_acl; |
| 595 | if (!IS_ERR(rpc)) |
| 596 | rpc_killall_tasks(rpc); |
| 597 | rpc = server->client; |
| 598 | if (!IS_ERR(rpc)) |
| 599 | rpc_killall_tasks(rpc); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | /* |
Chuck Lever | 04dcd6e | 2007-12-10 14:57:53 -0500 | [diff] [blame] | 603 | * Set the port number in an address. Be agnostic about the address family. |
| 604 | */ |
| 605 | static void nfs_set_port(struct sockaddr *sap, unsigned short port) |
| 606 | { |
| 607 | switch (sap->sa_family) { |
| 608 | case AF_INET: { |
| 609 | struct sockaddr_in *ap = (struct sockaddr_in *)sap; |
| 610 | ap->sin_port = htons(port); |
| 611 | break; |
| 612 | } |
| 613 | case AF_INET6: { |
| 614 | struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap; |
| 615 | ap->sin6_port = htons(port); |
| 616 | break; |
| 617 | } |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | /* |
Chuck Lever | cdcd7f9 | 2007-12-10 14:57:45 -0500 | [diff] [blame] | 622 | * Sanity-check a server address provided by the mount command. |
| 623 | * |
| 624 | * Address family must be initialized, and address must not be |
| 625 | * the ANY address for that family. |
Chuck Lever | fc50d58 | 2007-07-01 12:12:46 -0400 | [diff] [blame] | 626 | */ |
| 627 | static int nfs_verify_server_address(struct sockaddr *addr) |
| 628 | { |
| 629 | switch (addr->sa_family) { |
| 630 | case AF_INET: { |
Chuck Lever | cdcd7f9 | 2007-12-10 14:57:45 -0500 | [diff] [blame] | 631 | struct sockaddr_in *sa = (struct sockaddr_in *)addr; |
| 632 | return sa->sin_addr.s_addr != INADDR_ANY; |
| 633 | } |
| 634 | case AF_INET6: { |
| 635 | struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr; |
| 636 | return !ipv6_addr_any(sa); |
Chuck Lever | fc50d58 | 2007-07-01 12:12:46 -0400 | [diff] [blame] | 637 | } |
| 638 | } |
| 639 | |
| 640 | return 0; |
| 641 | } |
| 642 | |
| 643 | /* |
Chuck Lever | 9412b92 | 2007-12-10 14:59:21 -0500 | [diff] [blame] | 644 | * Parse string addresses passed in via a mount option, |
| 645 | * and construct a sockaddr based on the result. |
| 646 | * |
| 647 | * If address parsing fails, set the sockaddr's address |
| 648 | * family to AF_UNSPEC to force nfs_verify_server_address() |
| 649 | * to punt the mount. |
| 650 | */ |
| 651 | static void nfs_parse_server_address(char *value, |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 652 | struct sockaddr *sap, |
| 653 | size_t *len) |
Chuck Lever | 9412b92 | 2007-12-10 14:59:21 -0500 | [diff] [blame] | 654 | { |
Chuck Lever | 3c7c7e4 | 2007-12-10 14:59:35 -0500 | [diff] [blame^] | 655 | if (strchr(value, ':')) { |
| 656 | struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap; |
| 657 | u8 *addr = (u8 *)&ap->sin6_addr.in6_u; |
Chuck Lever | 9412b92 | 2007-12-10 14:59:21 -0500 | [diff] [blame] | 658 | |
Chuck Lever | 3c7c7e4 | 2007-12-10 14:59:35 -0500 | [diff] [blame^] | 659 | ap->sin6_family = AF_INET6; |
| 660 | *len = sizeof(*ap); |
| 661 | if (in6_pton(value, -1, addr, '\0', NULL)) |
| 662 | return; |
| 663 | } else { |
| 664 | struct sockaddr_in *ap = (struct sockaddr_in *)sap; |
| 665 | u8 *addr = (u8 *)&ap->sin_addr.s_addr; |
| 666 | |
| 667 | ap->sin_family = AF_INET; |
| 668 | *len = sizeof(*ap); |
| 669 | if (in4_pton(value, -1, addr, '\0', NULL)) |
| 670 | return; |
| 671 | } |
Chuck Lever | 9412b92 | 2007-12-10 14:59:21 -0500 | [diff] [blame] | 672 | |
| 673 | sap->sa_family = AF_UNSPEC; |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 674 | *len = 0; |
Chuck Lever | 9412b92 | 2007-12-10 14:59:21 -0500 | [diff] [blame] | 675 | } |
| 676 | |
| 677 | /* |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 678 | * Error-check and convert a string of mount options from user space into |
| 679 | * a data structure |
| 680 | */ |
| 681 | static int nfs_parse_mount_options(char *raw, |
| 682 | struct nfs_parsed_mount_data *mnt) |
| 683 | { |
| 684 | char *p, *string; |
Chuck Lever | 04dcd6e | 2007-12-10 14:57:53 -0500 | [diff] [blame] | 685 | unsigned short port = 0; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 686 | |
| 687 | if (!raw) { |
| 688 | dfprintk(MOUNT, "NFS: mount options string was NULL.\n"); |
| 689 | return 1; |
| 690 | } |
| 691 | dfprintk(MOUNT, "NFS: nfs mount opts='%s'\n", raw); |
| 692 | |
| 693 | while ((p = strsep(&raw, ",")) != NULL) { |
| 694 | substring_t args[MAX_OPT_ARGS]; |
| 695 | int option, token; |
| 696 | |
| 697 | if (!*p) |
| 698 | continue; |
| 699 | |
| 700 | dfprintk(MOUNT, "NFS: parsing nfs mount option '%s'\n", p); |
| 701 | |
| 702 | token = match_token(p, nfs_mount_option_tokens, args); |
| 703 | switch (token) { |
| 704 | case Opt_soft: |
| 705 | mnt->flags |= NFS_MOUNT_SOFT; |
| 706 | break; |
| 707 | case Opt_hard: |
| 708 | mnt->flags &= ~NFS_MOUNT_SOFT; |
| 709 | break; |
| 710 | case Opt_intr: |
| 711 | mnt->flags |= NFS_MOUNT_INTR; |
| 712 | break; |
| 713 | case Opt_nointr: |
| 714 | mnt->flags &= ~NFS_MOUNT_INTR; |
| 715 | break; |
| 716 | case Opt_posix: |
| 717 | mnt->flags |= NFS_MOUNT_POSIX; |
| 718 | break; |
| 719 | case Opt_noposix: |
| 720 | mnt->flags &= ~NFS_MOUNT_POSIX; |
| 721 | break; |
| 722 | case Opt_cto: |
| 723 | mnt->flags &= ~NFS_MOUNT_NOCTO; |
| 724 | break; |
| 725 | case Opt_nocto: |
| 726 | mnt->flags |= NFS_MOUNT_NOCTO; |
| 727 | break; |
| 728 | case Opt_ac: |
| 729 | mnt->flags &= ~NFS_MOUNT_NOAC; |
| 730 | break; |
| 731 | case Opt_noac: |
| 732 | mnt->flags |= NFS_MOUNT_NOAC; |
| 733 | break; |
| 734 | case Opt_lock: |
| 735 | mnt->flags &= ~NFS_MOUNT_NONLM; |
| 736 | break; |
| 737 | case Opt_nolock: |
| 738 | mnt->flags |= NFS_MOUNT_NONLM; |
| 739 | break; |
| 740 | case Opt_v2: |
| 741 | mnt->flags &= ~NFS_MOUNT_VER3; |
| 742 | break; |
| 743 | case Opt_v3: |
| 744 | mnt->flags |= NFS_MOUNT_VER3; |
| 745 | break; |
| 746 | case Opt_udp: |
| 747 | mnt->flags &= ~NFS_MOUNT_TCP; |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 748 | mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 749 | mnt->timeo = 7; |
| 750 | mnt->retrans = 5; |
| 751 | break; |
| 752 | case Opt_tcp: |
| 753 | mnt->flags |= NFS_MOUNT_TCP; |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 754 | mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 755 | mnt->timeo = 600; |
| 756 | mnt->retrans = 2; |
| 757 | break; |
\"Talpey, Thomas\ | 2cf7ff7 | 2007-09-10 13:49:41 -0400 | [diff] [blame] | 758 | case Opt_rdma: |
| 759 | mnt->flags |= NFS_MOUNT_TCP; /* for side protocols */ |
| 760 | mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA; |
| 761 | mnt->timeo = 600; |
| 762 | mnt->retrans = 2; |
| 763 | break; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 764 | case Opt_acl: |
| 765 | mnt->flags &= ~NFS_MOUNT_NOACL; |
| 766 | break; |
| 767 | case Opt_noacl: |
| 768 | mnt->flags |= NFS_MOUNT_NOACL; |
| 769 | break; |
| 770 | case Opt_rdirplus: |
| 771 | mnt->flags &= ~NFS_MOUNT_NORDIRPLUS; |
| 772 | break; |
| 773 | case Opt_nordirplus: |
| 774 | mnt->flags |= NFS_MOUNT_NORDIRPLUS; |
| 775 | break; |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 776 | case Opt_sharecache: |
| 777 | mnt->flags &= ~NFS_MOUNT_UNSHARED; |
| 778 | break; |
| 779 | case Opt_nosharecache: |
| 780 | mnt->flags |= NFS_MOUNT_UNSHARED; |
| 781 | break; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 782 | |
| 783 | case Opt_port: |
| 784 | if (match_int(args, &option)) |
| 785 | return 0; |
| 786 | if (option < 0 || option > 65535) |
| 787 | return 0; |
Chuck Lever | 04dcd6e | 2007-12-10 14:57:53 -0500 | [diff] [blame] | 788 | port = option; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 789 | break; |
| 790 | case Opt_rsize: |
| 791 | if (match_int(args, &mnt->rsize)) |
| 792 | return 0; |
| 793 | break; |
| 794 | case Opt_wsize: |
| 795 | if (match_int(args, &mnt->wsize)) |
| 796 | return 0; |
| 797 | break; |
| 798 | case Opt_bsize: |
| 799 | if (match_int(args, &option)) |
| 800 | return 0; |
| 801 | if (option < 0) |
| 802 | return 0; |
| 803 | mnt->bsize = option; |
| 804 | break; |
| 805 | case Opt_timeo: |
| 806 | if (match_int(args, &mnt->timeo)) |
| 807 | return 0; |
| 808 | break; |
| 809 | case Opt_retrans: |
| 810 | if (match_int(args, &mnt->retrans)) |
| 811 | return 0; |
| 812 | break; |
| 813 | case Opt_acregmin: |
| 814 | if (match_int(args, &mnt->acregmin)) |
| 815 | return 0; |
| 816 | break; |
| 817 | case Opt_acregmax: |
| 818 | if (match_int(args, &mnt->acregmax)) |
| 819 | return 0; |
| 820 | break; |
| 821 | case Opt_acdirmin: |
| 822 | if (match_int(args, &mnt->acdirmin)) |
| 823 | return 0; |
| 824 | break; |
| 825 | case Opt_acdirmax: |
| 826 | if (match_int(args, &mnt->acdirmax)) |
| 827 | return 0; |
| 828 | break; |
| 829 | case Opt_actimeo: |
| 830 | if (match_int(args, &option)) |
| 831 | return 0; |
| 832 | if (option < 0) |
| 833 | return 0; |
| 834 | mnt->acregmin = |
| 835 | mnt->acregmax = |
| 836 | mnt->acdirmin = |
| 837 | mnt->acdirmax = option; |
| 838 | break; |
| 839 | case Opt_namelen: |
| 840 | if (match_int(args, &mnt->namlen)) |
| 841 | return 0; |
| 842 | break; |
| 843 | case Opt_mountport: |
| 844 | if (match_int(args, &option)) |
| 845 | return 0; |
| 846 | if (option < 0 || option > 65535) |
| 847 | return 0; |
| 848 | mnt->mount_server.port = option; |
| 849 | break; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 850 | case Opt_mountvers: |
| 851 | if (match_int(args, &option)) |
| 852 | return 0; |
| 853 | if (option < 0) |
| 854 | return 0; |
| 855 | mnt->mount_server.version = option; |
| 856 | break; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 857 | case Opt_nfsvers: |
| 858 | if (match_int(args, &option)) |
| 859 | return 0; |
| 860 | switch (option) { |
| 861 | case 2: |
| 862 | mnt->flags &= ~NFS_MOUNT_VER3; |
| 863 | break; |
| 864 | case 3: |
| 865 | mnt->flags |= NFS_MOUNT_VER3; |
| 866 | break; |
| 867 | default: |
| 868 | goto out_unrec_vers; |
| 869 | } |
| 870 | break; |
| 871 | |
| 872 | case Opt_sec: |
| 873 | string = match_strdup(args); |
| 874 | if (string == NULL) |
| 875 | goto out_nomem; |
| 876 | token = match_token(string, nfs_secflavor_tokens, args); |
| 877 | kfree(string); |
| 878 | |
| 879 | /* |
| 880 | * The flags setting is for v2/v3. The flavor_len |
| 881 | * setting is for v4. v2/v3 also need to know the |
| 882 | * difference between NULL and UNIX. |
| 883 | */ |
| 884 | switch (token) { |
| 885 | case Opt_sec_none: |
| 886 | mnt->flags &= ~NFS_MOUNT_SECFLAVOUR; |
| 887 | mnt->auth_flavor_len = 0; |
| 888 | mnt->auth_flavors[0] = RPC_AUTH_NULL; |
| 889 | break; |
| 890 | case Opt_sec_sys: |
| 891 | mnt->flags &= ~NFS_MOUNT_SECFLAVOUR; |
| 892 | mnt->auth_flavor_len = 0; |
| 893 | mnt->auth_flavors[0] = RPC_AUTH_UNIX; |
| 894 | break; |
| 895 | case Opt_sec_krb5: |
| 896 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; |
| 897 | mnt->auth_flavor_len = 1; |
| 898 | mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5; |
| 899 | break; |
| 900 | case Opt_sec_krb5i: |
| 901 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; |
| 902 | mnt->auth_flavor_len = 1; |
| 903 | mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5I; |
| 904 | break; |
| 905 | case Opt_sec_krb5p: |
| 906 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; |
| 907 | mnt->auth_flavor_len = 1; |
| 908 | mnt->auth_flavors[0] = RPC_AUTH_GSS_KRB5P; |
| 909 | break; |
| 910 | case Opt_sec_lkey: |
| 911 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; |
| 912 | mnt->auth_flavor_len = 1; |
| 913 | mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEY; |
| 914 | break; |
| 915 | case Opt_sec_lkeyi: |
| 916 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; |
| 917 | mnt->auth_flavor_len = 1; |
| 918 | mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYI; |
| 919 | break; |
| 920 | case Opt_sec_lkeyp: |
| 921 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; |
| 922 | mnt->auth_flavor_len = 1; |
| 923 | mnt->auth_flavors[0] = RPC_AUTH_GSS_LKEYP; |
| 924 | break; |
| 925 | case Opt_sec_spkm: |
| 926 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; |
| 927 | mnt->auth_flavor_len = 1; |
| 928 | mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKM; |
| 929 | break; |
| 930 | case Opt_sec_spkmi: |
| 931 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; |
| 932 | mnt->auth_flavor_len = 1; |
| 933 | mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMI; |
| 934 | break; |
| 935 | case Opt_sec_spkmp: |
| 936 | mnt->flags |= NFS_MOUNT_SECFLAVOUR; |
| 937 | mnt->auth_flavor_len = 1; |
| 938 | mnt->auth_flavors[0] = RPC_AUTH_GSS_SPKMP; |
| 939 | break; |
| 940 | default: |
| 941 | goto out_unrec_sec; |
| 942 | } |
| 943 | break; |
| 944 | case Opt_proto: |
| 945 | string = match_strdup(args); |
| 946 | if (string == NULL) |
| 947 | goto out_nomem; |
| 948 | token = match_token(string, |
| 949 | nfs_xprt_protocol_tokens, args); |
| 950 | kfree(string); |
| 951 | |
| 952 | switch (token) { |
Chuck Lever | fdb66ff | 2007-08-29 17:58:57 -0400 | [diff] [blame] | 953 | case Opt_xprt_udp: |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 954 | mnt->flags &= ~NFS_MOUNT_TCP; |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 955 | mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 956 | mnt->timeo = 7; |
| 957 | mnt->retrans = 5; |
| 958 | break; |
Chuck Lever | fdb66ff | 2007-08-29 17:58:57 -0400 | [diff] [blame] | 959 | case Opt_xprt_tcp: |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 960 | mnt->flags |= NFS_MOUNT_TCP; |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 961 | mnt->nfs_server.protocol = XPRT_TRANSPORT_TCP; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 962 | mnt->timeo = 600; |
| 963 | mnt->retrans = 2; |
| 964 | break; |
\"Talpey, Thomas\ | 2cf7ff7 | 2007-09-10 13:49:41 -0400 | [diff] [blame] | 965 | case Opt_xprt_rdma: |
| 966 | /* vector side protocols to TCP */ |
| 967 | mnt->flags |= NFS_MOUNT_TCP; |
| 968 | mnt->nfs_server.protocol = XPRT_TRANSPORT_RDMA; |
| 969 | mnt->timeo = 600; |
| 970 | mnt->retrans = 2; |
| 971 | break; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 972 | default: |
| 973 | goto out_unrec_xprt; |
| 974 | } |
| 975 | break; |
| 976 | case Opt_mountproto: |
| 977 | string = match_strdup(args); |
| 978 | if (string == NULL) |
| 979 | goto out_nomem; |
| 980 | token = match_token(string, |
| 981 | nfs_xprt_protocol_tokens, args); |
| 982 | kfree(string); |
| 983 | |
| 984 | switch (token) { |
Chuck Lever | fdb66ff | 2007-08-29 17:58:57 -0400 | [diff] [blame] | 985 | case Opt_xprt_udp: |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 986 | mnt->mount_server.protocol = XPRT_TRANSPORT_UDP; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 987 | break; |
Chuck Lever | fdb66ff | 2007-08-29 17:58:57 -0400 | [diff] [blame] | 988 | case Opt_xprt_tcp: |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 989 | mnt->mount_server.protocol = XPRT_TRANSPORT_TCP; |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 990 | break; |
\"Talpey, Thomas\ | 2cf7ff7 | 2007-09-10 13:49:41 -0400 | [diff] [blame] | 991 | case Opt_xprt_rdma: /* not used for side protocols */ |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 992 | default: |
| 993 | goto out_unrec_xprt; |
| 994 | } |
| 995 | break; |
| 996 | case Opt_addr: |
| 997 | string = match_strdup(args); |
| 998 | if (string == NULL) |
| 999 | goto out_nomem; |
Chuck Lever | 9412b92 | 2007-12-10 14:59:21 -0500 | [diff] [blame] | 1000 | nfs_parse_server_address(string, (struct sockaddr *) |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1001 | &mnt->nfs_server.address, |
| 1002 | &mnt->nfs_server.addrlen); |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 1003 | kfree(string); |
| 1004 | break; |
| 1005 | case Opt_clientaddr: |
| 1006 | string = match_strdup(args); |
| 1007 | if (string == NULL) |
| 1008 | goto out_nomem; |
| 1009 | mnt->client_address = string; |
| 1010 | break; |
Chuck Lever | 3383203 | 2007-12-10 14:59:13 -0500 | [diff] [blame] | 1011 | case Opt_mounthost: |
| 1012 | string = match_strdup(args); |
| 1013 | if (string == NULL) |
| 1014 | goto out_nomem; |
| 1015 | mnt->mount_server.hostname = string; |
| 1016 | break; |
Chuck Lever | 0ac8377 | 2007-09-11 18:01:04 -0400 | [diff] [blame] | 1017 | case Opt_mountaddr: |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 1018 | string = match_strdup(args); |
| 1019 | if (string == NULL) |
| 1020 | goto out_nomem; |
Chuck Lever | 9412b92 | 2007-12-10 14:59:21 -0500 | [diff] [blame] | 1021 | nfs_parse_server_address(string, (struct sockaddr *) |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1022 | &mnt->mount_server.address, |
| 1023 | &mnt->mount_server.addrlen); |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 1024 | kfree(string); |
| 1025 | break; |
| 1026 | |
| 1027 | case Opt_userspace: |
| 1028 | case Opt_deprecated: |
| 1029 | break; |
| 1030 | |
| 1031 | default: |
| 1032 | goto out_unknown; |
| 1033 | } |
| 1034 | } |
| 1035 | |
Chuck Lever | 04dcd6e | 2007-12-10 14:57:53 -0500 | [diff] [blame] | 1036 | nfs_set_port((struct sockaddr *)&mnt->nfs_server.address, port); |
| 1037 | |
Chuck Lever | bf0fd76 | 2007-07-01 12:13:44 -0400 | [diff] [blame] | 1038 | return 1; |
| 1039 | |
| 1040 | out_nomem: |
| 1041 | printk(KERN_INFO "NFS: not enough memory to parse option\n"); |
| 1042 | return 0; |
| 1043 | |
| 1044 | out_unrec_vers: |
| 1045 | printk(KERN_INFO "NFS: unrecognized NFS version number\n"); |
| 1046 | return 0; |
| 1047 | |
| 1048 | out_unrec_xprt: |
| 1049 | printk(KERN_INFO "NFS: unrecognized transport protocol\n"); |
| 1050 | return 0; |
| 1051 | |
| 1052 | out_unrec_sec: |
| 1053 | printk(KERN_INFO "NFS: unrecognized security flavor\n"); |
| 1054 | return 0; |
| 1055 | |
| 1056 | out_unknown: |
| 1057 | printk(KERN_INFO "NFS: unknown mount option: %s\n", p); |
| 1058 | return 0; |
| 1059 | } |
| 1060 | |
| 1061 | /* |
Chuck Lever | 0076d7b | 2007-07-01 12:13:49 -0400 | [diff] [blame] | 1062 | * Use the remote server's MOUNT service to request the NFS file handle |
| 1063 | * corresponding to the provided path. |
| 1064 | */ |
| 1065 | static int nfs_try_mount(struct nfs_parsed_mount_data *args, |
| 1066 | struct nfs_fh *root_fh) |
| 1067 | { |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1068 | struct sockaddr *sap = (struct sockaddr *)&args->mount_server.address; |
Chuck Lever | 3383203 | 2007-12-10 14:59:13 -0500 | [diff] [blame] | 1069 | char *hostname; |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1070 | int status; |
Chuck Lever | 0076d7b | 2007-07-01 12:13:49 -0400 | [diff] [blame] | 1071 | |
| 1072 | if (args->mount_server.version == 0) { |
| 1073 | if (args->flags & NFS_MOUNT_VER3) |
| 1074 | args->mount_server.version = NFS_MNT3_VERSION; |
| 1075 | else |
| 1076 | args->mount_server.version = NFS_MNT_VERSION; |
| 1077 | } |
| 1078 | |
Chuck Lever | 3383203 | 2007-12-10 14:59:13 -0500 | [diff] [blame] | 1079 | if (args->mount_server.hostname) |
| 1080 | hostname = args->mount_server.hostname; |
| 1081 | else |
| 1082 | hostname = args->nfs_server.hostname; |
| 1083 | |
Chuck Lever | 0076d7b | 2007-07-01 12:13:49 -0400 | [diff] [blame] | 1084 | /* |
| 1085 | * Construct the mount server's address. |
| 1086 | */ |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1087 | if (args->mount_server.address.ss_family == AF_UNSPEC) { |
| 1088 | memcpy(sap, &args->nfs_server.address, |
| 1089 | args->nfs_server.addrlen); |
| 1090 | args->mount_server.addrlen = args->nfs_server.addrlen; |
| 1091 | } |
| 1092 | |
James Lentini | aad7000 | 2007-09-24 17:32:49 -0400 | [diff] [blame] | 1093 | /* |
| 1094 | * autobind will be used if mount_server.port == 0 |
| 1095 | */ |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1096 | nfs_set_port(sap, args->mount_server.port); |
Chuck Lever | 0076d7b | 2007-07-01 12:13:49 -0400 | [diff] [blame] | 1097 | |
| 1098 | /* |
| 1099 | * Now ask the mount server to map our export path |
| 1100 | * to a file handle. |
| 1101 | */ |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1102 | status = nfs_mount(sap, |
| 1103 | args->mount_server.addrlen, |
Chuck Lever | 3383203 | 2007-12-10 14:59:13 -0500 | [diff] [blame] | 1104 | hostname, |
Chuck Lever | 0076d7b | 2007-07-01 12:13:49 -0400 | [diff] [blame] | 1105 | args->nfs_server.export_path, |
| 1106 | args->mount_server.version, |
| 1107 | args->mount_server.protocol, |
| 1108 | root_fh); |
Chuck Lever | efd8340 | 2007-09-11 18:00:58 -0400 | [diff] [blame] | 1109 | if (status == 0) |
| 1110 | return 0; |
Chuck Lever | 0076d7b | 2007-07-01 12:13:49 -0400 | [diff] [blame] | 1111 | |
Chuck Lever | 3383203 | 2007-12-10 14:59:13 -0500 | [diff] [blame] | 1112 | dfprintk(MOUNT, "NFS: unable to mount server %s, error %d", |
| 1113 | hostname, status); |
Chuck Lever | 0076d7b | 2007-07-01 12:13:49 -0400 | [diff] [blame] | 1114 | return status; |
| 1115 | } |
| 1116 | |
| 1117 | /* |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1118 | * Validate the NFS2/NFS3 mount data |
| 1119 | * - fills in the mount root filehandle |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1120 | * |
| 1121 | * For option strings, user space handles the following behaviors: |
| 1122 | * |
| 1123 | * + DNS: mapping server host name to IP address ("addr=" option) |
| 1124 | * |
| 1125 | * + failure mode: how to behave if a mount request can't be handled |
| 1126 | * immediately ("fg/bg" option) |
| 1127 | * |
| 1128 | * + retry: how often to retry a mount request ("retry=" option) |
| 1129 | * |
| 1130 | * + breaking back: trying proto=udp after proto=tcp, v2 after v3, |
| 1131 | * mountproto=tcp after mountproto=udp, and so on |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1132 | */ |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1133 | static int nfs_validate_mount_data(void *options, |
| 1134 | struct nfs_parsed_mount_data *args, |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1135 | struct nfs_fh *mntfh, |
| 1136 | const char *dev_name) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1137 | { |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1138 | struct nfs_mount_data *data = (struct nfs_mount_data *)options; |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1139 | |
Russell King | f16c960 | 2007-11-16 22:13:24 +0000 | [diff] [blame] | 1140 | memset(args, 0, sizeof(*args)); |
| 1141 | |
Chuck Lever | 5df36e7 | 2007-07-01 12:12:56 -0400 | [diff] [blame] | 1142 | if (data == NULL) |
| 1143 | goto out_no_data; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1144 | |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1145 | args->flags = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP); |
| 1146 | args->rsize = NFS_MAX_FILE_IO_SIZE; |
| 1147 | args->wsize = NFS_MAX_FILE_IO_SIZE; |
| 1148 | args->timeo = 600; |
| 1149 | args->retrans = 2; |
| 1150 | args->acregmin = 3; |
| 1151 | args->acregmax = 60; |
| 1152 | args->acdirmin = 30; |
| 1153 | args->acdirmax = 60; |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 1154 | args->mount_server.protocol = XPRT_TRANSPORT_UDP; |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 1155 | args->nfs_server.protocol = XPRT_TRANSPORT_TCP; |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1156 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1157 | switch (data->version) { |
Chuck Lever | 5df36e7 | 2007-07-01 12:12:56 -0400 | [diff] [blame] | 1158 | case 1: |
| 1159 | data->namlen = 0; |
| 1160 | case 2: |
| 1161 | data->bsize = 0; |
| 1162 | case 3: |
| 1163 | if (data->flags & NFS_MOUNT_VER3) |
| 1164 | goto out_no_v3; |
| 1165 | data->root.size = NFS2_FHSIZE; |
| 1166 | memcpy(data->root.data, data->old_root.data, NFS2_FHSIZE); |
| 1167 | case 4: |
| 1168 | if (data->flags & NFS_MOUNT_SECFLAVOUR) |
| 1169 | goto out_no_sec; |
| 1170 | case 5: |
| 1171 | memset(data->context, 0, sizeof(data->context)); |
| 1172 | case 6: |
| 1173 | if (data->flags & NFS_MOUNT_VER3) |
| 1174 | mntfh->size = data->root.size; |
| 1175 | else |
| 1176 | mntfh->size = NFS2_FHSIZE; |
| 1177 | |
| 1178 | if (mntfh->size > sizeof(mntfh->data)) |
| 1179 | goto out_invalid_fh; |
| 1180 | |
| 1181 | memcpy(mntfh->data, data->root.data, mntfh->size); |
| 1182 | if (mntfh->size < sizeof(mntfh->data)) |
| 1183 | memset(mntfh->data + mntfh->size, 0, |
| 1184 | sizeof(mntfh->data) - mntfh->size); |
Chuck Lever | 6e88e06 | 2007-09-24 15:39:50 -0400 | [diff] [blame] | 1185 | |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1186 | /* |
| 1187 | * Translate to nfs_parsed_mount_data, which nfs_fill_super |
| 1188 | * can deal with. |
| 1189 | */ |
| 1190 | args->flags = data->flags; |
| 1191 | args->rsize = data->rsize; |
| 1192 | args->wsize = data->wsize; |
| 1193 | args->flags = data->flags; |
| 1194 | args->timeo = data->timeo; |
| 1195 | args->retrans = data->retrans; |
| 1196 | args->acregmin = data->acregmin; |
| 1197 | args->acregmax = data->acregmax; |
| 1198 | args->acdirmin = data->acdirmin; |
| 1199 | args->acdirmax = data->acdirmax; |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1200 | |
| 1201 | memcpy(&args->nfs_server.address, &data->addr, |
| 1202 | sizeof(data->addr)); |
| 1203 | args->nfs_server.addrlen = sizeof(data->addr); |
| 1204 | if (!nfs_verify_server_address((struct sockaddr *) |
| 1205 | &args->nfs_server.address)) |
| 1206 | goto out_no_address; |
| 1207 | |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1208 | if (!(data->flags & NFS_MOUNT_TCP)) |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 1209 | args->nfs_server.protocol = XPRT_TRANSPORT_UDP; |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1210 | /* N.B. caller will free nfs_server.hostname in all cases */ |
| 1211 | args->nfs_server.hostname = kstrdup(data->hostname, GFP_KERNEL); |
| 1212 | args->namlen = data->namlen; |
| 1213 | args->bsize = data->bsize; |
| 1214 | args->auth_flavors[0] = data->pseudoflavor; |
Chuck Lever | 5df36e7 | 2007-07-01 12:12:56 -0400 | [diff] [blame] | 1215 | break; |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1216 | default: { |
| 1217 | unsigned int len; |
| 1218 | char *c; |
| 1219 | int status; |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1220 | |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1221 | if (nfs_parse_mount_options((char *)options, args) == 0) |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1222 | return -EINVAL; |
| 1223 | |
Chuck Lever | 6e88e06 | 2007-09-24 15:39:50 -0400 | [diff] [blame] | 1224 | if (!nfs_verify_server_address((struct sockaddr *) |
| 1225 | &args->nfs_server.address)) |
| 1226 | goto out_no_address; |
| 1227 | |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1228 | c = strchr(dev_name, ':'); |
| 1229 | if (c == NULL) |
| 1230 | return -EINVAL; |
Chuck Lever | 350c73a | 2007-08-29 17:59:01 -0400 | [diff] [blame] | 1231 | len = c - dev_name; |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1232 | /* N.B. caller will free nfs_server.hostname in all cases */ |
| 1233 | args->nfs_server.hostname = kstrndup(dev_name, len, GFP_KERNEL); |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1234 | |
| 1235 | c++; |
| 1236 | if (strlen(c) > NFS_MAXPATHLEN) |
Chuck Lever | 7d1cca72 | 2007-08-29 17:59:03 -0400 | [diff] [blame] | 1237 | return -ENAMETOOLONG; |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1238 | args->nfs_server.export_path = c; |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1239 | |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1240 | status = nfs_try_mount(args, mntfh); |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1241 | if (status) |
Chuck Lever | fdc6e2c | 2007-08-29 17:58:59 -0400 | [diff] [blame] | 1242 | return status; |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1243 | |
Chuck Lever | 136d558 | 2007-07-01 12:13:54 -0400 | [diff] [blame] | 1244 | break; |
| 1245 | } |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1246 | } |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1247 | |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1248 | if (!(args->flags & NFS_MOUNT_SECFLAVOUR)) |
| 1249 | args->auth_flavors[0] = RPC_AUTH_UNIX; |
Trond Myklebust | 36b15c5 | 2006-08-22 20:06:14 -0400 | [diff] [blame] | 1250 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1251 | #ifndef CONFIG_NFS_V3 |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1252 | if (args->flags & NFS_MOUNT_VER3) |
Chuck Lever | 5df36e7 | 2007-07-01 12:12:56 -0400 | [diff] [blame] | 1253 | goto out_v3_not_compiled; |
| 1254 | #endif /* !CONFIG_NFS_V3 */ |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1255 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1256 | return 0; |
Chuck Lever | 5df36e7 | 2007-07-01 12:12:56 -0400 | [diff] [blame] | 1257 | |
| 1258 | out_no_data: |
| 1259 | dfprintk(MOUNT, "NFS: mount program didn't pass any mount data\n"); |
| 1260 | return -EINVAL; |
| 1261 | |
| 1262 | out_no_v3: |
| 1263 | dfprintk(MOUNT, "NFS: nfs_mount_data version %d does not support v3\n", |
| 1264 | data->version); |
| 1265 | return -EINVAL; |
| 1266 | |
| 1267 | out_no_sec: |
| 1268 | dfprintk(MOUNT, "NFS: nfs_mount_data version supports only AUTH_SYS\n"); |
| 1269 | return -EINVAL; |
| 1270 | |
Chuck Lever | 5df36e7 | 2007-07-01 12:12:56 -0400 | [diff] [blame] | 1271 | #ifndef CONFIG_NFS_V3 |
| 1272 | out_v3_not_compiled: |
| 1273 | dfprintk(MOUNT, "NFS: NFSv3 is not compiled into kernel\n"); |
| 1274 | return -EPROTONOSUPPORT; |
| 1275 | #endif /* !CONFIG_NFS_V3 */ |
| 1276 | |
| 1277 | out_no_address: |
| 1278 | dfprintk(MOUNT, "NFS: mount program didn't pass remote address\n"); |
| 1279 | return -EINVAL; |
| 1280 | |
| 1281 | out_invalid_fh: |
| 1282 | dfprintk(MOUNT, "NFS: invalid root filehandle\n"); |
| 1283 | return -EINVAL; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1284 | } |
| 1285 | |
| 1286 | /* |
| 1287 | * Initialise the common bits of the superblock |
| 1288 | */ |
| 1289 | static inline void nfs_initialise_sb(struct super_block *sb) |
| 1290 | { |
| 1291 | struct nfs_server *server = NFS_SB(sb); |
| 1292 | |
| 1293 | sb->s_magic = NFS_SUPER_MAGIC; |
| 1294 | |
| 1295 | /* We probably want something more informative here */ |
| 1296 | snprintf(sb->s_id, sizeof(sb->s_id), |
| 1297 | "%x:%x", MAJOR(sb->s_dev), MINOR(sb->s_dev)); |
| 1298 | |
| 1299 | if (sb->s_blocksize == 0) |
| 1300 | sb->s_blocksize = nfs_block_bits(server->wsize, |
| 1301 | &sb->s_blocksize_bits); |
| 1302 | |
| 1303 | if (server->flags & NFS_MOUNT_NOAC) |
| 1304 | sb->s_flags |= MS_SYNCHRONOUS; |
| 1305 | |
| 1306 | nfs_super_set_maxbytes(sb, server->maxfilesize); |
| 1307 | } |
| 1308 | |
| 1309 | /* |
| 1310 | * Finish setting up an NFS2/3 superblock |
| 1311 | */ |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1312 | static void nfs_fill_super(struct super_block *sb, |
| 1313 | struct nfs_parsed_mount_data *data) |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1314 | { |
| 1315 | struct nfs_server *server = NFS_SB(sb); |
| 1316 | |
| 1317 | sb->s_blocksize_bits = 0; |
| 1318 | sb->s_blocksize = 0; |
| 1319 | if (data->bsize) |
| 1320 | sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits); |
| 1321 | |
| 1322 | if (server->flags & NFS_MOUNT_VER3) { |
| 1323 | /* The VFS shouldn't apply the umask to mode bits. We will do |
| 1324 | * so ourselves when necessary. |
| 1325 | */ |
| 1326 | sb->s_flags |= MS_POSIXACL; |
| 1327 | sb->s_time_gran = 1; |
| 1328 | } |
| 1329 | |
| 1330 | sb->s_op = &nfs_sops; |
| 1331 | nfs_initialise_sb(sb); |
| 1332 | } |
| 1333 | |
| 1334 | /* |
| 1335 | * Finish setting up a cloned NFS2/3 superblock |
| 1336 | */ |
| 1337 | static void nfs_clone_super(struct super_block *sb, |
| 1338 | const struct super_block *old_sb) |
| 1339 | { |
| 1340 | struct nfs_server *server = NFS_SB(sb); |
| 1341 | |
| 1342 | sb->s_blocksize_bits = old_sb->s_blocksize_bits; |
| 1343 | sb->s_blocksize = old_sb->s_blocksize; |
| 1344 | sb->s_maxbytes = old_sb->s_maxbytes; |
| 1345 | |
| 1346 | if (server->flags & NFS_MOUNT_VER3) { |
| 1347 | /* The VFS shouldn't apply the umask to mode bits. We will do |
| 1348 | * so ourselves when necessary. |
| 1349 | */ |
| 1350 | sb->s_flags |= MS_POSIXACL; |
| 1351 | sb->s_time_gran = 1; |
| 1352 | } |
| 1353 | |
| 1354 | sb->s_op = old_sb->s_op; |
| 1355 | nfs_initialise_sb(sb); |
| 1356 | } |
| 1357 | |
Trond Myklebust | 275a5d2 | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1358 | #define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS) |
| 1359 | |
| 1360 | static int nfs_compare_mount_options(const struct super_block *s, const struct nfs_server *b, int flags) |
| 1361 | { |
| 1362 | const struct nfs_server *a = s->s_fs_info; |
| 1363 | const struct rpc_clnt *clnt_a = a->client; |
| 1364 | const struct rpc_clnt *clnt_b = b->client; |
| 1365 | |
| 1366 | if ((s->s_flags & NFS_MS_MASK) != (flags & NFS_MS_MASK)) |
| 1367 | goto Ebusy; |
| 1368 | if (a->nfs_client != b->nfs_client) |
| 1369 | goto Ebusy; |
| 1370 | if (a->flags != b->flags) |
| 1371 | goto Ebusy; |
| 1372 | if (a->wsize != b->wsize) |
| 1373 | goto Ebusy; |
| 1374 | if (a->rsize != b->rsize) |
| 1375 | goto Ebusy; |
| 1376 | if (a->acregmin != b->acregmin) |
| 1377 | goto Ebusy; |
| 1378 | if (a->acregmax != b->acregmax) |
| 1379 | goto Ebusy; |
| 1380 | if (a->acdirmin != b->acdirmin) |
| 1381 | goto Ebusy; |
| 1382 | if (a->acdirmax != b->acdirmax) |
| 1383 | goto Ebusy; |
| 1384 | if (clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor) |
| 1385 | goto Ebusy; |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1386 | return 1; |
Trond Myklebust | 275a5d2 | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1387 | Ebusy: |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1388 | return 0; |
| 1389 | } |
| 1390 | |
| 1391 | struct nfs_sb_mountdata { |
| 1392 | struct nfs_server *server; |
| 1393 | int mntflags; |
| 1394 | }; |
| 1395 | |
| 1396 | static int nfs_set_super(struct super_block *s, void *data) |
| 1397 | { |
| 1398 | struct nfs_sb_mountdata *sb_mntdata = data; |
| 1399 | struct nfs_server *server = sb_mntdata->server; |
| 1400 | int ret; |
| 1401 | |
| 1402 | s->s_flags = sb_mntdata->mntflags; |
| 1403 | s->s_fs_info = server; |
| 1404 | ret = set_anon_super(s, server); |
| 1405 | if (ret == 0) |
| 1406 | server->s_dev = s->s_dev; |
| 1407 | return ret; |
| 1408 | } |
| 1409 | |
Chuck Lever | fd00a8f | 2007-12-10 14:57:38 -0500 | [diff] [blame] | 1410 | static int nfs_compare_super_address(struct nfs_server *server1, |
| 1411 | struct nfs_server *server2) |
| 1412 | { |
| 1413 | struct sockaddr *sap1, *sap2; |
| 1414 | |
| 1415 | sap1 = (struct sockaddr *)&server1->nfs_client->cl_addr; |
| 1416 | sap2 = (struct sockaddr *)&server2->nfs_client->cl_addr; |
| 1417 | |
| 1418 | if (sap1->sa_family != sap2->sa_family) |
| 1419 | return 0; |
| 1420 | |
| 1421 | switch (sap1->sa_family) { |
| 1422 | case AF_INET: { |
| 1423 | struct sockaddr_in *sin1 = (struct sockaddr_in *)sap1; |
| 1424 | struct sockaddr_in *sin2 = (struct sockaddr_in *)sap2; |
| 1425 | if (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr) |
| 1426 | return 0; |
| 1427 | if (sin1->sin_port != sin2->sin_port) |
| 1428 | return 0; |
| 1429 | break; |
| 1430 | } |
| 1431 | case AF_INET6: { |
| 1432 | struct sockaddr_in6 *sin1 = (struct sockaddr_in6 *)sap1; |
| 1433 | struct sockaddr_in6 *sin2 = (struct sockaddr_in6 *)sap2; |
| 1434 | if (!ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr)) |
| 1435 | return 0; |
| 1436 | if (sin1->sin6_port != sin2->sin6_port) |
| 1437 | return 0; |
| 1438 | break; |
| 1439 | } |
| 1440 | default: |
| 1441 | return 0; |
| 1442 | } |
| 1443 | |
| 1444 | return 1; |
| 1445 | } |
| 1446 | |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1447 | static int nfs_compare_super(struct super_block *sb, void *data) |
| 1448 | { |
| 1449 | struct nfs_sb_mountdata *sb_mntdata = data; |
| 1450 | struct nfs_server *server = sb_mntdata->server, *old = NFS_SB(sb); |
| 1451 | int mntflags = sb_mntdata->mntflags; |
| 1452 | |
Chuck Lever | fd00a8f | 2007-12-10 14:57:38 -0500 | [diff] [blame] | 1453 | if (!nfs_compare_super_address(old, server)) |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1454 | return 0; |
| 1455 | /* Note: NFS_MOUNT_UNSHARED == NFS4_MOUNT_UNSHARED */ |
| 1456 | if (old->flags & NFS_MOUNT_UNSHARED) |
| 1457 | return 0; |
| 1458 | if (memcmp(&old->fsid, &server->fsid, sizeof(old->fsid)) != 0) |
| 1459 | return 0; |
| 1460 | return nfs_compare_mount_options(sb, server, mntflags); |
Trond Myklebust | 275a5d2 | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1461 | } |
| 1462 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1463 | static int nfs_get_sb(struct file_system_type *fs_type, |
| 1464 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) |
| 1465 | { |
| 1466 | struct nfs_server *server = NULL; |
| 1467 | struct super_block *s; |
| 1468 | struct nfs_fh mntfh; |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1469 | struct nfs_parsed_mount_data data; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1470 | struct dentry *mntroot; |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1471 | int (*compare_super)(struct super_block *, void *) = nfs_compare_super; |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1472 | struct nfs_sb_mountdata sb_mntdata = { |
| 1473 | .mntflags = flags, |
| 1474 | }; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1475 | int error; |
| 1476 | |
| 1477 | /* Validate the mount data */ |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1478 | error = nfs_validate_mount_data(raw_data, &data, &mntfh, dev_name); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1479 | if (error < 0) |
Chuck Lever | 0655960 | 2007-07-01 12:12:35 -0400 | [diff] [blame] | 1480 | goto out; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1481 | |
| 1482 | /* Get a volume representation */ |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1483 | server = nfs_create_server(&data, &mntfh); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1484 | if (IS_ERR(server)) { |
| 1485 | error = PTR_ERR(server); |
Chuck Lever | 0655960 | 2007-07-01 12:12:35 -0400 | [diff] [blame] | 1486 | goto out; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1487 | } |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1488 | sb_mntdata.server = server; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1489 | |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1490 | if (server->flags & NFS_MOUNT_UNSHARED) |
| 1491 | compare_super = NULL; |
| 1492 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1493 | /* Get a superblock - note that we may end up sharing one that already exists */ |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1494 | s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata); |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 1495 | if (IS_ERR(s)) { |
| 1496 | error = PTR_ERR(s); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1497 | goto out_err_nosb; |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 1498 | } |
| 1499 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1500 | if (s->s_fs_info != server) { |
| 1501 | nfs_free_server(server); |
| 1502 | server = NULL; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1503 | } |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1504 | |
| 1505 | if (!s->s_root) { |
| 1506 | /* initial superblock/root creation */ |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1507 | nfs_fill_super(s, &data); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1508 | } |
| 1509 | |
| 1510 | mntroot = nfs_get_root(s, &mntfh); |
| 1511 | if (IS_ERR(mntroot)) { |
| 1512 | error = PTR_ERR(mntroot); |
| 1513 | goto error_splat_super; |
| 1514 | } |
| 1515 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1516 | s->s_flags |= MS_ACTIVE; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1517 | mnt->mnt_sb = s; |
| 1518 | mnt->mnt_root = mntroot; |
Chuck Lever | 0655960 | 2007-07-01 12:12:35 -0400 | [diff] [blame] | 1519 | error = 0; |
| 1520 | |
| 1521 | out: |
\"Talpey, Thomas\ | 2283f8d | 2007-09-10 13:43:56 -0400 | [diff] [blame] | 1522 | kfree(data.nfs_server.hostname); |
Chuck Lever | 3383203 | 2007-12-10 14:59:13 -0500 | [diff] [blame] | 1523 | kfree(data.mount_server.hostname); |
Chuck Lever | 0655960 | 2007-07-01 12:12:35 -0400 | [diff] [blame] | 1524 | return error; |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 1525 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1526 | out_err_nosb: |
| 1527 | nfs_free_server(server); |
Chuck Lever | 0655960 | 2007-07-01 12:12:35 -0400 | [diff] [blame] | 1528 | goto out; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1529 | |
| 1530 | error_splat_super: |
| 1531 | up_write(&s->s_umount); |
| 1532 | deactivate_super(s); |
Chuck Lever | 0655960 | 2007-07-01 12:12:35 -0400 | [diff] [blame] | 1533 | goto out; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1534 | } |
| 1535 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1536 | /* |
| 1537 | * Destroy an NFS2/3 superblock |
| 1538 | */ |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1539 | static void nfs_kill_super(struct super_block *s) |
| 1540 | { |
| 1541 | struct nfs_server *server = NFS_SB(s); |
| 1542 | |
| 1543 | kill_anon_super(s); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1544 | nfs_free_server(server); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1545 | } |
| 1546 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1547 | /* |
| 1548 | * Clone an NFS2/3 server record on xdev traversal (FSID-change) |
| 1549 | */ |
| 1550 | static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, |
| 1551 | const char *dev_name, void *raw_data, |
| 1552 | struct vfsmount *mnt) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1553 | { |
| 1554 | struct nfs_clone_mount *data = raw_data; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1555 | struct super_block *s; |
| 1556 | struct nfs_server *server; |
| 1557 | struct dentry *mntroot; |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1558 | int (*compare_super)(struct super_block *, void *) = nfs_compare_super; |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1559 | struct nfs_sb_mountdata sb_mntdata = { |
| 1560 | .mntflags = flags, |
| 1561 | }; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1562 | int error; |
| 1563 | |
| 1564 | dprintk("--> nfs_xdev_get_sb()\n"); |
| 1565 | |
| 1566 | /* create a new volume representation */ |
| 1567 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); |
| 1568 | if (IS_ERR(server)) { |
| 1569 | error = PTR_ERR(server); |
| 1570 | goto out_err_noserver; |
| 1571 | } |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1572 | sb_mntdata.server = server; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1573 | |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1574 | if (server->flags & NFS_MOUNT_UNSHARED) |
| 1575 | compare_super = NULL; |
| 1576 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1577 | /* Get a superblock - note that we may end up sharing one that already exists */ |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1578 | s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1579 | if (IS_ERR(s)) { |
| 1580 | error = PTR_ERR(s); |
| 1581 | goto out_err_nosb; |
| 1582 | } |
| 1583 | |
| 1584 | if (s->s_fs_info != server) { |
| 1585 | nfs_free_server(server); |
| 1586 | server = NULL; |
| 1587 | } |
| 1588 | |
| 1589 | if (!s->s_root) { |
| 1590 | /* initial superblock/root creation */ |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1591 | nfs_clone_super(s, data->sb); |
| 1592 | } |
| 1593 | |
| 1594 | mntroot = nfs_get_root(s, data->fh); |
| 1595 | if (IS_ERR(mntroot)) { |
| 1596 | error = PTR_ERR(mntroot); |
| 1597 | goto error_splat_super; |
| 1598 | } |
Trond Myklebust | e9cc6c2 | 2008-01-02 13:28:57 -0500 | [diff] [blame] | 1599 | if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) { |
Neil Brown | 4c1fe2f | 2007-11-01 16:50:20 +1100 | [diff] [blame] | 1600 | dput(mntroot); |
| 1601 | error = -ESTALE; |
| 1602 | goto error_splat_super; |
| 1603 | } |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1604 | |
| 1605 | s->s_flags |= MS_ACTIVE; |
| 1606 | mnt->mnt_sb = s; |
| 1607 | mnt->mnt_root = mntroot; |
| 1608 | |
| 1609 | dprintk("<-- nfs_xdev_get_sb() = 0\n"); |
| 1610 | return 0; |
| 1611 | |
| 1612 | out_err_nosb: |
| 1613 | nfs_free_server(server); |
| 1614 | out_err_noserver: |
| 1615 | dprintk("<-- nfs_xdev_get_sb() = %d [error]\n", error); |
| 1616 | return error; |
| 1617 | |
| 1618 | error_splat_super: |
| 1619 | up_write(&s->s_umount); |
| 1620 | deactivate_super(s); |
| 1621 | dprintk("<-- nfs_xdev_get_sb() = %d [splat]\n", error); |
| 1622 | return error; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1623 | } |
| 1624 | |
| 1625 | #ifdef CONFIG_NFS_V4 |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1626 | |
| 1627 | /* |
| 1628 | * Finish setting up a cloned NFS4 superblock |
| 1629 | */ |
| 1630 | static void nfs4_clone_super(struct super_block *sb, |
| 1631 | const struct super_block *old_sb) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1632 | { |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1633 | sb->s_blocksize_bits = old_sb->s_blocksize_bits; |
| 1634 | sb->s_blocksize = old_sb->s_blocksize; |
| 1635 | sb->s_maxbytes = old_sb->s_maxbytes; |
| 1636 | sb->s_time_gran = 1; |
| 1637 | sb->s_op = old_sb->s_op; |
| 1638 | nfs_initialise_sb(sb); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1639 | } |
| 1640 | |
| 1641 | /* |
| 1642 | * Set up an NFS4 superblock |
| 1643 | */ |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1644 | static void nfs4_fill_super(struct super_block *sb) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1645 | { |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1646 | sb->s_time_gran = 1; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1647 | sb->s_op = &nfs4_sops; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1648 | nfs_initialise_sb(sb); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1649 | } |
| 1650 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1651 | /* |
Chuck Lever | 0d0f0c1 | 2007-12-10 14:58:00 -0500 | [diff] [blame] | 1652 | * If the user didn't specify a port, set the port number to |
| 1653 | * the NFS version 4 default port. |
| 1654 | */ |
| 1655 | static void nfs4_default_port(struct sockaddr *sap) |
| 1656 | { |
| 1657 | switch (sap->sa_family) { |
| 1658 | case AF_INET: { |
| 1659 | struct sockaddr_in *ap = (struct sockaddr_in *)sap; |
| 1660 | if (ap->sin_port == 0) |
| 1661 | ap->sin_port = htons(NFS_PORT); |
| 1662 | break; |
| 1663 | } |
| 1664 | case AF_INET6: { |
| 1665 | struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap; |
| 1666 | if (ap->sin6_port == 0) |
| 1667 | ap->sin6_port = htons(NFS_PORT); |
| 1668 | break; |
| 1669 | } |
| 1670 | } |
| 1671 | } |
| 1672 | |
| 1673 | /* |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1674 | * Validate NFSv4 mount options |
| 1675 | */ |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1676 | static int nfs4_validate_mount_data(void *options, |
| 1677 | struct nfs_parsed_mount_data *args, |
| 1678 | const char *dev_name) |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1679 | { |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1680 | struct sockaddr_in *ap; |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1681 | struct nfs4_mount_data *data = (struct nfs4_mount_data *)options; |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1682 | char *c; |
| 1683 | |
Russell King | f16c960 | 2007-11-16 22:13:24 +0000 | [diff] [blame] | 1684 | memset(args, 0, sizeof(*args)); |
| 1685 | |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1686 | if (data == NULL) |
| 1687 | goto out_no_data; |
| 1688 | |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1689 | args->rsize = NFS_MAX_FILE_IO_SIZE; |
| 1690 | args->wsize = NFS_MAX_FILE_IO_SIZE; |
| 1691 | args->timeo = 600; |
| 1692 | args->retrans = 2; |
| 1693 | args->acregmin = 3; |
| 1694 | args->acregmax = 60; |
| 1695 | args->acdirmin = 30; |
| 1696 | args->acdirmax = 60; |
\"Talpey, Thomas\ | 0896a72 | 2007-09-10 13:48:23 -0400 | [diff] [blame] | 1697 | args->nfs_server.protocol = XPRT_TRANSPORT_TCP; |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1698 | |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1699 | switch (data->version) { |
| 1700 | case 1: |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1701 | ap = (struct sockaddr_in *)&args->nfs_server.address; |
| 1702 | if (data->host_addrlen > sizeof(args->nfs_server.address)) |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1703 | goto out_no_address; |
Chuck Lever | 4c56801 | 2007-12-10 14:59:28 -0500 | [diff] [blame] | 1704 | if (data->host_addrlen == 0) |
| 1705 | goto out_no_address; |
| 1706 | args->nfs_server.addrlen = data->host_addrlen; |
| 1707 | if (copy_from_user(ap, data->host_addr, data->host_addrlen)) |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1708 | return -EFAULT; |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1709 | if (!nfs_verify_server_address((struct sockaddr *) |
| 1710 | &args->nfs_server.address)) |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1711 | goto out_no_address; |
| 1712 | |
Chuck Lever | 0d0f0c1 | 2007-12-10 14:58:00 -0500 | [diff] [blame] | 1713 | nfs4_default_port((struct sockaddr *) |
| 1714 | &args->nfs_server.address); |
| 1715 | |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1716 | switch (data->auth_flavourlen) { |
| 1717 | case 0: |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1718 | args->auth_flavors[0] = RPC_AUTH_UNIX; |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1719 | break; |
| 1720 | case 1: |
Trond Myklebust | 20c71f5 | 2007-09-20 20:23:51 -0400 | [diff] [blame] | 1721 | if (copy_from_user(&args->auth_flavors[0], |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1722 | data->auth_flavours, |
Trond Myklebust | 20c71f5 | 2007-09-20 20:23:51 -0400 | [diff] [blame] | 1723 | sizeof(args->auth_flavors[0]))) |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1724 | return -EFAULT; |
| 1725 | break; |
| 1726 | default: |
| 1727 | goto out_inval_auth; |
| 1728 | } |
| 1729 | |
| 1730 | c = strndup_user(data->hostname.data, NFS4_MAXNAMLEN); |
| 1731 | if (IS_ERR(c)) |
| 1732 | return PTR_ERR(c); |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1733 | args->nfs_server.hostname = c; |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1734 | |
| 1735 | c = strndup_user(data->mnt_path.data, NFS4_MAXPATHLEN); |
| 1736 | if (IS_ERR(c)) |
| 1737 | return PTR_ERR(c); |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1738 | args->nfs_server.export_path = c; |
| 1739 | dfprintk(MOUNT, "NFS: MNTPATH: '%s'\n", c); |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1740 | |
| 1741 | c = strndup_user(data->client_addr.data, 16); |
| 1742 | if (IS_ERR(c)) |
| 1743 | return PTR_ERR(c); |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1744 | args->client_address = c; |
| 1745 | |
| 1746 | /* |
| 1747 | * Translate to nfs_parsed_mount_data, which nfs4_fill_super |
| 1748 | * can deal with. |
| 1749 | */ |
| 1750 | |
| 1751 | args->flags = data->flags & NFS4_MOUNT_FLAGMASK; |
| 1752 | args->rsize = data->rsize; |
| 1753 | args->wsize = data->wsize; |
| 1754 | args->timeo = data->timeo; |
| 1755 | args->retrans = data->retrans; |
| 1756 | args->acregmin = data->acregmin; |
| 1757 | args->acregmax = data->acregmax; |
| 1758 | args->acdirmin = data->acdirmin; |
| 1759 | args->acdirmax = data->acdirmax; |
| 1760 | args->nfs_server.protocol = data->proto; |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1761 | |
| 1762 | break; |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1763 | default: { |
| 1764 | unsigned int len; |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1765 | |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1766 | if (nfs_parse_mount_options((char *)options, args) == 0) |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1767 | return -EINVAL; |
| 1768 | |
| 1769 | if (!nfs_verify_server_address((struct sockaddr *) |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1770 | &args->nfs_server.address)) |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1771 | return -EINVAL; |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1772 | |
Chuck Lever | 0d0f0c1 | 2007-12-10 14:58:00 -0500 | [diff] [blame] | 1773 | nfs4_default_port((struct sockaddr *) |
| 1774 | &args->nfs_server.address); |
| 1775 | |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1776 | switch (args->auth_flavor_len) { |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1777 | case 0: |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1778 | args->auth_flavors[0] = RPC_AUTH_UNIX; |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1779 | break; |
| 1780 | case 1: |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1781 | break; |
| 1782 | default: |
| 1783 | goto out_inval_auth; |
| 1784 | } |
| 1785 | |
| 1786 | /* |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1787 | * Split "dev_name" into "hostname:mntpath". |
| 1788 | */ |
| 1789 | c = strchr(dev_name, ':'); |
| 1790 | if (c == NULL) |
| 1791 | return -EINVAL; |
| 1792 | /* while calculating len, pretend ':' is '\0' */ |
| 1793 | len = c - dev_name; |
| 1794 | if (len > NFS4_MAXNAMLEN) |
Chuck Lever | 7d1cca72 | 2007-08-29 17:59:03 -0400 | [diff] [blame] | 1795 | return -ENAMETOOLONG; |
Chuck Lever | 6a0ed1d | 2007-10-26 13:32:40 -0400 | [diff] [blame] | 1796 | /* N.B. caller will free nfs_server.hostname in all cases */ |
| 1797 | args->nfs_server.hostname = kstrndup(dev_name, len, GFP_KERNEL); |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1798 | |
| 1799 | c++; /* step over the ':' */ |
| 1800 | len = strlen(c); |
| 1801 | if (len > NFS4_MAXPATHLEN) |
Chuck Lever | 7d1cca72 | 2007-08-29 17:59:03 -0400 | [diff] [blame] | 1802 | return -ENAMETOOLONG; |
Chuck Lever | 6a0ed1d | 2007-10-26 13:32:40 -0400 | [diff] [blame] | 1803 | args->nfs_server.export_path = kstrndup(c, len, GFP_KERNEL); |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1804 | |
Chuck Lever | 6a0ed1d | 2007-10-26 13:32:40 -0400 | [diff] [blame] | 1805 | dprintk("NFS: MNTPATH: '%s'\n", args->nfs_server.export_path); |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1806 | |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1807 | if (args->client_address == NULL) |
Jeff Layton | 0a87cf1 | 2007-07-18 11:28:43 -0400 | [diff] [blame] | 1808 | goto out_no_client_address; |
| 1809 | |
Chuck Lever | 8007122 | 2007-07-01 12:13:59 -0400 | [diff] [blame] | 1810 | break; |
| 1811 | } |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1812 | } |
| 1813 | |
| 1814 | return 0; |
| 1815 | |
| 1816 | out_no_data: |
| 1817 | dfprintk(MOUNT, "NFS4: mount program didn't pass any mount data\n"); |
| 1818 | return -EINVAL; |
| 1819 | |
| 1820 | out_inval_auth: |
| 1821 | dfprintk(MOUNT, "NFS4: Invalid number of RPC auth flavours %d\n", |
| 1822 | data->auth_flavourlen); |
| 1823 | return -EINVAL; |
| 1824 | |
| 1825 | out_no_address: |
| 1826 | dfprintk(MOUNT, "NFS4: mount program didn't pass remote address\n"); |
| 1827 | return -EINVAL; |
Jeff Layton | 0a87cf1 | 2007-07-18 11:28:43 -0400 | [diff] [blame] | 1828 | |
| 1829 | out_no_client_address: |
| 1830 | dfprintk(MOUNT, "NFS4: mount program didn't pass callback address\n"); |
| 1831 | return -EINVAL; |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1832 | } |
| 1833 | |
| 1834 | /* |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1835 | * Get the superblock for an NFS4 mountpoint |
| 1836 | */ |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 1837 | static int nfs4_get_sb(struct file_system_type *fs_type, |
| 1838 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1839 | { |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1840 | struct nfs_parsed_mount_data data; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1841 | struct super_block *s; |
| 1842 | struct nfs_server *server; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1843 | struct nfs_fh mntfh; |
| 1844 | struct dentry *mntroot; |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1845 | int (*compare_super)(struct super_block *, void *) = nfs_compare_super; |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1846 | struct nfs_sb_mountdata sb_mntdata = { |
| 1847 | .mntflags = flags, |
| 1848 | }; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1849 | int error; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1850 | |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1851 | /* Validate the mount data */ |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1852 | error = nfs4_validate_mount_data(raw_data, &data, dev_name); |
Chuck Lever | f0768eb | 2007-07-01 12:13:01 -0400 | [diff] [blame] | 1853 | if (error < 0) |
| 1854 | goto out; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1855 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1856 | /* Get a volume representation */ |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1857 | server = nfs4_create_server(&data, &mntfh); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1858 | if (IS_ERR(server)) { |
| 1859 | error = PTR_ERR(server); |
Chuck Lever | 29eb981 | 2007-07-01 12:12:30 -0400 | [diff] [blame] | 1860 | goto out; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1861 | } |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1862 | sb_mntdata.server = server; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1863 | |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1864 | if (server->flags & NFS4_MOUNT_UNSHARED) |
| 1865 | compare_super = NULL; |
| 1866 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1867 | /* Get a superblock - note that we may end up sharing one that already exists */ |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1868 | s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata); |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 1869 | if (IS_ERR(s)) { |
| 1870 | error = PTR_ERR(s); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1871 | goto out_free; |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 1872 | } |
| 1873 | |
Trond Myklebust | 5dd3177 | 2006-08-24 01:03:05 -0400 | [diff] [blame] | 1874 | if (s->s_fs_info != server) { |
| 1875 | nfs_free_server(server); |
| 1876 | server = NULL; |
| 1877 | } |
| 1878 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1879 | if (!s->s_root) { |
| 1880 | /* initial superblock/root creation */ |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1881 | nfs4_fill_super(s); |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 1882 | } |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1883 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1884 | mntroot = nfs4_get_root(s, &mntfh); |
| 1885 | if (IS_ERR(mntroot)) { |
| 1886 | error = PTR_ERR(mntroot); |
| 1887 | goto error_splat_super; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1888 | } |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1889 | |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1890 | s->s_flags |= MS_ACTIVE; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1891 | mnt->mnt_sb = s; |
| 1892 | mnt->mnt_root = mntroot; |
Chuck Lever | 29eb981 | 2007-07-01 12:12:30 -0400 | [diff] [blame] | 1893 | error = 0; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1894 | |
Chuck Lever | 29eb981 | 2007-07-01 12:12:30 -0400 | [diff] [blame] | 1895 | out: |
\"Talpey, Thomas\ | 91ea40b | 2007-09-10 13:44:33 -0400 | [diff] [blame] | 1896 | kfree(data.client_address); |
| 1897 | kfree(data.nfs_server.export_path); |
| 1898 | kfree(data.nfs_server.hostname); |
Trond Myklebust | 816724e | 2006-06-24 08:41:41 -0400 | [diff] [blame] | 1899 | return error; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1900 | |
Chuck Lever | 29eb981 | 2007-07-01 12:12:30 -0400 | [diff] [blame] | 1901 | out_free: |
| 1902 | nfs_free_server(server); |
| 1903 | goto out; |
| 1904 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1905 | error_splat_super: |
| 1906 | up_write(&s->s_umount); |
| 1907 | deactivate_super(s); |
Chuck Lever | 29eb981 | 2007-07-01 12:12:30 -0400 | [diff] [blame] | 1908 | goto out; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1909 | } |
| 1910 | |
| 1911 | static void nfs4_kill_super(struct super_block *sb) |
| 1912 | { |
| 1913 | struct nfs_server *server = NFS_SB(sb); |
| 1914 | |
| 1915 | nfs_return_all_delegations(sb); |
| 1916 | kill_anon_super(sb); |
| 1917 | |
| 1918 | nfs4_renewd_prepare_shutdown(server); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1919 | nfs_free_server(server); |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1920 | } |
| 1921 | |
| 1922 | /* |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1923 | * Clone an NFS4 server record on xdev traversal (FSID-change) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1924 | */ |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1925 | static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, |
| 1926 | const char *dev_name, void *raw_data, |
| 1927 | struct vfsmount *mnt) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1928 | { |
| 1929 | struct nfs_clone_mount *data = raw_data; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1930 | struct super_block *s; |
| 1931 | struct nfs_server *server; |
| 1932 | struct dentry *mntroot; |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1933 | int (*compare_super)(struct super_block *, void *) = nfs_compare_super; |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1934 | struct nfs_sb_mountdata sb_mntdata = { |
| 1935 | .mntflags = flags, |
| 1936 | }; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1937 | int error; |
| 1938 | |
| 1939 | dprintk("--> nfs4_xdev_get_sb()\n"); |
| 1940 | |
| 1941 | /* create a new volume representation */ |
| 1942 | server = nfs_clone_server(NFS_SB(data->sb), data->fh, data->fattr); |
| 1943 | if (IS_ERR(server)) { |
| 1944 | error = PTR_ERR(server); |
| 1945 | goto out_err_noserver; |
| 1946 | } |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1947 | sb_mntdata.server = server; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1948 | |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 1949 | if (server->flags & NFS4_MOUNT_UNSHARED) |
| 1950 | compare_super = NULL; |
| 1951 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1952 | /* Get a superblock - note that we may end up sharing one that already exists */ |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 1953 | s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1954 | if (IS_ERR(s)) { |
| 1955 | error = PTR_ERR(s); |
| 1956 | goto out_err_nosb; |
| 1957 | } |
| 1958 | |
| 1959 | if (s->s_fs_info != server) { |
| 1960 | nfs_free_server(server); |
| 1961 | server = NULL; |
| 1962 | } |
| 1963 | |
| 1964 | if (!s->s_root) { |
| 1965 | /* initial superblock/root creation */ |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1966 | nfs4_clone_super(s, data->sb); |
| 1967 | } |
| 1968 | |
| 1969 | mntroot = nfs4_get_root(s, data->fh); |
| 1970 | if (IS_ERR(mntroot)) { |
| 1971 | error = PTR_ERR(mntroot); |
| 1972 | goto error_splat_super; |
| 1973 | } |
Trond Myklebust | e9cc6c2 | 2008-01-02 13:28:57 -0500 | [diff] [blame] | 1974 | if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) { |
| 1975 | dput(mntroot); |
| 1976 | error = -ESTALE; |
| 1977 | goto error_splat_super; |
| 1978 | } |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 1979 | |
| 1980 | s->s_flags |= MS_ACTIVE; |
| 1981 | mnt->mnt_sb = s; |
| 1982 | mnt->mnt_root = mntroot; |
| 1983 | |
| 1984 | dprintk("<-- nfs4_xdev_get_sb() = 0\n"); |
| 1985 | return 0; |
| 1986 | |
| 1987 | out_err_nosb: |
| 1988 | nfs_free_server(server); |
| 1989 | out_err_noserver: |
| 1990 | dprintk("<-- nfs4_xdev_get_sb() = %d [error]\n", error); |
| 1991 | return error; |
| 1992 | |
| 1993 | error_splat_super: |
| 1994 | up_write(&s->s_umount); |
| 1995 | deactivate_super(s); |
| 1996 | dprintk("<-- nfs4_xdev_get_sb() = %d [splat]\n", error); |
| 1997 | return error; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 1998 | } |
| 1999 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2000 | /* |
| 2001 | * Create an NFS4 server record on referral traversal |
| 2002 | */ |
| 2003 | static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags, |
| 2004 | const char *dev_name, void *raw_data, |
| 2005 | struct vfsmount *mnt) |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 2006 | { |
| 2007 | struct nfs_clone_mount *data = raw_data; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2008 | struct super_block *s; |
| 2009 | struct nfs_server *server; |
| 2010 | struct dentry *mntroot; |
| 2011 | struct nfs_fh mntfh; |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 2012 | int (*compare_super)(struct super_block *, void *) = nfs_compare_super; |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 2013 | struct nfs_sb_mountdata sb_mntdata = { |
| 2014 | .mntflags = flags, |
| 2015 | }; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2016 | int error; |
| 2017 | |
| 2018 | dprintk("--> nfs4_referral_get_sb()\n"); |
| 2019 | |
| 2020 | /* create a new volume representation */ |
| 2021 | server = nfs4_create_referral_server(data, &mntfh); |
| 2022 | if (IS_ERR(server)) { |
| 2023 | error = PTR_ERR(server); |
| 2024 | goto out_err_noserver; |
| 2025 | } |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 2026 | sb_mntdata.server = server; |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2027 | |
Trond Myklebust | 75180df | 2007-05-16 16:53:28 -0400 | [diff] [blame] | 2028 | if (server->flags & NFS4_MOUNT_UNSHARED) |
| 2029 | compare_super = NULL; |
| 2030 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2031 | /* Get a superblock - note that we may end up sharing one that already exists */ |
Trond Myklebust | e89a5a4 | 2007-08-31 10:45:17 -0400 | [diff] [blame] | 2032 | s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2033 | if (IS_ERR(s)) { |
| 2034 | error = PTR_ERR(s); |
| 2035 | goto out_err_nosb; |
| 2036 | } |
| 2037 | |
| 2038 | if (s->s_fs_info != server) { |
| 2039 | nfs_free_server(server); |
| 2040 | server = NULL; |
| 2041 | } |
| 2042 | |
| 2043 | if (!s->s_root) { |
| 2044 | /* initial superblock/root creation */ |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2045 | nfs4_fill_super(s); |
| 2046 | } |
| 2047 | |
Trond Myklebust | f2d0d85 | 2007-02-02 14:46:09 -0800 | [diff] [blame] | 2048 | mntroot = nfs4_get_root(s, &mntfh); |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2049 | if (IS_ERR(mntroot)) { |
| 2050 | error = PTR_ERR(mntroot); |
| 2051 | goto error_splat_super; |
| 2052 | } |
Trond Myklebust | e9cc6c2 | 2008-01-02 13:28:57 -0500 | [diff] [blame] | 2053 | if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) { |
| 2054 | dput(mntroot); |
| 2055 | error = -ESTALE; |
| 2056 | goto error_splat_super; |
| 2057 | } |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2058 | |
| 2059 | s->s_flags |= MS_ACTIVE; |
| 2060 | mnt->mnt_sb = s; |
| 2061 | mnt->mnt_root = mntroot; |
| 2062 | |
| 2063 | dprintk("<-- nfs4_referral_get_sb() = 0\n"); |
| 2064 | return 0; |
| 2065 | |
| 2066 | out_err_nosb: |
| 2067 | nfs_free_server(server); |
| 2068 | out_err_noserver: |
| 2069 | dprintk("<-- nfs4_referral_get_sb() = %d [error]\n", error); |
| 2070 | return error; |
| 2071 | |
| 2072 | error_splat_super: |
| 2073 | up_write(&s->s_umount); |
| 2074 | deactivate_super(s); |
| 2075 | dprintk("<-- nfs4_referral_get_sb() = %d [splat]\n", error); |
| 2076 | return error; |
David Howells | f7b422b | 2006-06-09 09:34:33 -0400 | [diff] [blame] | 2077 | } |
| 2078 | |
David Howells | 54ceac4 | 2006-08-22 20:06:13 -0400 | [diff] [blame] | 2079 | #endif /* CONFIG_NFS_V4 */ |