diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-11 05:06:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-05-11 05:06:13 -0400 |
commit | 7e338c9991ecee9c2ac7a4cee2c2e11ecb563d02 (patch) | |
tree | ad8a383ae162657d7313bb13eedbe8fde736f0c3 | |
parent | 9cf22e80df77b3f8459559e156f6322657e17090 (diff) | |
parent | aa07c713ecfc0522916f3cd57ac628ea6127c0ec (diff) |
Merge branch 'for-3.15' of git://linux-nfs.org/~bfields/linux
Pull nfsd fixes from Bruce Fields.
* 'for-3.15' of git://linux-nfs.org/~bfields/linux:
NFSD: Call ->set_acl with a NULL ACL structure if no entries
NFSd: call rpc_destroy_wait_queue() from free_client()
NFSd: Move default initialisers from create_client() to alloc_client()
-rw-r--r-- | fs/nfsd/nfs4acl.c | 17 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 25 |
2 files changed, 22 insertions, 20 deletions
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index 6f3f392d48af..b6f46013dddf 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c | |||
@@ -402,8 +402,10 @@ sort_pacl(struct posix_acl *pacl) | |||
402 | * by uid/gid. */ | 402 | * by uid/gid. */ |
403 | int i, j; | 403 | int i, j; |
404 | 404 | ||
405 | if (pacl->a_count <= 4) | 405 | /* no users or groups */ |
406 | return; /* no users or groups */ | 406 | if (!pacl || pacl->a_count <= 4) |
407 | return; | ||
408 | |||
407 | i = 1; | 409 | i = 1; |
408 | while (pacl->a_entries[i].e_tag == ACL_USER) | 410 | while (pacl->a_entries[i].e_tag == ACL_USER) |
409 | i++; | 411 | i++; |
@@ -530,13 +532,12 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags) | |||
530 | 532 | ||
531 | /* | 533 | /* |
532 | * ACLs with no ACEs are treated differently in the inheritable | 534 | * ACLs with no ACEs are treated differently in the inheritable |
533 | * and effective cases: when there are no inheritable ACEs, we | 535 | * and effective cases: when there are no inheritable ACEs, |
534 | * set a zero-length default posix acl: | 536 | * calls ->set_acl with a NULL ACL structure. |
535 | */ | 537 | */ |
536 | if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) { | 538 | if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) |
537 | pacl = posix_acl_alloc(0, GFP_KERNEL); | 539 | return NULL; |
538 | return pacl ? pacl : ERR_PTR(-ENOMEM); | 540 | |
539 | } | ||
540 | /* | 541 | /* |
541 | * When there are no effective ACEs, the following will end | 542 | * When there are no effective ACEs, the following will end |
542 | * up setting a 3-element effective posix ACL with all | 543 | * up setting a 3-element effective posix ACL with all |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 3ba65979a3cd..32b699bebb9c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1078,6 +1078,18 @@ static struct nfs4_client *alloc_client(struct xdr_netobj name) | |||
1078 | return NULL; | 1078 | return NULL; |
1079 | } | 1079 | } |
1080 | clp->cl_name.len = name.len; | 1080 | clp->cl_name.len = name.len; |
1081 | INIT_LIST_HEAD(&clp->cl_sessions); | ||
1082 | idr_init(&clp->cl_stateids); | ||
1083 | atomic_set(&clp->cl_refcount, 0); | ||
1084 | clp->cl_cb_state = NFSD4_CB_UNKNOWN; | ||
1085 | INIT_LIST_HEAD(&clp->cl_idhash); | ||
1086 | INIT_LIST_HEAD(&clp->cl_openowners); | ||
1087 | INIT_LIST_HEAD(&clp->cl_delegations); | ||
1088 | INIT_LIST_HEAD(&clp->cl_lru); | ||
1089 | INIT_LIST_HEAD(&clp->cl_callbacks); | ||
1090 | INIT_LIST_HEAD(&clp->cl_revoked); | ||
1091 | spin_lock_init(&clp->cl_lock); | ||
1092 | rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table"); | ||
1081 | return clp; | 1093 | return clp; |
1082 | } | 1094 | } |
1083 | 1095 | ||
@@ -1095,6 +1107,7 @@ free_client(struct nfs4_client *clp) | |||
1095 | WARN_ON_ONCE(atomic_read(&ses->se_ref)); | 1107 | WARN_ON_ONCE(atomic_read(&ses->se_ref)); |
1096 | free_session(ses); | 1108 | free_session(ses); |
1097 | } | 1109 | } |
1110 | rpc_destroy_wait_queue(&clp->cl_cb_waitq); | ||
1098 | free_svc_cred(&clp->cl_cred); | 1111 | free_svc_cred(&clp->cl_cred); |
1099 | kfree(clp->cl_name.data); | 1112 | kfree(clp->cl_name.data); |
1100 | idr_destroy(&clp->cl_stateids); | 1113 | idr_destroy(&clp->cl_stateids); |
@@ -1347,7 +1360,6 @@ static struct nfs4_client *create_client(struct xdr_netobj name, | |||
1347 | if (clp == NULL) | 1360 | if (clp == NULL) |
1348 | return NULL; | 1361 | return NULL; |
1349 | 1362 | ||
1350 | INIT_LIST_HEAD(&clp->cl_sessions); | ||
1351 | ret = copy_cred(&clp->cl_cred, &rqstp->rq_cred); | 1363 | ret = copy_cred(&clp->cl_cred, &rqstp->rq_cred); |
1352 | if (ret) { | 1364 | if (ret) { |
1353 | spin_lock(&nn->client_lock); | 1365 | spin_lock(&nn->client_lock); |
@@ -1355,20 +1367,9 @@ static struct nfs4_client *create_client(struct xdr_netobj name, | |||
1355 | spin_unlock(&nn->client_lock); | 1367 | spin_unlock(&nn->client_lock); |
1356 | return NULL; | 1368 | return NULL; |
1357 | } | 1369 | } |
1358 | idr_init(&clp->cl_stateids); | ||
1359 | atomic_set(&clp->cl_refcount, 0); | ||
1360 | clp->cl_cb_state = NFSD4_CB_UNKNOWN; | ||
1361 | INIT_LIST_HEAD(&clp->cl_idhash); | ||
1362 | INIT_LIST_HEAD(&clp->cl_openowners); | ||
1363 | INIT_LIST_HEAD(&clp->cl_delegations); | ||
1364 | INIT_LIST_HEAD(&clp->cl_lru); | ||
1365 | INIT_LIST_HEAD(&clp->cl_callbacks); | ||
1366 | INIT_LIST_HEAD(&clp->cl_revoked); | ||
1367 | spin_lock_init(&clp->cl_lock); | ||
1368 | nfsd4_init_callback(&clp->cl_cb_null); | 1370 | nfsd4_init_callback(&clp->cl_cb_null); |
1369 | clp->cl_time = get_seconds(); | 1371 | clp->cl_time = get_seconds(); |
1370 | clear_bit(0, &clp->cl_cb_slot_busy); | 1372 | clear_bit(0, &clp->cl_cb_slot_busy); |
1371 | rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table"); | ||
1372 | copy_verf(clp, verf); | 1373 | copy_verf(clp, verf); |
1373 | rpc_copy_addr((struct sockaddr *) &clp->cl_addr, sa); | 1374 | rpc_copy_addr((struct sockaddr *) &clp->cl_addr, sa); |
1374 | gen_confirm(clp); | 1375 | gen_confirm(clp); |