Commit 7e338c99 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents 9cf22e80 aa07c713
...@@ -402,8 +402,10 @@ sort_pacl(struct posix_acl *pacl) ...@@ -402,8 +402,10 @@ sort_pacl(struct posix_acl *pacl)
* by uid/gid. */ * by uid/gid. */
int i, j; int i, j;
if (pacl->a_count <= 4) /* no users or groups */
return; /* no users or groups */ if (!pacl || pacl->a_count <= 4)
return;
i = 1; i = 1;
while (pacl->a_entries[i].e_tag == ACL_USER) while (pacl->a_entries[i].e_tag == ACL_USER)
i++; i++;
...@@ -530,13 +532,12 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags) ...@@ -530,13 +532,12 @@ posix_state_to_acl(struct posix_acl_state *state, unsigned int flags)
/* /*
* ACLs with no ACEs are treated differently in the inheritable * ACLs with no ACEs are treated differently in the inheritable
* and effective cases: when there are no inheritable ACEs, we * and effective cases: when there are no inheritable ACEs,
* set a zero-length default posix acl: * calls ->set_acl with a NULL ACL structure.
*/ */
if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) { if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT))
pacl = posix_acl_alloc(0, GFP_KERNEL); return NULL;
return pacl ? pacl : ERR_PTR(-ENOMEM);
}
/* /*
* When there are no effective ACEs, the following will end * When there are no effective ACEs, the following will end
* up setting a 3-element effective posix ACL with all * up setting a 3-element effective posix ACL with all
......
...@@ -1078,6 +1078,18 @@ static struct nfs4_client *alloc_client(struct xdr_netobj name) ...@@ -1078,6 +1078,18 @@ static struct nfs4_client *alloc_client(struct xdr_netobj name)
return NULL; return NULL;
} }
clp->cl_name.len = name.len; clp->cl_name.len = name.len;
INIT_LIST_HEAD(&clp->cl_sessions);
idr_init(&clp->cl_stateids);
atomic_set(&clp->cl_refcount, 0);
clp->cl_cb_state = NFSD4_CB_UNKNOWN;
INIT_LIST_HEAD(&clp->cl_idhash);
INIT_LIST_HEAD(&clp->cl_openowners);
INIT_LIST_HEAD(&clp->cl_delegations);
INIT_LIST_HEAD(&clp->cl_lru);
INIT_LIST_HEAD(&clp->cl_callbacks);
INIT_LIST_HEAD(&clp->cl_revoked);
spin_lock_init(&clp->cl_lock);
rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table");
return clp; return clp;
} }
...@@ -1095,6 +1107,7 @@ free_client(struct nfs4_client *clp) ...@@ -1095,6 +1107,7 @@ free_client(struct nfs4_client *clp)
WARN_ON_ONCE(atomic_read(&ses->se_ref)); WARN_ON_ONCE(atomic_read(&ses->se_ref));
free_session(ses); free_session(ses);
} }
rpc_destroy_wait_queue(&clp->cl_cb_waitq);
free_svc_cred(&clp->cl_cred); free_svc_cred(&clp->cl_cred);
kfree(clp->cl_name.data); kfree(clp->cl_name.data);
idr_destroy(&clp->cl_stateids); idr_destroy(&clp->cl_stateids);
...@@ -1347,7 +1360,6 @@ static struct nfs4_client *create_client(struct xdr_netobj name, ...@@ -1347,7 +1360,6 @@ static struct nfs4_client *create_client(struct xdr_netobj name,
if (clp == NULL) if (clp == NULL)
return NULL; return NULL;
INIT_LIST_HEAD(&clp->cl_sessions);
ret = copy_cred(&clp->cl_cred, &rqstp->rq_cred); ret = copy_cred(&clp->cl_cred, &rqstp->rq_cred);
if (ret) { if (ret) {
spin_lock(&nn->client_lock); spin_lock(&nn->client_lock);
...@@ -1355,20 +1367,9 @@ static struct nfs4_client *create_client(struct xdr_netobj name, ...@@ -1355,20 +1367,9 @@ static struct nfs4_client *create_client(struct xdr_netobj name,
spin_unlock(&nn->client_lock); spin_unlock(&nn->client_lock);
return NULL; return NULL;
} }
idr_init(&clp->cl_stateids);
atomic_set(&clp->cl_refcount, 0);
clp->cl_cb_state = NFSD4_CB_UNKNOWN;
INIT_LIST_HEAD(&clp->cl_idhash);
INIT_LIST_HEAD(&clp->cl_openowners);
INIT_LIST_HEAD(&clp->cl_delegations);
INIT_LIST_HEAD(&clp->cl_lru);
INIT_LIST_HEAD(&clp->cl_callbacks);
INIT_LIST_HEAD(&clp->cl_revoked);
spin_lock_init(&clp->cl_lock);
nfsd4_init_callback(&clp->cl_cb_null); nfsd4_init_callback(&clp->cl_cb_null);
clp->cl_time = get_seconds(); clp->cl_time = get_seconds();
clear_bit(0, &clp->cl_cb_slot_busy); clear_bit(0, &clp->cl_cb_slot_busy);
rpc_init_wait_queue(&clp->cl_cb_waitq, "Backchannel slot table");
copy_verf(clp, verf); copy_verf(clp, verf);
rpc_copy_addr((struct sockaddr *) &clp->cl_addr, sa); rpc_copy_addr((struct sockaddr *) &clp->cl_addr, sa);
gen_confirm(clp); gen_confirm(clp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment