summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-06-23 22:02:54 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 00:06:28 -0700
commitc44c5eeb2c022ddac98a8543c08dc8ff820561dc (patch)
tree17e5d443ec77c228c1881cf624f63e01933a3f03 /fs
parent567d98292e81033182e3da4c33b41ada9c113447 (diff)
downloadlinux-c44c5eeb2c022ddac98a8543c08dc8ff820561dc.tar.gz
linux-c44c5eeb2c022ddac98a8543c08dc8ff820561dc.tar.bz2
linux-c44c5eeb2c022ddac98a8543c08dc8ff820561dc.zip
[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')
-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)
return NULL;
}
-static void
+static int
nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open,
struct nfs4_delegation **dp)
{
int flags;
- int status;
+ int status = nfserr_bad_stateid;
*dp = find_delegation_file(fp, &open->op_delegate_stateid);
if (*dp == NULL)
- return;
+ goto out;
flags = open->op_share_access == NFS4_SHARE_ACCESS_READ ?
RD_STATE : WR_STATE;
status = nfs4_check_delegmode(*dp, flags);
if (status)
*dp = NULL;
- return;
+out:
+ if (open->op_claim_type != NFS4_OPEN_CLAIM_DELEGATE_CUR)
+ return nfs_ok;
+ if (status)
+ return status;
+ open->op_stateowner->so_confirmed = 1;
+ return nfs_ok;
}
static int
@@ -1760,8 +1766,13 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
if (fp) {
if ((status = nfs4_check_open(fp, open, &stp)))
goto out;
- nfs4_check_deleg(fp, open, &dp);
+ status = nfs4_check_deleg(fp, open, &dp);
+ if (status)
+ goto out;
} else {
+ status = nfserr_bad_stateid;
+ if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR)
+ goto out;
status = nfserr_resource;
fp = alloc_init_file(ino);
if (fp == NULL)