aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-06-24 01:02:54 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:06:28 -0400
commitc44c5eeb2c022ddac98a8543c08dc8ff820561dc (patch)
tree17e5d443ec77c228c1881cf624f63e01933a3f03 /fs/nfsd/nfs4state.c
parent567d98292e81033182e3da4c33b41ada9c113447 (diff)
[PATCH] nfsd4: add open state code for CLAIM_DELEGATE_CUR
State logic for OPEN with claim type CLAIM_DELEGATE_CUR, which the NFSv4 client uses to report local OPENs on a delegated file back to the NFSv4 server. nfs4_check_deleg() performs input delegation stateid lookup and sanity check. Signed-off-by: Andy Adamson <andros@citi.umich.edu> 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.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 3791c9d84dad..8ac0c9abe941 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1547,22 +1547,28 @@ find_delegation_file(struct nfs4_file *fp, stateid_t *stid)
1547 return NULL; 1547 return NULL;
1548} 1548}
1549 1549
1550static void 1550static int
1551nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open, 1551nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open,
1552 struct nfs4_delegation **dp) 1552 struct nfs4_delegation **dp)
1553{ 1553{
1554 int flags; 1554 int flags;
1555 int status; 1555 int status = nfserr_bad_stateid;
1556 1556
1557 *dp = find_delegation_file(fp, &open->op_delegate_stateid); 1557 *dp = find_delegation_file(fp, &open->op_delegate_stateid);
1558 if (*dp == NULL) 1558 if (*dp == NULL)
1559 return; 1559 goto out;
1560 flags = open->op_share_access == NFS4_SHARE_ACCESS_READ ? 1560 flags = open->op_share_access == NFS4_SHARE_ACCESS_READ ?
1561 RD_STATE : WR_STATE; 1561 RD_STATE : WR_STATE;
1562 status = nfs4_check_delegmode(*dp, flags); 1562 status = nfs4_check_delegmode(*dp, flags);
1563 if (status) 1563 if (status)
1564 *dp = NULL; 1564 *dp = NULL;
1565 return; 1565out:
1566 if (open->op_claim_type != NFS4_OPEN_CLAIM_DELEGATE_CUR)
1567 return nfs_ok;
1568 if (status)
1569 return status;
1570 open->op_stateowner->so_confirmed = 1;
1571 return nfs_ok;
1566} 1572}
1567 1573
1568static int 1574static int
@@ -1760,8 +1766,13 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
1760 if (fp) { 1766 if (fp) {
1761 if ((status = nfs4_check_open(fp, open, &stp))) 1767 if ((status = nfs4_check_open(fp, open, &stp)))
1762 goto out; 1768 goto out;
1763 nfs4_check_deleg(fp, open, &dp); 1769 status = nfs4_check_deleg(fp, open, &dp);
1770 if (status)
1771 goto out;
1764 } else { 1772 } else {
1773 status = nfserr_bad_stateid;
1774 if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR)
1775 goto out;
1765 status = nfserr_resource; 1776 status = nfserr_resource;
1766 fp = alloc_init_file(ino); 1777 fp = alloc_init_file(ino);
1767 if (fp == NULL) 1778 if (fp == NULL)