diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-19 20:24:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-19 20:24:05 -0400 |
commit | 6a6be470c3071559970c5659354484d4f664050e (patch) | |
tree | d4b335e863e426acad96fe5e4bce2e3e064abc32 /include | |
parent | 98c89cdd3a292af3451e47a2a33132f5183861b0 (diff) | |
parent | 126e216a8730532dfb685205309275f87e3d133e (diff) |
Merge branch 'nfs-for-2.6.35' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
* 'nfs-for-2.6.35' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6: (78 commits)
SUNRPC: Don't spam gssd with upcall requests when the kerberos key expired
SUNRPC: Reorder the struct rpc_task fields
SUNRPC: Remove the 'tk_magic' debugging field
SUNRPC: Move the task->tk_bytes_sent and tk_rtt to struct rpc_rqst
NFS: Don't call iput() in nfs_access_cache_shrinker
NFS: Clean up nfs_access_zap_cache()
NFS: Don't run nfs_access_cache_shrinker() when the mask is GFP_NOFS
SUNRPC: Ensure rpcauth_prune_expired() respects the nr_to_scan parameter
SUNRPC: Ensure memory shrinker doesn't waste time in rpcauth_prune_expired()
SUNRPC: Dont run rpcauth_cache_shrinker() when gfp_mask is GFP_NOFS
NFS: Read requests can use GFP_KERNEL.
NFS: Clean up nfs_create_request()
NFS: Don't use GFP_KERNEL in rpcsec_gss downcalls
NFSv4: Don't use GFP_KERNEL allocations in state recovery
SUNRPC: Fix xs_setup_bc_tcp()
SUNRPC: Replace jiffies-based metrics with ktime-based metrics
ktime: introduce ktime_to_ms()
SUNRPC: RPC metrics and RTT estimator should use same RTT value
NFS: Calldata for nfs4_renew_done()
NFS: Squelch compiler warning in nfs_add_server_stats()
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ktime.h | 10 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 14 | ||||
-rw-r--r-- | include/linux/nfs_fs_sb.h | 1 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 7 | ||||
-rw-r--r-- | include/linux/sunrpc/auth.h | 1 | ||||
-rw-r--r-- | include/linux/sunrpc/auth_gss.h | 1 | ||||
-rw-r--r-- | include/linux/sunrpc/gss_api.h | 8 | ||||
-rw-r--r-- | include/linux/sunrpc/gss_krb5.h | 184 | ||||
-rw-r--r-- | include/linux/sunrpc/metrics.h | 7 | ||||
-rw-r--r-- | include/linux/sunrpc/sched.h | 20 | ||||
-rw-r--r-- | include/linux/sunrpc/xdr.h | 8 | ||||
-rw-r--r-- | include/linux/sunrpc/xprt.h | 13 |
12 files changed, 238 insertions, 36 deletions
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index ce5983225be4..e1ceaa9b36bb 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -130,7 +130,7 @@ static inline ktime_t timeval_to_ktime(struct timeval tv) | |||
130 | /* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ | 130 | /* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ |
131 | #define ktime_to_ns(kt) ((kt).tv64) | 131 | #define ktime_to_ns(kt) ((kt).tv64) |
132 | 132 | ||
133 | #else | 133 | #else /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */ |
134 | 134 | ||
135 | /* | 135 | /* |
136 | * Helper macros/inlines to get the ktime_t math right in the timespec | 136 | * Helper macros/inlines to get the ktime_t math right in the timespec |
@@ -275,7 +275,7 @@ static inline s64 ktime_to_ns(const ktime_t kt) | |||
275 | return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec; | 275 | return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec; |
276 | } | 276 | } |
277 | 277 | ||
278 | #endif | 278 | #endif /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */ |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * ktime_equal - Compares two ktime_t variables to see if they are equal | 281 | * ktime_equal - Compares two ktime_t variables to see if they are equal |
@@ -295,6 +295,12 @@ static inline s64 ktime_to_us(const ktime_t kt) | |||
295 | return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec; | 295 | return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec; |
296 | } | 296 | } |
297 | 297 | ||
298 | static inline s64 ktime_to_ms(const ktime_t kt) | ||
299 | { | ||
300 | struct timeval tv = ktime_to_timeval(kt); | ||
301 | return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC; | ||
302 | } | ||
303 | |||
298 | static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) | 304 | static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) |
299 | { | 305 | { |
300 | return ktime_to_us(ktime_sub(later, earlier)); | 306 | return ktime_to_us(ktime_sub(later, earlier)); |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 07ce4609fe50..77c2ae53431c 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -356,6 +356,20 @@ extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struc | |||
356 | extern u64 nfs_compat_user_ino64(u64 fileid); | 356 | extern u64 nfs_compat_user_ino64(u64 fileid); |
357 | extern void nfs_fattr_init(struct nfs_fattr *fattr); | 357 | extern void nfs_fattr_init(struct nfs_fattr *fattr); |
358 | 358 | ||
359 | extern struct nfs_fattr *nfs_alloc_fattr(void); | ||
360 | |||
361 | static inline void nfs_free_fattr(const struct nfs_fattr *fattr) | ||
362 | { | ||
363 | kfree(fattr); | ||
364 | } | ||
365 | |||
366 | extern struct nfs_fh *nfs_alloc_fhandle(void); | ||
367 | |||
368 | static inline void nfs_free_fhandle(const struct nfs_fh *fh) | ||
369 | { | ||
370 | kfree(fh); | ||
371 | } | ||
372 | |||
359 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ | 373 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ |
360 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ | 374 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ |
361 | extern unsigned long nfs_inc_attr_generation_counter(void); | 375 | extern unsigned long nfs_inc_attr_generation_counter(void); |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index e82957acea56..d6e10a4c06e5 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -44,7 +44,6 @@ struct nfs_client { | |||
44 | 44 | ||
45 | #ifdef CONFIG_NFS_V4 | 45 | #ifdef CONFIG_NFS_V4 |
46 | u64 cl_clientid; /* constant */ | 46 | u64 cl_clientid; /* constant */ |
47 | nfs4_verifier cl_confirm; | ||
48 | unsigned long cl_state; | 47 | unsigned long cl_state; |
49 | 48 | ||
50 | struct rb_root cl_openowner_id; | 49 | struct rb_root cl_openowner_id; |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 89b28812ec24..51914d7d6cc4 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -386,8 +386,8 @@ struct nfs_removeargs { | |||
386 | 386 | ||
387 | struct nfs_removeres { | 387 | struct nfs_removeres { |
388 | const struct nfs_server *server; | 388 | const struct nfs_server *server; |
389 | struct nfs_fattr *dir_attr; | ||
389 | struct nfs4_change_info cinfo; | 390 | struct nfs4_change_info cinfo; |
390 | struct nfs_fattr dir_attr; | ||
391 | struct nfs4_sequence_res seq_res; | 391 | struct nfs4_sequence_res seq_res; |
392 | }; | 392 | }; |
393 | 393 | ||
@@ -824,6 +824,11 @@ struct nfs4_setclientid { | |||
824 | u32 sc_cb_ident; | 824 | u32 sc_cb_ident; |
825 | }; | 825 | }; |
826 | 826 | ||
827 | struct nfs4_setclientid_res { | ||
828 | u64 clientid; | ||
829 | nfs4_verifier confirm; | ||
830 | }; | ||
831 | |||
827 | struct nfs4_statfs_arg { | 832 | struct nfs4_statfs_arg { |
828 | const struct nfs_fh * fh; | 833 | const struct nfs_fh * fh; |
829 | const u32 * bitmask; | 834 | const u32 * bitmask; |
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 996df4dac7d4..87d7ec0bf779 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -54,6 +54,7 @@ struct rpc_cred { | |||
54 | #define RPCAUTH_CRED_NEW 0 | 54 | #define RPCAUTH_CRED_NEW 0 |
55 | #define RPCAUTH_CRED_UPTODATE 1 | 55 | #define RPCAUTH_CRED_UPTODATE 1 |
56 | #define RPCAUTH_CRED_HASHED 2 | 56 | #define RPCAUTH_CRED_HASHED 2 |
57 | #define RPCAUTH_CRED_NEGATIVE 3 | ||
57 | 58 | ||
58 | #define RPCAUTH_CRED_MAGIC 0x0f4aa4f0 | 59 | #define RPCAUTH_CRED_MAGIC 0x0f4aa4f0 |
59 | 60 | ||
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h index d48d4e605f74..671538d25bc1 100644 --- a/include/linux/sunrpc/auth_gss.h +++ b/include/linux/sunrpc/auth_gss.h | |||
@@ -82,6 +82,7 @@ struct gss_cred { | |||
82 | enum rpc_gss_svc gc_service; | 82 | enum rpc_gss_svc gc_service; |
83 | struct gss_cl_ctx *gc_ctx; | 83 | struct gss_cl_ctx *gc_ctx; |
84 | struct gss_upcall_msg *gc_upcall; | 84 | struct gss_upcall_msg *gc_upcall; |
85 | unsigned long gc_upcall_timestamp; | ||
85 | unsigned char gc_machine_cred : 1; | 86 | unsigned char gc_machine_cred : 1; |
86 | }; | 87 | }; |
87 | 88 | ||
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h index 03f33330ece2..5d8048beb051 100644 --- a/include/linux/sunrpc/gss_api.h +++ b/include/linux/sunrpc/gss_api.h | |||
@@ -35,7 +35,8 @@ int gss_import_sec_context( | |||
35 | const void* input_token, | 35 | const void* input_token, |
36 | size_t bufsize, | 36 | size_t bufsize, |
37 | struct gss_api_mech *mech, | 37 | struct gss_api_mech *mech, |
38 | struct gss_ctx **ctx_id); | 38 | struct gss_ctx **ctx_id, |
39 | gfp_t gfp_mask); | ||
39 | u32 gss_get_mic( | 40 | u32 gss_get_mic( |
40 | struct gss_ctx *ctx_id, | 41 | struct gss_ctx *ctx_id, |
41 | struct xdr_buf *message, | 42 | struct xdr_buf *message, |
@@ -80,6 +81,8 @@ struct gss_api_mech { | |||
80 | /* pseudoflavors supported by this mechanism: */ | 81 | /* pseudoflavors supported by this mechanism: */ |
81 | int gm_pf_num; | 82 | int gm_pf_num; |
82 | struct pf_desc * gm_pfs; | 83 | struct pf_desc * gm_pfs; |
84 | /* Should the following be a callback operation instead? */ | ||
85 | const char *gm_upcall_enctypes; | ||
83 | }; | 86 | }; |
84 | 87 | ||
85 | /* and must provide the following operations: */ | 88 | /* and must provide the following operations: */ |
@@ -87,7 +90,8 @@ struct gss_api_ops { | |||
87 | int (*gss_import_sec_context)( | 90 | int (*gss_import_sec_context)( |
88 | const void *input_token, | 91 | const void *input_token, |
89 | size_t bufsize, | 92 | size_t bufsize, |
90 | struct gss_ctx *ctx_id); | 93 | struct gss_ctx *ctx_id, |
94 | gfp_t gfp_mask); | ||
91 | u32 (*gss_get_mic)( | 95 | u32 (*gss_get_mic)( |
92 | struct gss_ctx *ctx_id, | 96 | struct gss_ctx *ctx_id, |
93 | struct xdr_buf *message, | 97 | struct xdr_buf *message, |
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h index e7bbdba474d5..5af2931cf58d 100644 --- a/include/linux/sunrpc/gss_krb5.h +++ b/include/linux/sunrpc/gss_krb5.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h, | 4 | * Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h, |
5 | * lib/gssapi/krb5/gssapiP_krb5.h, and others | 5 | * lib/gssapi/krb5/gssapiP_krb5.h, and others |
6 | * | 6 | * |
7 | * Copyright (c) 2000 The Regents of the University of Michigan. | 7 | * Copyright (c) 2000-2008 The Regents of the University of Michigan. |
8 | * All rights reserved. | 8 | * All rights reserved. |
9 | * | 9 | * |
10 | * Andy Adamson <andros@umich.edu> | 10 | * Andy Adamson <andros@umich.edu> |
@@ -36,17 +36,86 @@ | |||
36 | * | 36 | * |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include <linux/crypto.h> | ||
39 | #include <linux/sunrpc/auth_gss.h> | 40 | #include <linux/sunrpc/auth_gss.h> |
40 | #include <linux/sunrpc/gss_err.h> | 41 | #include <linux/sunrpc/gss_err.h> |
41 | #include <linux/sunrpc/gss_asn1.h> | 42 | #include <linux/sunrpc/gss_asn1.h> |
42 | 43 | ||
44 | /* Length of constant used in key derivation */ | ||
45 | #define GSS_KRB5_K5CLENGTH (5) | ||
46 | |||
47 | /* Maximum key length (in bytes) for the supported crypto algorithms*/ | ||
48 | #define GSS_KRB5_MAX_KEYLEN (32) | ||
49 | |||
50 | /* Maximum checksum function output for the supported crypto algorithms */ | ||
51 | #define GSS_KRB5_MAX_CKSUM_LEN (20) | ||
52 | |||
53 | /* Maximum blocksize for the supported crypto algorithms */ | ||
54 | #define GSS_KRB5_MAX_BLOCKSIZE (16) | ||
55 | |||
56 | struct krb5_ctx; | ||
57 | |||
58 | struct gss_krb5_enctype { | ||
59 | const u32 etype; /* encryption (key) type */ | ||
60 | const u32 ctype; /* checksum type */ | ||
61 | const char *name; /* "friendly" name */ | ||
62 | const char *encrypt_name; /* crypto encrypt name */ | ||
63 | const char *cksum_name; /* crypto checksum name */ | ||
64 | const u16 signalg; /* signing algorithm */ | ||
65 | const u16 sealalg; /* sealing algorithm */ | ||
66 | const u32 blocksize; /* encryption blocksize */ | ||
67 | const u32 conflen; /* confounder length | ||
68 | (normally the same as | ||
69 | the blocksize) */ | ||
70 | const u32 cksumlength; /* checksum length */ | ||
71 | const u32 keyed_cksum; /* is it a keyed cksum? */ | ||
72 | const u32 keybytes; /* raw key len, in bytes */ | ||
73 | const u32 keylength; /* final key len, in bytes */ | ||
74 | u32 (*encrypt) (struct crypto_blkcipher *tfm, | ||
75 | void *iv, void *in, void *out, | ||
76 | int length); /* encryption function */ | ||
77 | u32 (*decrypt) (struct crypto_blkcipher *tfm, | ||
78 | void *iv, void *in, void *out, | ||
79 | int length); /* decryption function */ | ||
80 | u32 (*mk_key) (const struct gss_krb5_enctype *gk5e, | ||
81 | struct xdr_netobj *in, | ||
82 | struct xdr_netobj *out); /* complete key generation */ | ||
83 | u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset, | ||
84 | struct xdr_buf *buf, int ec, | ||
85 | struct page **pages); /* v2 encryption function */ | ||
86 | u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset, | ||
87 | struct xdr_buf *buf, u32 *headskip, | ||
88 | u32 *tailskip); /* v2 decryption function */ | ||
89 | }; | ||
90 | |||
91 | /* krb5_ctx flags definitions */ | ||
92 | #define KRB5_CTX_FLAG_INITIATOR 0x00000001 | ||
93 | #define KRB5_CTX_FLAG_CFX 0x00000002 | ||
94 | #define KRB5_CTX_FLAG_ACCEPTOR_SUBKEY 0x00000004 | ||
95 | |||
43 | struct krb5_ctx { | 96 | struct krb5_ctx { |
44 | int initiate; /* 1 = initiating, 0 = accepting */ | 97 | int initiate; /* 1 = initiating, 0 = accepting */ |
98 | u32 enctype; | ||
99 | u32 flags; | ||
100 | const struct gss_krb5_enctype *gk5e; /* enctype-specific info */ | ||
45 | struct crypto_blkcipher *enc; | 101 | struct crypto_blkcipher *enc; |
46 | struct crypto_blkcipher *seq; | 102 | struct crypto_blkcipher *seq; |
103 | struct crypto_blkcipher *acceptor_enc; | ||
104 | struct crypto_blkcipher *initiator_enc; | ||
105 | struct crypto_blkcipher *acceptor_enc_aux; | ||
106 | struct crypto_blkcipher *initiator_enc_aux; | ||
107 | u8 Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */ | ||
108 | u8 cksum[GSS_KRB5_MAX_KEYLEN]; | ||
47 | s32 endtime; | 109 | s32 endtime; |
48 | u32 seq_send; | 110 | u32 seq_send; |
111 | u64 seq_send64; | ||
49 | struct xdr_netobj mech_used; | 112 | struct xdr_netobj mech_used; |
113 | u8 initiator_sign[GSS_KRB5_MAX_KEYLEN]; | ||
114 | u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN]; | ||
115 | u8 initiator_seal[GSS_KRB5_MAX_KEYLEN]; | ||
116 | u8 acceptor_seal[GSS_KRB5_MAX_KEYLEN]; | ||
117 | u8 initiator_integ[GSS_KRB5_MAX_KEYLEN]; | ||
118 | u8 acceptor_integ[GSS_KRB5_MAX_KEYLEN]; | ||
50 | }; | 119 | }; |
51 | 120 | ||
52 | extern spinlock_t krb5_seq_lock; | 121 | extern spinlock_t krb5_seq_lock; |
@@ -57,6 +126,18 @@ extern spinlock_t krb5_seq_lock; | |||
57 | #define KG_TOK_MIC_MSG 0x0101 | 126 | #define KG_TOK_MIC_MSG 0x0101 |
58 | #define KG_TOK_WRAP_MSG 0x0201 | 127 | #define KG_TOK_WRAP_MSG 0x0201 |
59 | 128 | ||
129 | #define KG2_TOK_INITIAL 0x0101 | ||
130 | #define KG2_TOK_RESPONSE 0x0202 | ||
131 | #define KG2_TOK_MIC 0x0404 | ||
132 | #define KG2_TOK_WRAP 0x0504 | ||
133 | |||
134 | #define KG2_TOKEN_FLAG_SENTBYACCEPTOR 0x01 | ||
135 | #define KG2_TOKEN_FLAG_SEALED 0x02 | ||
136 | #define KG2_TOKEN_FLAG_ACCEPTORSUBKEY 0x04 | ||
137 | |||
138 | #define KG2_RESP_FLAG_ERROR 0x0001 | ||
139 | #define KG2_RESP_FLAG_DELEG_OK 0x0002 | ||
140 | |||
60 | enum sgn_alg { | 141 | enum sgn_alg { |
61 | SGN_ALG_DES_MAC_MD5 = 0x0000, | 142 | SGN_ALG_DES_MAC_MD5 = 0x0000, |
62 | SGN_ALG_MD2_5 = 0x0001, | 143 | SGN_ALG_MD2_5 = 0x0001, |
@@ -81,6 +162,9 @@ enum seal_alg { | |||
81 | #define CKSUMTYPE_RSA_MD5_DES 0x0008 | 162 | #define CKSUMTYPE_RSA_MD5_DES 0x0008 |
82 | #define CKSUMTYPE_NIST_SHA 0x0009 | 163 | #define CKSUMTYPE_NIST_SHA 0x0009 |
83 | #define CKSUMTYPE_HMAC_SHA1_DES3 0x000c | 164 | #define CKSUMTYPE_HMAC_SHA1_DES3 0x000c |
165 | #define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f | ||
166 | #define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010 | ||
167 | #define CKSUMTYPE_HMAC_MD5_ARCFOUR -138 /* Microsoft md5 hmac cksumtype */ | ||
84 | 168 | ||
85 | /* from gssapi_err_krb5.h */ | 169 | /* from gssapi_err_krb5.h */ |
86 | #define KG_CCACHE_NOMATCH (39756032L) | 170 | #define KG_CCACHE_NOMATCH (39756032L) |
@@ -111,11 +195,56 @@ enum seal_alg { | |||
111 | #define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */ | 195 | #define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */ |
112 | #define ENCTYPE_DES_HMAC_SHA1 0x0008 | 196 | #define ENCTYPE_DES_HMAC_SHA1 0x0008 |
113 | #define ENCTYPE_DES3_CBC_SHA1 0x0010 | 197 | #define ENCTYPE_DES3_CBC_SHA1 0x0010 |
198 | #define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011 | ||
199 | #define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012 | ||
200 | #define ENCTYPE_ARCFOUR_HMAC 0x0017 | ||
201 | #define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018 | ||
114 | #define ENCTYPE_UNKNOWN 0x01ff | 202 | #define ENCTYPE_UNKNOWN 0x01ff |
115 | 203 | ||
116 | s32 | 204 | /* |
117 | make_checksum(char *, char *header, int hdrlen, struct xdr_buf *body, | 205 | * Constants used for key derivation |
118 | int body_offset, struct xdr_netobj *cksum); | 206 | */ |
207 | /* for 3DES */ | ||
208 | #define KG_USAGE_SEAL (22) | ||
209 | #define KG_USAGE_SIGN (23) | ||
210 | #define KG_USAGE_SEQ (24) | ||
211 | |||
212 | /* from rfc3961 */ | ||
213 | #define KEY_USAGE_SEED_CHECKSUM (0x99) | ||
214 | #define KEY_USAGE_SEED_ENCRYPTION (0xAA) | ||
215 | #define KEY_USAGE_SEED_INTEGRITY (0x55) | ||
216 | |||
217 | /* from rfc4121 */ | ||
218 | #define KG_USAGE_ACCEPTOR_SEAL (22) | ||
219 | #define KG_USAGE_ACCEPTOR_SIGN (23) | ||
220 | #define KG_USAGE_INITIATOR_SEAL (24) | ||
221 | #define KG_USAGE_INITIATOR_SIGN (25) | ||
222 | |||
223 | /* | ||
224 | * This compile-time check verifies that we will not exceed the | ||
225 | * slack space allotted by the client and server auth_gss code | ||
226 | * before they call gss_wrap(). | ||
227 | */ | ||
228 | #define GSS_KRB5_MAX_SLACK_NEEDED \ | ||
229 | (GSS_KRB5_TOK_HDR_LEN /* gss token header */ \ | ||
230 | + GSS_KRB5_MAX_CKSUM_LEN /* gss token checksum */ \ | ||
231 | + GSS_KRB5_MAX_BLOCKSIZE /* confounder */ \ | ||
232 | + GSS_KRB5_MAX_BLOCKSIZE /* possible padding */ \ | ||
233 | + GSS_KRB5_TOK_HDR_LEN /* encrypted hdr in v2 token */\ | ||
234 | + GSS_KRB5_MAX_CKSUM_LEN /* encryption hmac */ \ | ||
235 | + 4 + 4 /* RPC verifier */ \ | ||
236 | + GSS_KRB5_TOK_HDR_LEN \ | ||
237 | + GSS_KRB5_MAX_CKSUM_LEN) | ||
238 | |||
239 | u32 | ||
240 | make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen, | ||
241 | struct xdr_buf *body, int body_offset, u8 *cksumkey, | ||
242 | unsigned int usage, struct xdr_netobj *cksumout); | ||
243 | |||
244 | u32 | ||
245 | make_checksum_v2(struct krb5_ctx *, char *header, int hdrlen, | ||
246 | struct xdr_buf *body, int body_offset, u8 *key, | ||
247 | unsigned int usage, struct xdr_netobj *cksum); | ||
119 | 248 | ||
120 | u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *, | 249 | u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *, |
121 | struct xdr_netobj *); | 250 | struct xdr_netobj *); |
@@ -149,11 +278,54 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf, | |||
149 | int offset); | 278 | int offset); |
150 | 279 | ||
151 | s32 | 280 | s32 |
152 | krb5_make_seq_num(struct crypto_blkcipher *key, | 281 | krb5_make_seq_num(struct krb5_ctx *kctx, |
282 | struct crypto_blkcipher *key, | ||
153 | int direction, | 283 | int direction, |
154 | u32 seqnum, unsigned char *cksum, unsigned char *buf); | 284 | u32 seqnum, unsigned char *cksum, unsigned char *buf); |
155 | 285 | ||
156 | s32 | 286 | s32 |
157 | krb5_get_seq_num(struct crypto_blkcipher *key, | 287 | krb5_get_seq_num(struct krb5_ctx *kctx, |
158 | unsigned char *cksum, | 288 | unsigned char *cksum, |
159 | unsigned char *buf, int *direction, u32 *seqnum); | 289 | unsigned char *buf, int *direction, u32 *seqnum); |
290 | |||
291 | int | ||
292 | xdr_extend_head(struct xdr_buf *buf, unsigned int base, unsigned int shiftlen); | ||
293 | |||
294 | u32 | ||
295 | krb5_derive_key(const struct gss_krb5_enctype *gk5e, | ||
296 | const struct xdr_netobj *inkey, | ||
297 | struct xdr_netobj *outkey, | ||
298 | const struct xdr_netobj *in_constant, | ||
299 | gfp_t gfp_mask); | ||
300 | |||
301 | u32 | ||
302 | gss_krb5_des3_make_key(const struct gss_krb5_enctype *gk5e, | ||
303 | struct xdr_netobj *randombits, | ||
304 | struct xdr_netobj *key); | ||
305 | |||
306 | u32 | ||
307 | gss_krb5_aes_make_key(const struct gss_krb5_enctype *gk5e, | ||
308 | struct xdr_netobj *randombits, | ||
309 | struct xdr_netobj *key); | ||
310 | |||
311 | u32 | ||
312 | gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset, | ||
313 | struct xdr_buf *buf, int ec, | ||
314 | struct page **pages); | ||
315 | |||
316 | u32 | ||
317 | gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, | ||
318 | struct xdr_buf *buf, u32 *plainoffset, | ||
319 | u32 *plainlen); | ||
320 | |||
321 | int | ||
322 | krb5_rc4_setup_seq_key(struct krb5_ctx *kctx, | ||
323 | struct crypto_blkcipher *cipher, | ||
324 | unsigned char *cksum); | ||
325 | |||
326 | int | ||
327 | krb5_rc4_setup_enc_key(struct krb5_ctx *kctx, | ||
328 | struct crypto_blkcipher *cipher, | ||
329 | s32 seqnum); | ||
330 | void | ||
331 | gss_krb5_make_confounder(char *p, u32 conflen); | ||
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h index 77f78e56c481..b6edbc0ea83d 100644 --- a/include/linux/sunrpc/metrics.h +++ b/include/linux/sunrpc/metrics.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #define _LINUX_SUNRPC_METRICS_H | 26 | #define _LINUX_SUNRPC_METRICS_H |
27 | 27 | ||
28 | #include <linux/seq_file.h> | 28 | #include <linux/seq_file.h> |
29 | #include <linux/ktime.h> | ||
29 | 30 | ||
30 | #define RPC_IOSTATS_VERS "1.0" | 31 | #define RPC_IOSTATS_VERS "1.0" |
31 | 32 | ||
@@ -58,9 +59,9 @@ struct rpc_iostats { | |||
58 | * and the total time the request spent from init to release | 59 | * and the total time the request spent from init to release |
59 | * are measured. | 60 | * are measured. |
60 | */ | 61 | */ |
61 | unsigned long long om_queue, /* jiffies queued for xmit */ | 62 | ktime_t om_queue, /* queued for xmit */ |
62 | om_rtt, /* jiffies for RPC RTT */ | 63 | om_rtt, /* RPC RTT */ |
63 | om_execute; /* jiffies for RPC execution */ | 64 | om_execute; /* RPC execution */ |
64 | } ____cacheline_aligned; | 65 | } ____cacheline_aligned; |
65 | 66 | ||
66 | struct rpc_task; | 67 | struct rpc_task; |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 7bc7fd5291ce..7be4f3a6d246 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define _LINUX_SUNRPC_SCHED_H_ | 10 | #define _LINUX_SUNRPC_SCHED_H_ |
11 | 11 | ||
12 | #include <linux/timer.h> | 12 | #include <linux/timer.h> |
13 | #include <linux/ktime.h> | ||
13 | #include <linux/sunrpc/types.h> | 14 | #include <linux/sunrpc/types.h> |
14 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
15 | #include <linux/wait.h> | 16 | #include <linux/wait.h> |
@@ -40,21 +41,15 @@ struct rpc_wait { | |||
40 | * This is the RPC task struct | 41 | * This is the RPC task struct |
41 | */ | 42 | */ |
42 | struct rpc_task { | 43 | struct rpc_task { |
43 | #ifdef RPC_DEBUG | ||
44 | unsigned long tk_magic; /* 0xf00baa */ | ||
45 | #endif | ||
46 | atomic_t tk_count; /* Reference count */ | 44 | atomic_t tk_count; /* Reference count */ |
47 | struct list_head tk_task; /* global list of tasks */ | 45 | struct list_head tk_task; /* global list of tasks */ |
48 | struct rpc_clnt * tk_client; /* RPC client */ | 46 | struct rpc_clnt * tk_client; /* RPC client */ |
49 | struct rpc_rqst * tk_rqstp; /* RPC request */ | 47 | struct rpc_rqst * tk_rqstp; /* RPC request */ |
50 | int tk_status; /* result of last operation */ | ||
51 | 48 | ||
52 | /* | 49 | /* |
53 | * RPC call state | 50 | * RPC call state |
54 | */ | 51 | */ |
55 | struct rpc_message tk_msg; /* RPC call info */ | 52 | struct rpc_message tk_msg; /* RPC call info */ |
56 | __u8 tk_garb_retry; | ||
57 | __u8 tk_cred_retry; | ||
58 | 53 | ||
59 | /* | 54 | /* |
60 | * callback to be executed after waking up | 55 | * callback to be executed after waking up |
@@ -67,7 +62,6 @@ struct rpc_task { | |||
67 | void * tk_calldata; | 62 | void * tk_calldata; |
68 | 63 | ||
69 | unsigned long tk_timeout; /* timeout for rpc_sleep() */ | 64 | unsigned long tk_timeout; /* timeout for rpc_sleep() */ |
70 | unsigned short tk_flags; /* misc flags */ | ||
71 | unsigned long tk_runstate; /* Task run status */ | 65 | unsigned long tk_runstate; /* Task run status */ |
72 | struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could | 66 | struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could |
73 | * be any workqueue | 67 | * be any workqueue |
@@ -78,17 +72,19 @@ struct rpc_task { | |||
78 | struct rpc_wait tk_wait; /* RPC wait */ | 72 | struct rpc_wait tk_wait; /* RPC wait */ |
79 | } u; | 73 | } u; |
80 | 74 | ||
81 | unsigned short tk_timeouts; /* maj timeouts */ | 75 | ktime_t tk_start; /* RPC task init timestamp */ |
82 | size_t tk_bytes_sent; /* total bytes sent */ | ||
83 | unsigned long tk_start; /* RPC task init timestamp */ | ||
84 | long tk_rtt; /* round-trip time (jiffies) */ | ||
85 | 76 | ||
86 | pid_t tk_owner; /* Process id for batching tasks */ | 77 | pid_t tk_owner; /* Process id for batching tasks */ |
87 | unsigned char tk_priority : 2;/* Task priority */ | 78 | int tk_status; /* result of last operation */ |
79 | unsigned short tk_flags; /* misc flags */ | ||
80 | unsigned short tk_timeouts; /* maj timeouts */ | ||
88 | 81 | ||
89 | #ifdef RPC_DEBUG | 82 | #ifdef RPC_DEBUG |
90 | unsigned short tk_pid; /* debugging aid */ | 83 | unsigned short tk_pid; /* debugging aid */ |
91 | #endif | 84 | #endif |
85 | unsigned char tk_priority : 2,/* Task priority */ | ||
86 | tk_garb_retry : 2, | ||
87 | tk_cred_retry : 2; | ||
92 | }; | 88 | }; |
93 | #define tk_xprt tk_client->cl_xprt | 89 | #define tk_xprt tk_client->cl_xprt |
94 | 90 | ||
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index f5cc0898bc53..35cf2e8cd7c6 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -1,7 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * include/linux/sunrpc/xdr.h | 2 | * XDR standard data types and function declarations |
3 | * | 3 | * |
4 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> | 4 | * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> |
5 | * | ||
6 | * Based on: | ||
7 | * RFC 4506 "XDR: External Data Representation Standard", May 2006 | ||
5 | */ | 8 | */ |
6 | 9 | ||
7 | #ifndef _SUNRPC_XDR_H_ | 10 | #ifndef _SUNRPC_XDR_H_ |
@@ -62,7 +65,6 @@ struct xdr_buf { | |||
62 | 65 | ||
63 | unsigned int buflen, /* Total length of storage buffer */ | 66 | unsigned int buflen, /* Total length of storage buffer */ |
64 | len; /* Length of XDR encoded message */ | 67 | len; /* Length of XDR encoded message */ |
65 | |||
66 | }; | 68 | }; |
67 | 69 | ||
68 | /* | 70 | /* |
@@ -178,7 +180,7 @@ struct xdr_array2_desc { | |||
178 | }; | 180 | }; |
179 | 181 | ||
180 | extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base, | 182 | extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base, |
181 | struct xdr_array2_desc *desc); | 183 | struct xdr_array2_desc *desc); |
182 | extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, | 184 | extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, |
183 | struct xdr_array2_desc *desc); | 185 | struct xdr_array2_desc *desc); |
184 | 186 | ||
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 6f9457a75b8f..b51470302399 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/socket.h> | 13 | #include <linux/socket.h> |
14 | #include <linux/in.h> | 14 | #include <linux/in.h> |
15 | #include <linux/kref.h> | 15 | #include <linux/kref.h> |
16 | #include <linux/ktime.h> | ||
16 | #include <linux/sunrpc/sched.h> | 17 | #include <linux/sunrpc/sched.h> |
17 | #include <linux/sunrpc/xdr.h> | 18 | #include <linux/sunrpc/xdr.h> |
18 | #include <linux/sunrpc/msg_prot.h> | 19 | #include <linux/sunrpc/msg_prot.h> |
@@ -65,8 +66,6 @@ struct rpc_rqst { | |||
65 | struct rpc_task * rq_task; /* RPC task data */ | 66 | struct rpc_task * rq_task; /* RPC task data */ |
66 | __be32 rq_xid; /* request XID */ | 67 | __be32 rq_xid; /* request XID */ |
67 | int rq_cong; /* has incremented xprt->cong */ | 68 | int rq_cong; /* has incremented xprt->cong */ |
68 | int rq_reply_bytes_recvd; /* number of reply */ | ||
69 | /* bytes received */ | ||
70 | u32 rq_seqno; /* gss seq no. used on req. */ | 69 | u32 rq_seqno; /* gss seq no. used on req. */ |
71 | int rq_enc_pages_num; | 70 | int rq_enc_pages_num; |
72 | struct page **rq_enc_pages; /* scratch pages for use by | 71 | struct page **rq_enc_pages; /* scratch pages for use by |
@@ -77,12 +76,16 @@ struct rpc_rqst { | |||
77 | __u32 * rq_buffer; /* XDR encode buffer */ | 76 | __u32 * rq_buffer; /* XDR encode buffer */ |
78 | size_t rq_callsize, | 77 | size_t rq_callsize, |
79 | rq_rcvsize; | 78 | rq_rcvsize; |
79 | size_t rq_xmit_bytes_sent; /* total bytes sent */ | ||
80 | size_t rq_reply_bytes_recvd; /* total reply bytes */ | ||
81 | /* received */ | ||
80 | 82 | ||
81 | struct xdr_buf rq_private_buf; /* The receive buffer | 83 | struct xdr_buf rq_private_buf; /* The receive buffer |
82 | * used in the softirq. | 84 | * used in the softirq. |
83 | */ | 85 | */ |
84 | unsigned long rq_majortimeo; /* major timeout alarm */ | 86 | unsigned long rq_majortimeo; /* major timeout alarm */ |
85 | unsigned long rq_timeout; /* Current timeout value */ | 87 | unsigned long rq_timeout; /* Current timeout value */ |
88 | ktime_t rq_rtt; /* round-trip time */ | ||
86 | unsigned int rq_retries; /* # of retries */ | 89 | unsigned int rq_retries; /* # of retries */ |
87 | unsigned int rq_connect_cookie; | 90 | unsigned int rq_connect_cookie; |
88 | /* A cookie used to track the | 91 | /* A cookie used to track the |
@@ -94,7 +97,7 @@ struct rpc_rqst { | |||
94 | */ | 97 | */ |
95 | u32 rq_bytes_sent; /* Bytes we have sent */ | 98 | u32 rq_bytes_sent; /* Bytes we have sent */ |
96 | 99 | ||
97 | unsigned long rq_xtime; /* when transmitted */ | 100 | ktime_t rq_xtime; /* transmit time stamp */ |
98 | int rq_ntrans; | 101 | int rq_ntrans; |
99 | 102 | ||
100 | #if defined(CONFIG_NFS_V4_1) | 103 | #if defined(CONFIG_NFS_V4_1) |
@@ -174,8 +177,7 @@ struct rpc_xprt { | |||
174 | /* | 177 | /* |
175 | * Connection of transports | 178 | * Connection of transports |
176 | */ | 179 | */ |
177 | unsigned long connect_timeout, | 180 | unsigned long bind_timeout, |
178 | bind_timeout, | ||
179 | reestablish_timeout; | 181 | reestablish_timeout; |
180 | unsigned int connect_cookie; /* A cookie that gets bumped | 182 | unsigned int connect_cookie; /* A cookie that gets bumped |
181 | every time the transport | 183 | every time the transport |
@@ -294,7 +296,6 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task); | |||
294 | void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); | 296 | void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); |
295 | void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); | 297 | void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); |
296 | void xprt_write_space(struct rpc_xprt *xprt); | 298 | void xprt_write_space(struct rpc_xprt *xprt); |
297 | void xprt_update_rtt(struct rpc_task *task); | ||
298 | void xprt_adjust_cwnd(struct rpc_task *task, int result); | 299 | void xprt_adjust_cwnd(struct rpc_task *task, int result); |
299 | struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); | 300 | struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); |
300 | void xprt_complete_rqst(struct rpc_task *task, int copied); | 301 | void xprt_complete_rqst(struct rpc_task *task, int copied); |