[PATCH] knfsd: nfsd4: delegation recovery
Allow recovery of delegations after reboot. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
d99a05adf8
commit
7b190fecfa
@@ -1709,14 +1709,30 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
|
|||||||
int status, flag = 0;
|
int status, flag = 0;
|
||||||
|
|
||||||
flag = NFS4_OPEN_DELEGATE_NONE;
|
flag = NFS4_OPEN_DELEGATE_NONE;
|
||||||
if (open->op_claim_type != NFS4_OPEN_CLAIM_NULL
|
open->op_recall = 0;
|
||||||
|| !atomic_read(&cb->cb_set) || !sop->so_confirmed)
|
switch (open->op_claim_type) {
|
||||||
goto out;
|
case NFS4_OPEN_CLAIM_PREVIOUS:
|
||||||
|
if (!atomic_read(&cb->cb_set))
|
||||||
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
|
open->op_recall = 1;
|
||||||
flag = NFS4_OPEN_DELEGATE_WRITE;
|
flag = open->op_delegate_type;
|
||||||
else
|
if (flag == NFS4_OPEN_DELEGATE_NONE)
|
||||||
flag = NFS4_OPEN_DELEGATE_READ;
|
goto out;
|
||||||
|
break;
|
||||||
|
case NFS4_OPEN_CLAIM_NULL:
|
||||||
|
/* Let's not give out any delegations till everyone's
|
||||||
|
* had the chance to reclaim theirs.... */
|
||||||
|
if (nfs4_in_grace())
|
||||||
|
goto out;
|
||||||
|
if (!atomic_read(&cb->cb_set) || !sop->so_confirmed)
|
||||||
|
goto out;
|
||||||
|
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
|
||||||
|
flag = NFS4_OPEN_DELEGATE_WRITE;
|
||||||
|
else
|
||||||
|
flag = NFS4_OPEN_DELEGATE_READ;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
dp = alloc_init_deleg(sop->so_client, stp, fh, flag);
|
dp = alloc_init_deleg(sop->so_client, stp, fh, flag);
|
||||||
if (dp == NULL) {
|
if (dp == NULL) {
|
||||||
@@ -1750,6 +1766,10 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
|
|||||||
dp->dl_stateid.si_fileid,
|
dp->dl_stateid.si_fileid,
|
||||||
dp->dl_stateid.si_generation);
|
dp->dl_stateid.si_generation);
|
||||||
out:
|
out:
|
||||||
|
if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS
|
||||||
|
&& flag == NFS4_OPEN_DELEGATE_NONE
|
||||||
|
&& open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE)
|
||||||
|
printk("NFSD: WARNING: refusing delegation reclaim\n");
|
||||||
open->op_delegate_type = flag;
|
open->op_delegate_type = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1972,7 +1972,7 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open
|
|||||||
case NFS4_OPEN_DELEGATE_READ:
|
case NFS4_OPEN_DELEGATE_READ:
|
||||||
RESERVE_SPACE(20 + sizeof(stateid_t));
|
RESERVE_SPACE(20 + sizeof(stateid_t));
|
||||||
WRITEMEM(&open->op_delegate_stateid, sizeof(stateid_t));
|
WRITEMEM(&open->op_delegate_stateid, sizeof(stateid_t));
|
||||||
WRITE32(0);
|
WRITE32(open->op_recall);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: ACE's in delegations
|
* TODO: ACE's in delegations
|
||||||
|
@@ -210,6 +210,7 @@ struct nfsd4_open {
|
|||||||
u32 op_share_access; /* request */
|
u32 op_share_access; /* request */
|
||||||
u32 op_share_deny; /* request */
|
u32 op_share_deny; /* request */
|
||||||
stateid_t op_stateid; /* response */
|
stateid_t op_stateid; /* response */
|
||||||
|
u32 op_recall; /* recall */
|
||||||
struct nfsd4_change_info op_cinfo; /* response */
|
struct nfsd4_change_info op_cinfo; /* response */
|
||||||
u32 op_rflags; /* response */
|
u32 op_rflags; /* response */
|
||||||
int op_truncate; /* used during processing */
|
int op_truncate; /* used during processing */
|
||||||
|
Reference in New Issue
Block a user