diff options
Diffstat (limited to 'net/sunrpc/svcauth_unix.c')
| -rw-r--r-- | net/sunrpc/svcauth_unix.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 9bae4090254c..2bd23ea2aa8b 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
| @@ -383,7 +383,10 @@ void svcauth_unix_purge(void) | |||
| 383 | static inline struct ip_map * | 383 | static inline struct ip_map * |
| 384 | ip_map_cached_get(struct svc_rqst *rqstp) | 384 | ip_map_cached_get(struct svc_rqst *rqstp) |
| 385 | { | 385 | { |
| 386 | struct ip_map *ipm = rqstp->rq_sock->sk_info_authunix; | 386 | struct ip_map *ipm; |
| 387 | struct svc_sock *svsk = rqstp->rq_sock; | ||
| 388 | spin_lock_bh(&svsk->sk_defer_lock); | ||
| 389 | ipm = svsk->sk_info_authunix; | ||
| 387 | if (ipm != NULL) { | 390 | if (ipm != NULL) { |
| 388 | if (!cache_valid(&ipm->h)) { | 391 | if (!cache_valid(&ipm->h)) { |
| 389 | /* | 392 | /* |
| @@ -391,12 +394,14 @@ ip_map_cached_get(struct svc_rqst *rqstp) | |||
| 391 | * remembered, e.g. by a second mount from the | 394 | * remembered, e.g. by a second mount from the |
| 392 | * same IP address. | 395 | * same IP address. |
| 393 | */ | 396 | */ |
| 394 | rqstp->rq_sock->sk_info_authunix = NULL; | 397 | svsk->sk_info_authunix = NULL; |
| 398 | spin_unlock_bh(&svsk->sk_defer_lock); | ||
| 395 | cache_put(&ipm->h, &ip_map_cache); | 399 | cache_put(&ipm->h, &ip_map_cache); |
| 396 | return NULL; | 400 | return NULL; |
| 397 | } | 401 | } |
| 398 | cache_get(&ipm->h); | 402 | cache_get(&ipm->h); |
| 399 | } | 403 | } |
| 404 | spin_unlock_bh(&svsk->sk_defer_lock); | ||
| 400 | return ipm; | 405 | return ipm; |
| 401 | } | 406 | } |
| 402 | 407 | ||
| @@ -405,9 +410,15 @@ ip_map_cached_put(struct svc_rqst *rqstp, struct ip_map *ipm) | |||
| 405 | { | 410 | { |
| 406 | struct svc_sock *svsk = rqstp->rq_sock; | 411 | struct svc_sock *svsk = rqstp->rq_sock; |
| 407 | 412 | ||
| 408 | if (svsk->sk_sock->type == SOCK_STREAM && svsk->sk_info_authunix == NULL) | 413 | spin_lock_bh(&svsk->sk_defer_lock); |
| 409 | svsk->sk_info_authunix = ipm; /* newly cached, keep the reference */ | 414 | if (svsk->sk_sock->type == SOCK_STREAM && |
| 410 | else | 415 | svsk->sk_info_authunix == NULL) { |
| 416 | /* newly cached, keep the reference */ | ||
| 417 | svsk->sk_info_authunix = ipm; | ||
| 418 | ipm = NULL; | ||
| 419 | } | ||
| 420 | spin_unlock_bh(&svsk->sk_defer_lock); | ||
| 421 | if (ipm) | ||
| 411 | cache_put(&ipm->h, &ip_map_cache); | 422 | cache_put(&ipm->h, &ip_map_cache); |
| 412 | } | 423 | } |
| 413 | 424 | ||
