History

nfsd: clean up fh_auth usage

Use fh_fsid when reffering to the fsid part of the filehandle. The variable length auth field envisioned in nfsfh wasn't ever implemented. Also clean up some lose ends around this and document the file handle format better. Btw, why do we even export nfsfh.h to userspace? The file handle very much is kernel private, and nothing in nfs-utils include the header either.

Christoph Hellwig committed 12 years ago

Commit 5409e461 parent ecc74552 files · +16 −36Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/nfsd/nfsfh.h+7−25
@@ -1,13 +1,7 @@
11 /*
2− * include/linux/nfsd/nfsfh.h
3− *
42 * This file describes the layout of the file handles as passed
53 * over the wire.
64 *
7− * Earlier versions of knfsd used to sign file handles using keyed MD5
8− * or SHA. I've removed this code, because it doesn't give you more
9− * security than blocking external access to port 2049 on your firewall.
10− *
115 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
126 */
137
@@ -37,7 +31,7 @@ struct nfs_fhbase_old { · 23 unmodified lines
3731 };
3832
3933 /*
40− * This is the new flexible, extensible style NFSv2/v3 file handle.
34+ * This is the new flexible, extensible style NFSv2/v3/v4 file handle.
4135 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
4236 *
4337 * The file handle starts with a sequence of four-byte words.
@@ -47,14 +41,7 @@ struct nfs_fhbase_old { · 3 unmodified lines
4741 *
4842 * All four-byte values are in host-byte-order.
4943 *
50− * The auth_type field specifies how the filehandle can be authenticated
51− * This might allow a file to be confirmed to be in a writable part of a
52− * filetree without checking the path from it up to the root.
53− * Current values:
54− * 0 - No authentication. fb_auth is 0 bytes long
55− * Possible future values:
56− * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle
57− * prefixed by a secret and with the important export flags.
44+ * The auth_type field is deprecated and must be set to 0.
5845 *
5946 * The fsid_type identifies how the filesystem (or export point) is
6047 * encoded.
@@ -71,14 +58,9 @@ struct nfs_fhbase_old { · 10 unmodified lines
7158 * 7 - 8 byte inode number and 16 byte uuid
7259 *
7360 * The fileid_type identified how the file within the filesystem is encoded.
74− * This is (will be) passed to, and set by, the underlying filesystem if it supports
75− * filehandle operations. The filesystem must not use the value '0' or '0xff' and may
76− * only use the values 1 and 2 as defined below:
77− * Current values:
78− * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes.
79− * 1 - 32bit inode number, 32 bit generation number.
80− * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number.
81− *
61+ * The values for this field are filesystem specific, exccept that
62+ * filesystems must not use the values '0' or '0xff'. 'See enum fid_type'
63+ * in include/linux/exportfs.h for currently registered values.
8264 */
8365 struct nfs_fhbase_new {
8466 __u8 fb_version; /* == 1, even => nfs_fhbase_old */
@@ -114,9 +96,9 @@ struct knfsd_fh { · 29 unmodified lines
11496 #define fh_fsid_type fh_base.fh_new.fb_fsid_type
11597 #define fh_auth_type fh_base.fh_new.fb_auth_type
11698 #define fh_fileid_type fh_base.fh_new.fb_fileid_type
117−#define fh_auth fh_base.fh_new.fb_auth
11899 #define fh_fsid fh_base.fh_new.fb_auth
119100
120−
101+/* Do not use, provided for userspace compatiblity. */
102+#define fh_auth fh_base.fh_new.fb_auth
121103
122104 #endif /* _UAPI_LINUX_NFSD_FH_H */