diff options
| -rw-r--r-- | fs/nfsd/export.c | 14 | ||||
| -rw-r--r-- | fs/nfsd/nfs4idmap.c | 16 | ||||
| -rw-r--r-- | include/linux/sunrpc/cache.h | 13 | ||||
| -rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 7 | ||||
| -rw-r--r-- | net/sunrpc/cache.c | 26 | ||||
| -rw-r--r-- | net/sunrpc/svcauth_unix.c | 14 |
6 files changed, 72 insertions, 18 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index b92a27629fb7..d9462643155c 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
| @@ -85,6 +85,11 @@ static void expkey_request(struct cache_detail *cd, | |||
| 85 | (*bpp)[-1] = '\n'; | 85 | (*bpp)[-1] = '\n'; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | static int expkey_upcall(struct cache_detail *cd, struct cache_head *h) | ||
| 89 | { | ||
| 90 | return sunrpc_cache_pipe_upcall(cd, h, expkey_request); | ||
| 91 | } | ||
| 92 | |||
| 88 | static struct svc_expkey *svc_expkey_update(struct svc_expkey *new, struct svc_expkey *old); | 93 | static struct svc_expkey *svc_expkey_update(struct svc_expkey *new, struct svc_expkey *old); |
| 89 | static struct svc_expkey *svc_expkey_lookup(struct svc_expkey *); | 94 | static struct svc_expkey *svc_expkey_lookup(struct svc_expkey *); |
| 90 | static struct cache_detail svc_expkey_cache; | 95 | static struct cache_detail svc_expkey_cache; |
| @@ -259,7 +264,7 @@ static struct cache_detail svc_expkey_cache = { | |||
| 259 | .hash_table = expkey_table, | 264 | .hash_table = expkey_table, |
| 260 | .name = "nfsd.fh", | 265 | .name = "nfsd.fh", |
| 261 | .cache_put = expkey_put, | 266 | .cache_put = expkey_put, |
| 262 | .cache_request = expkey_request, | 267 | .cache_upcall = expkey_upcall, |
| 263 | .cache_parse = expkey_parse, | 268 | .cache_parse = expkey_parse, |
| 264 | .cache_show = expkey_show, | 269 | .cache_show = expkey_show, |
| 265 | .match = expkey_match, | 270 | .match = expkey_match, |
| @@ -355,6 +360,11 @@ static void svc_export_request(struct cache_detail *cd, | |||
| 355 | (*bpp)[-1] = '\n'; | 360 | (*bpp)[-1] = '\n'; |
| 356 | } | 361 | } |
| 357 | 362 | ||
| 363 | static int svc_export_upcall(struct cache_detail *cd, struct cache_head *h) | ||
| 364 | { | ||
| 365 | return sunrpc_cache_pipe_upcall(cd, h, svc_export_request); | ||
| 366 | } | ||
| 367 | |||
| 358 | static struct svc_export *svc_export_update(struct svc_export *new, | 368 | static struct svc_export *svc_export_update(struct svc_export *new, |
| 359 | struct svc_export *old); | 369 | struct svc_export *old); |
| 360 | static struct svc_export *svc_export_lookup(struct svc_export *); | 370 | static struct svc_export *svc_export_lookup(struct svc_export *); |
| @@ -724,7 +734,7 @@ struct cache_detail svc_export_cache = { | |||
| 724 | .hash_table = export_table, | 734 | .hash_table = export_table, |
| 725 | .name = "nfsd.export", | 735 | .name = "nfsd.export", |
| 726 | .cache_put = svc_export_put, | 736 | .cache_put = svc_export_put, |
| 727 | .cache_request = svc_export_request, | 737 | .cache_upcall = svc_export_upcall, |
| 728 | .cache_parse = svc_export_parse, | 738 | .cache_parse = svc_export_parse, |
| 729 | .cache_show = svc_export_show, | 739 | .cache_show = svc_export_show, |
| 730 | .match = svc_export_match, | 740 | .match = svc_export_match, |
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index e9012ad36ac0..cdfa86fa1471 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
| @@ -146,6 +146,12 @@ idtoname_request(struct cache_detail *cd, struct cache_head *ch, char **bpp, | |||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static int | 148 | static int |
| 149 | idtoname_upcall(struct cache_detail *cd, struct cache_head *ch) | ||
| 150 | { | ||
| 151 | return sunrpc_cache_pipe_upcall(cd, ch, idtoname_request); | ||
| 152 | } | ||
| 153 | |||
| 154 | static int | ||
| 149 | idtoname_match(struct cache_head *ca, struct cache_head *cb) | 155 | idtoname_match(struct cache_head *ca, struct cache_head *cb) |
| 150 | { | 156 | { |
| 151 | struct ent *a = container_of(ca, struct ent, h); | 157 | struct ent *a = container_of(ca, struct ent, h); |
| @@ -192,7 +198,7 @@ static struct cache_detail idtoname_cache = { | |||
| 192 | .hash_table = idtoname_table, | 198 | .hash_table = idtoname_table, |
| 193 | .name = "nfs4.idtoname", | 199 | .name = "nfs4.idtoname", |
| 194 | .cache_put = ent_put, | 200 | .cache_put = ent_put, |
| 195 | .cache_request = idtoname_request, | 201 | .cache_upcall = idtoname_upcall, |
| 196 | .cache_parse = idtoname_parse, | 202 | .cache_parse = idtoname_parse, |
| 197 | .cache_show = idtoname_show, | 203 | .cache_show = idtoname_show, |
| 198 | .warn_no_listener = warn_no_idmapd, | 204 | .warn_no_listener = warn_no_idmapd, |
| @@ -325,6 +331,12 @@ nametoid_request(struct cache_detail *cd, struct cache_head *ch, char **bpp, | |||
| 325 | } | 331 | } |
| 326 | 332 | ||
| 327 | static int | 333 | static int |
| 334 | nametoid_upcall(struct cache_detail *cd, struct cache_head *ch) | ||
| 335 | { | ||
| 336 | return sunrpc_cache_pipe_upcall(cd, ch, nametoid_request); | ||
| 337 | } | ||
| 338 | |||
| 339 | static int | ||
| 328 | nametoid_match(struct cache_head *ca, struct cache_head *cb) | 340 | nametoid_match(struct cache_head *ca, struct cache_head *cb) |
| 329 | { | 341 | { |
| 330 | struct ent *a = container_of(ca, struct ent, h); | 342 | struct ent *a = container_of(ca, struct ent, h); |
| @@ -363,7 +375,7 @@ static struct cache_detail nametoid_cache = { | |||
| 363 | .hash_table = nametoid_table, | 375 | .hash_table = nametoid_table, |
| 364 | .name = "nfs4.nametoid", | 376 | .name = "nfs4.nametoid", |
| 365 | .cache_put = ent_put, | 377 | .cache_put = ent_put, |
| 366 | .cache_request = nametoid_request, | 378 | .cache_upcall = nametoid_upcall, |
| 367 | .cache_parse = nametoid_parse, | 379 | .cache_parse = nametoid_parse, |
| 368 | .cache_show = nametoid_show, | 380 | .cache_show = nametoid_show, |
| 369 | .warn_no_listener = warn_no_idmapd, | 381 | .warn_no_listener = warn_no_idmapd, |
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index 3d1fad22185a..23ee25981a0c 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h | |||
| @@ -70,9 +70,9 @@ struct cache_detail { | |||
| 70 | char *name; | 70 | char *name; |
| 71 | void (*cache_put)(struct kref *); | 71 | void (*cache_put)(struct kref *); |
| 72 | 72 | ||
| 73 | void (*cache_request)(struct cache_detail *cd, | 73 | int (*cache_upcall)(struct cache_detail *, |
| 74 | struct cache_head *h, | 74 | struct cache_head *); |
| 75 | char **bpp, int *blen); | 75 | |
| 76 | int (*cache_parse)(struct cache_detail *, | 76 | int (*cache_parse)(struct cache_detail *, |
| 77 | char *buf, int len); | 77 | char *buf, int len); |
| 78 | 78 | ||
| @@ -135,6 +135,13 @@ extern struct cache_head * | |||
| 135 | sunrpc_cache_update(struct cache_detail *detail, | 135 | sunrpc_cache_update(struct cache_detail *detail, |
| 136 | struct cache_head *new, struct cache_head *old, int hash); | 136 | struct cache_head *new, struct cache_head *old, int hash); |
| 137 | 137 | ||
| 138 | extern int | ||
| 139 | sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h, | ||
| 140 | void (*cache_request)(struct cache_detail *, | ||
| 141 | struct cache_head *, | ||
| 142 | char **, | ||
| 143 | int *)); | ||
| 144 | |||
| 138 | 145 | ||
| 139 | extern void cache_clean_deferred(void *owner); | 146 | extern void cache_clean_deferred(void *owner); |
| 140 | 147 | ||
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 2278a50c6444..2e6a148d277c 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
| @@ -181,6 +181,11 @@ static void rsi_request(struct cache_detail *cd, | |||
| 181 | (*bpp)[-1] = '\n'; | 181 | (*bpp)[-1] = '\n'; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | static int rsi_upcall(struct cache_detail *cd, struct cache_head *h) | ||
| 185 | { | ||
| 186 | return sunrpc_cache_pipe_upcall(cd, h, rsi_request); | ||
| 187 | } | ||
| 188 | |||
| 184 | 189 | ||
| 185 | static int rsi_parse(struct cache_detail *cd, | 190 | static int rsi_parse(struct cache_detail *cd, |
| 186 | char *mesg, int mlen) | 191 | char *mesg, int mlen) |
| @@ -270,7 +275,7 @@ static struct cache_detail rsi_cache = { | |||
| 270 | .hash_table = rsi_table, | 275 | .hash_table = rsi_table, |
| 271 | .name = "auth.rpcsec.init", | 276 | .name = "auth.rpcsec.init", |
| 272 | .cache_put = rsi_put, | 277 | .cache_put = rsi_put, |
| 273 | .cache_request = rsi_request, | 278 | .cache_upcall = rsi_upcall, |
| 274 | .cache_parse = rsi_parse, | 279 | .cache_parse = rsi_parse, |
| 275 | .match = rsi_match, | 280 | .match = rsi_match, |
| 276 | .init = rsi_init, | 281 | .init = rsi_init, |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index c8e7d2d07260..e438352bed7b 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
| @@ -176,7 +176,13 @@ struct cache_head *sunrpc_cache_update(struct cache_detail *detail, | |||
| 176 | } | 176 | } |
| 177 | EXPORT_SYMBOL_GPL(sunrpc_cache_update); | 177 | EXPORT_SYMBOL_GPL(sunrpc_cache_update); |
| 178 | 178 | ||
| 179 | static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h); | 179 | static int cache_make_upcall(struct cache_detail *cd, struct cache_head *h) |
| 180 | { | ||
| 181 | if (!cd->cache_upcall) | ||
| 182 | return -EINVAL; | ||
| 183 | return cd->cache_upcall(cd, h); | ||
| 184 | } | ||
| 185 | |||
| 180 | /* | 186 | /* |
| 181 | * This is the generic cache management routine for all | 187 | * This is the generic cache management routine for all |
| 182 | * the authentication caches. | 188 | * the authentication caches. |
| @@ -322,7 +328,7 @@ static int create_cache_proc_entries(struct cache_detail *cd) | |||
| 322 | if (p == NULL) | 328 | if (p == NULL) |
| 323 | goto out_nomem; | 329 | goto out_nomem; |
| 324 | 330 | ||
| 325 | if (cd->cache_request || cd->cache_parse) { | 331 | if (cd->cache_upcall || cd->cache_parse) { |
| 326 | p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR, | 332 | p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR, |
| 327 | cd->proc_ent, &cache_file_operations, cd); | 333 | cd->proc_ent, &cache_file_operations, cd); |
| 328 | cd->channel_ent = p; | 334 | cd->channel_ent = p; |
| @@ -1080,10 +1086,16 @@ static void warn_no_listener(struct cache_detail *detail) | |||
| 1080 | } | 1086 | } |
| 1081 | 1087 | ||
| 1082 | /* | 1088 | /* |
| 1083 | * register an upcall request to user-space. | 1089 | * register an upcall request to user-space and queue it up for read() by the |
| 1090 | * upcall daemon. | ||
| 1091 | * | ||
| 1084 | * Each request is at most one page long. | 1092 | * Each request is at most one page long. |
| 1085 | */ | 1093 | */ |
| 1086 | static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h) | 1094 | int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h, |
| 1095 | void (*cache_request)(struct cache_detail *, | ||
| 1096 | struct cache_head *, | ||
| 1097 | char **, | ||
| 1098 | int *)) | ||
| 1087 | { | 1099 | { |
| 1088 | 1100 | ||
| 1089 | char *buf; | 1101 | char *buf; |
| @@ -1091,9 +1103,6 @@ static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h) | |||
| 1091 | char *bp; | 1103 | char *bp; |
| 1092 | int len; | 1104 | int len; |
| 1093 | 1105 | ||
| 1094 | if (detail->cache_request == NULL) | ||
| 1095 | return -EINVAL; | ||
| 1096 | |||
| 1097 | if (atomic_read(&detail->readers) == 0 && | 1106 | if (atomic_read(&detail->readers) == 0 && |
| 1098 | detail->last_close < get_seconds() - 30) { | 1107 | detail->last_close < get_seconds() - 30) { |
| 1099 | warn_no_listener(detail); | 1108 | warn_no_listener(detail); |
| @@ -1112,7 +1121,7 @@ static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h) | |||
| 1112 | 1121 | ||
| 1113 | bp = buf; len = PAGE_SIZE; | 1122 | bp = buf; len = PAGE_SIZE; |
| 1114 | 1123 | ||
| 1115 | detail->cache_request(detail, h, &bp, &len); | 1124 | cache_request(detail, h, &bp, &len); |
| 1116 | 1125 | ||
| 1117 | if (len < 0) { | 1126 | if (len < 0) { |
| 1118 | kfree(buf); | 1127 | kfree(buf); |
| @@ -1130,6 +1139,7 @@ static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h) | |||
| 1130 | wake_up(&queue_wait); | 1139 | wake_up(&queue_wait); |
| 1131 | return 0; | 1140 | return 0; |
| 1132 | } | 1141 | } |
| 1142 | EXPORT_SYMBOL_GPL(sunrpc_cache_pipe_upcall); | ||
| 1133 | 1143 | ||
| 1134 | /* | 1144 | /* |
| 1135 | * parse a message from user-space and pass it | 1145 | * parse a message from user-space and pass it |
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 5c865e2d299e..6caffa34ac01 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
| @@ -171,6 +171,11 @@ static void ip_map_request(struct cache_detail *cd, | |||
| 171 | (*bpp)[-1] = '\n'; | 171 | (*bpp)[-1] = '\n'; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | static int ip_map_upcall(struct cache_detail *cd, struct cache_head *h) | ||
| 175 | { | ||
| 176 | return sunrpc_cache_pipe_upcall(cd, h, ip_map_request); | ||
| 177 | } | ||
| 178 | |||
| 174 | static struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr); | 179 | static struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr); |
| 175 | static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry); | 180 | static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry); |
| 176 | 181 | ||
| @@ -289,7 +294,7 @@ struct cache_detail ip_map_cache = { | |||
| 289 | .hash_table = ip_table, | 294 | .hash_table = ip_table, |
| 290 | .name = "auth.unix.ip", | 295 | .name = "auth.unix.ip", |
| 291 | .cache_put = ip_map_put, | 296 | .cache_put = ip_map_put, |
| 292 | .cache_request = ip_map_request, | 297 | .cache_upcall = ip_map_upcall, |
| 293 | .cache_parse = ip_map_parse, | 298 | .cache_parse = ip_map_parse, |
| 294 | .cache_show = ip_map_show, | 299 | .cache_show = ip_map_show, |
| 295 | .match = ip_map_match, | 300 | .match = ip_map_match, |
| @@ -523,6 +528,11 @@ static void unix_gid_request(struct cache_detail *cd, | |||
| 523 | (*bpp)[-1] = '\n'; | 528 | (*bpp)[-1] = '\n'; |
| 524 | } | 529 | } |
| 525 | 530 | ||
| 531 | static int unix_gid_upcall(struct cache_detail *cd, struct cache_head *h) | ||
| 532 | { | ||
| 533 | return sunrpc_cache_pipe_upcall(cd, h, unix_gid_request); | ||
| 534 | } | ||
| 535 | |||
| 526 | static struct unix_gid *unix_gid_lookup(uid_t uid); | 536 | static struct unix_gid *unix_gid_lookup(uid_t uid); |
| 527 | extern struct cache_detail unix_gid_cache; | 537 | extern struct cache_detail unix_gid_cache; |
| 528 | 538 | ||
| @@ -622,7 +632,7 @@ struct cache_detail unix_gid_cache = { | |||
| 622 | .hash_table = gid_table, | 632 | .hash_table = gid_table, |
| 623 | .name = "auth.unix.gid", | 633 | .name = "auth.unix.gid", |
| 624 | .cache_put = unix_gid_put, | 634 | .cache_put = unix_gid_put, |
| 625 | .cache_request = unix_gid_request, | 635 | .cache_upcall = unix_gid_upcall, |
| 626 | .cache_parse = unix_gid_parse, | 636 | .cache_parse = unix_gid_parse, |
| 627 | .cache_show = unix_gid_show, | 637 | .cache_show = unix_gid_show, |
| 628 | .match = unix_gid_match, | 638 | .match = unix_gid_match, |
