[pnfs] [PATCH 04/10] pnfsd: LAYOUTGET layout stateid processing
andros at netapp.com
andros at netapp.com
Wed May 7 16:53:39 EDT 2008
From: Andy Adamson <andros at netapp.com>
Signed-off-by: Andy Adamson<andros at netapp.com>
---
fs/nfsd/nfs4state.c | 8 +++++++-
fs/nfsd/nfs4xdr.c | 4 ++--
include/linux/nfsd/pnfsd.h | 3 ++-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 68e1332..e04b8c0 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4576,7 +4576,8 @@ merge_layout(struct nfs4_file *fp,
int
nfs4_pnfs_get_layout(struct svc_fh *current_fh,
- struct pnfs_layoutget_arg *args)
+ struct pnfs_layoutget_arg *args,
+ stateid_t *stateid)
{
int status = nfserr_layouttrylater;
struct inode *ino = current_fh->fh_dentry->d_inode;
@@ -4596,6 +4597,11 @@ nfs4_pnfs_get_layout(struct svc_fh *current_fh,
if (!fp || !clp)
goto out;
+ /* Check decoded layout stateid */
+ status = nfs4_process_layout_stateid(clp, fp, stateid, &ls);
+ if (status)
+ goto out;
+
if (is_layout_recalled(clp, current_fh, &args->seg)) {
status = nfserr_recallconflict;
goto out;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index b6b8ac8..0e8c343 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3514,8 +3514,8 @@ nfsd4_encode_layoutget(struct nfsd4_compoundres *resp,
args.xdr.end = resp->end;
args.xdr.maxcount = maxcount;
- /* Retrieve, encode, and merge layout */
- nfserr = nfs4_pnfs_get_layout(lgp->lg_fhp, &args);
+ /* Retrieve, encode, and merge layout; process stateid */
+ nfserr = nfs4_pnfs_get_layout(lgp->lg_fhp, &args, &lgp->lg_sid);
if (nfserr) {
printk(KERN_ERR "%s: export ERROR %d\n", __func__, nfserr);
return nfserrno(nfserr);
diff --git a/include/linux/nfsd/pnfsd.h b/include/linux/nfsd/pnfsd.h
index 079bf57..657a440 100644
--- a/include/linux/nfsd/pnfsd.h
+++ b/include/linux/nfsd/pnfsd.h
@@ -87,7 +87,8 @@ struct pnfs_mds_id {
int nfsd_layout_recall_cb(struct super_block *, struct inode *, struct nfsd4_pnfs_cb_layout *);
int nfs4_pnfs_cb_get_state(struct super_block *, struct pnfs_get_state *);
void nfs4_pnfs_state_init(void);
-int nfs4_pnfs_get_layout(struct svc_fh *, struct pnfs_layoutget_arg *);
+int nfs4_pnfs_get_layout(struct svc_fh *, struct pnfs_layoutget_arg *,
+ stateid_t *);
int nfs4_pnfs_return_layout(struct super_block *, struct svc_fh *,
struct nfsd4_pnfs_layoutreturn *);
int nfs4_pnfs_propagate_open(struct super_block *, struct svc_fh *, void *);
--
1.5.4.1
More information about the pNFS
mailing list