diff options
| -rw-r--r-- | fs/nfs/idmap.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index b5b86a05059c..864c51e4b400 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
| @@ -57,6 +57,11 @@ unsigned int nfs_idmap_cache_timeout = 600; | |||
| 57 | static const struct cred *id_resolver_cache; | 57 | static const struct cred *id_resolver_cache; |
| 58 | static struct key_type key_type_id_resolver_legacy; | 58 | static struct key_type key_type_id_resolver_legacy; |
| 59 | 59 | ||
| 60 | struct idmap { | ||
| 61 | struct rpc_pipe *idmap_pipe; | ||
| 62 | struct key_construction *idmap_key_cons; | ||
| 63 | struct mutex idmap_mutex; | ||
| 64 | }; | ||
| 60 | 65 | ||
| 61 | /** | 66 | /** |
| 62 | * nfs_fattr_init_names - initialise the nfs_fattr owner_name/group_name fields | 67 | * nfs_fattr_init_names - initialise the nfs_fattr owner_name/group_name fields |
| @@ -310,9 +315,11 @@ static ssize_t nfs_idmap_get_key(const char *name, size_t namelen, | |||
| 310 | name, namelen, type, data, | 315 | name, namelen, type, data, |
| 311 | data_size, NULL); | 316 | data_size, NULL); |
| 312 | if (ret < 0) { | 317 | if (ret < 0) { |
| 318 | mutex_lock(&idmap->idmap_mutex); | ||
| 313 | ret = nfs_idmap_request_key(&key_type_id_resolver_legacy, | 319 | ret = nfs_idmap_request_key(&key_type_id_resolver_legacy, |
| 314 | name, namelen, type, data, | 320 | name, namelen, type, data, |
| 315 | data_size, idmap); | 321 | data_size, idmap); |
| 322 | mutex_unlock(&idmap->idmap_mutex); | ||
| 316 | } | 323 | } |
| 317 | return ret; | 324 | return ret; |
| 318 | } | 325 | } |
| @@ -354,11 +361,6 @@ static int nfs_idmap_lookup_id(const char *name, size_t namelen, const char *typ | |||
| 354 | /* idmap classic begins here */ | 361 | /* idmap classic begins here */ |
| 355 | module_param(nfs_idmap_cache_timeout, int, 0644); | 362 | module_param(nfs_idmap_cache_timeout, int, 0644); |
| 356 | 363 | ||
| 357 | struct idmap { | ||
| 358 | struct rpc_pipe *idmap_pipe; | ||
| 359 | struct key_construction *idmap_key_cons; | ||
| 360 | }; | ||
| 361 | |||
| 362 | enum { | 364 | enum { |
| 363 | Opt_find_uid, Opt_find_gid, Opt_find_user, Opt_find_group, Opt_find_err | 365 | Opt_find_uid, Opt_find_gid, Opt_find_user, Opt_find_group, Opt_find_err |
| 364 | }; | 366 | }; |
| @@ -469,6 +471,7 @@ nfs_idmap_new(struct nfs_client *clp) | |||
| 469 | return error; | 471 | return error; |
| 470 | } | 472 | } |
| 471 | idmap->idmap_pipe = pipe; | 473 | idmap->idmap_pipe = pipe; |
| 474 | mutex_init(&idmap->idmap_mutex); | ||
| 472 | 475 | ||
| 473 | clp->cl_idmap = idmap; | 476 | clp->cl_idmap = idmap; |
| 474 | return 0; | 477 | return 0; |
