aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-06-24 01:03:23 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:06:31 -0400
commit7b190fecfa33d72bcf74c9473134c2ad14ae9545 (patch)
tree94769b846f9d4e38a831f6e343db34bbfdb403bc /fs/nfsd/nfs4state.c
parentd99a05adf8490cc171b7709554936b8f3ac9e362 (diff)
[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>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 16c9a43218c3..0f6119714c8c 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1709,14 +1709,30 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
1709 int status, flag = 0; 1709 int status, flag = 0;
1710 1710
1711 flag = NFS4_OPEN_DELEGATE_NONE; 1711 flag = NFS4_OPEN_DELEGATE_NONE;
1712 if (open->op_claim_type != NFS4_OPEN_CLAIM_NULL 1712 open->op_recall = 0;
1713 || !atomic_read(&cb->cb_set) || !sop->so_confirmed) 1713 switch (open->op_claim_type) {
1714 goto out; 1714 case NFS4_OPEN_CLAIM_PREVIOUS:
1715 1715 if (!atomic_read(&cb->cb_set))
1716 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) 1716 open->op_recall = 1;
1717 flag = NFS4_OPEN_DELEGATE_WRITE; 1717 flag = open->op_delegate_type;
1718 else 1718 if (flag == NFS4_OPEN_DELEGATE_NONE)
1719 flag = NFS4_OPEN_DELEGATE_READ; 1719 goto out;
1720 break;
1721 case NFS4_OPEN_CLAIM_NULL:
1722 /* Let's not give out any delegations till everyone's
1723 * had the chance to reclaim theirs.... */
1724 if (nfs4_in_grace())
1725 goto out;
1726 if (!atomic_read(&cb->cb_set) || !sop->so_confirmed)
1727 goto out;
1728 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
1729 flag = NFS4_OPEN_DELEGATE_WRITE;
1730 else
1731 flag = NFS4_OPEN_DELEGATE_READ;
1732 break;
1733 default:
1734 goto out;
1735 }
1720 1736
1721 dp = alloc_init_deleg(sop->so_client, stp, fh, flag); 1737 dp = alloc_init_deleg(sop->so_client, stp, fh, flag);
1722 if (dp == NULL) { 1738 if (dp == NULL) {
@@ -1750,6 +1766,10 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_sta
1750 dp->dl_stateid.si_fileid, 1766 dp->dl_stateid.si_fileid,
1751 dp->dl_stateid.si_generation); 1767 dp->dl_stateid.si_generation);
1752out: 1768out:
1769 if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS
1770 && flag == NFS4_OPEN_DELEGATE_NONE
1771 && open->op_delegate_type != NFS4_OPEN_DELEGATE_NONE)
1772 printk("NFSD: WARNING: refusing delegation reclaim\n");
1753 open->op_delegate_type = flag; 1773 open->op_delegate_type = flag;
1754} 1774}
1755 1775