nfs41: implement DESTROY_CLIENTID operation

According to rfc5661 18.50, implement DESTROY_CLIENTID operation.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
此提交包含在:
Mi Jinlong
2011-10-20 17:51:39 +08:00
提交者 J. Bruce Fields
父節點 92bac8c5d6
當前提交 345c284290
共有 4 個檔案被更改,包括 61 行新增2 行删除

查看文件

@@ -1962,6 +1962,50 @@ out:
return status;
}
static inline bool has_resources(struct nfs4_client *clp)
{
return !list_empty(&clp->cl_openowners)
|| !list_empty(&clp->cl_delegations)
|| !list_empty(&clp->cl_sessions);
}
__be32
nfsd4_destroy_clientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_destroy_clientid *dc)
{
struct nfs4_client *conf, *unconf, *clp;
int status = 0;
nfs4_lock_state();
unconf = find_unconfirmed_client(&dc->clientid);
conf = find_confirmed_client(&dc->clientid);
if (conf) {
clp = conf;
if (!is_client_expired(conf) && has_resources(conf)) {
status = nfserr_clientid_busy;
goto out;
}
/* rfc5661 18.50.3 */
if (cstate->session && conf == cstate->session->se_client) {
status = nfserr_clientid_busy;
goto out;
}
} else if (unconf)
clp = unconf;
else {
status = nfserr_stale_clientid;
goto out;
}
expire_client(clp);
out:
nfs4_unlock_state();
dprintk("%s return %d\n", __func__, ntohl(status));
return status;
}
__be32
nfsd4_reclaim_complete(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_reclaim_complete *rc)
{