aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-11 13:17:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-11 13:17:13 -0400
commit0ff08ba5d066619f9973bfcdb5a21320d54219d0 (patch)
tree526e4a5799eb3023e9d5d81e81c0964b1d928a3e /include/linux/sunrpc
parentc72bb316916b1a6cf35e1d5238566ef27b0b7f80 (diff)
parentd109148111cdfcdae94f797dc142468bd0ff7557 (diff)
Merge branch 'for-3.11' of git://linux-nfs.org/~bfields/linux
Pull nfsd changes from Bruce Fields: "Changes this time include: - 4.1 enabled on the server by default: the last 4.1-specific issues I know of are fixed, so we're not going to find the rest of the bugs without more exposure. - Experimental support for NFSv4.2 MAC Labeling (to allow running selinux over NFS), from Dave Quigley. - Fixes for some delicate cache/upcall races that could cause rare server hangs; thanks to Neil Brown and Bodo Stroesser for extreme debugging persistence. - Fixes for some bugs found at the recent NFS bakeathon, mostly v4 and v4.1-specific, but also a generic bug handling fragmented rpc calls" * 'for-3.11' of git://linux-nfs.org/~bfields/linux: (31 commits) nfsd4: support minorversion 1 by default nfsd4: allow destroy_session over destroyed session svcrpc: fix failures to handle -1 uid's sunrpc: Don't schedule an upcall on a replaced cache entry. net/sunrpc: xpt_auth_cache should be ignored when expired. sunrpc/cache: ensure items removed from cache do not have pending upcalls. sunrpc/cache: use cache_fresh_unlocked consistently and correctly. sunrpc/cache: remove races with queuing an upcall. nfsd4: return delegation immediately if lease fails nfsd4: do not throw away 4.1 lock state on last unlock nfsd4: delegation-based open reclaims should bypass permissions svcrpc: don't error out on small tcp fragment svcrpc: fix handling of too-short rpc's nfsd4: minor read_buf cleanup nfsd4: fix decoding of compounds across page boundaries nfsd4: clean up nfs4_open_delegation NFSD: Don't give out read delegations on creates nfsd4: allow client to send no cb_sec flavors nfsd4: fail attempts to request gss on the backchannel nfsd4: implement minimal SP4_MACH_CRED ...
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r--include/linux/sunrpc/cache.h49
-rw-r--r--include/linux/sunrpc/gss_api.h2
-rw-r--r--include/linux/sunrpc/svcauth.h11
3 files changed, 35 insertions, 27 deletions
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 303399b1ba59..6ce690de447f 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -57,6 +57,7 @@ struct cache_head {
57#define CACHE_VALID 0 /* Entry contains valid data */ 57#define CACHE_VALID 0 /* Entry contains valid data */
58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */ 58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */
59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/ 59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/
60#define CACHE_CLEANED 3 /* Entry has been cleaned from cache */
60 61
61#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ 62#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
62 63
@@ -148,6 +149,24 @@ struct cache_deferred_req {
148 int too_many); 149 int too_many);
149}; 150};
150 151
152/*
153 * timestamps kept in the cache are expressed in seconds
154 * since boot. This is the best for measuring differences in
155 * real time.
156 */
157static inline time_t seconds_since_boot(void)
158{
159 struct timespec boot;
160 getboottime(&boot);
161 return get_seconds() - boot.tv_sec;
162}
163
164static inline time_t convert_to_wallclock(time_t sinceboot)
165{
166 struct timespec boot;
167 getboottime(&boot);
168 return boot.tv_sec + sinceboot;
169}
151 170
152extern const struct file_operations cache_file_operations_pipefs; 171extern const struct file_operations cache_file_operations_pipefs;
153extern const struct file_operations content_file_operations_pipefs; 172extern const struct file_operations content_file_operations_pipefs;
@@ -181,15 +200,10 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
181 kref_put(&h->ref, cd->cache_put); 200 kref_put(&h->ref, cd->cache_put);
182} 201}
183 202
184static inline int cache_valid(struct cache_head *h) 203static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
185{ 204{
186 /* If an item has been unhashed pending removal when 205 return (h->expiry_time < seconds_since_boot()) ||
187 * the refcount drops to 0, the expiry_time will be 206 (detail->flush_time > h->last_refresh);
188 * set to 0. We don't want to consider such items
189 * valid in this context even though CACHE_VALID is
190 * set.
191 */
192 return (h->expiry_time != 0 && test_bit(CACHE_VALID, &h->flags));
193} 207}
194 208
195extern int cache_check(struct cache_detail *detail, 209extern int cache_check(struct cache_detail *detail,
@@ -250,25 +264,6 @@ static inline int get_uint(char **bpp, unsigned int *anint)
250 return 0; 264 return 0;
251} 265}
252 266
253/*
254 * timestamps kept in the cache are expressed in seconds
255 * since boot. This is the best for measuring differences in
256 * real time.
257 */
258static inline time_t seconds_since_boot(void)
259{
260 struct timespec boot;
261 getboottime(&boot);
262 return get_seconds() - boot.tv_sec;
263}
264
265static inline time_t convert_to_wallclock(time_t sinceboot)
266{
267 struct timespec boot;
268 getboottime(&boot);
269 return boot.tv_sec + sinceboot;
270}
271
272static inline time_t get_expiry(char **bpp) 267static inline time_t get_expiry(char **bpp)
273{ 268{
274 int rv; 269 int rv;
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 161463e59624..1f911ccb2a75 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -151,6 +151,8 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
151/* Fill in an array with a list of supported pseudoflavors */ 151/* Fill in an array with a list of supported pseudoflavors */
152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); 152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
153 153
154struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
155
154/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a 156/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
155 * corresponding call to gss_mech_put. */ 157 * corresponding call to gss_mech_put. */
156void gss_mech_put(struct gss_api_mech *); 158void gss_mech_put(struct gss_api_mech *);
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index ff374ab30839..8d71d6577459 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/sunrpc/msg_prot.h> 15#include <linux/sunrpc/msg_prot.h>
16#include <linux/sunrpc/cache.h> 16#include <linux/sunrpc/cache.h>
17#include <linux/sunrpc/gss_api.h>
17#include <linux/hash.h> 18#include <linux/hash.h>
18#include <linux/cred.h> 19#include <linux/cred.h>
19 20
@@ -23,13 +24,23 @@ struct svc_cred {
23 struct group_info *cr_group_info; 24 struct group_info *cr_group_info;
24 u32 cr_flavor; /* pseudoflavor */ 25 u32 cr_flavor; /* pseudoflavor */
25 char *cr_principal; /* for gss */ 26 char *cr_principal; /* for gss */
27 struct gss_api_mech *cr_gss_mech;
26}; 28};
27 29
30static inline void init_svc_cred(struct svc_cred *cred)
31{
32 cred->cr_group_info = NULL;
33 cred->cr_principal = NULL;
34 cred->cr_gss_mech = NULL;
35}
36
28static inline void free_svc_cred(struct svc_cred *cred) 37static inline void free_svc_cred(struct svc_cred *cred)
29{ 38{
30 if (cred->cr_group_info) 39 if (cred->cr_group_info)
31 put_group_info(cred->cr_group_info); 40 put_group_info(cred->cr_group_info);
32 kfree(cred->cr_principal); 41 kfree(cred->cr_principal);
42 gss_mech_put(cred->cr_gss_mech);
43 init_svc_cred(cred);
33} 44}
34 45
35struct svc_rqst; /* forward decl */ 46struct svc_rqst; /* forward decl */