[pnfs] [PATCH 1/1] pnfsd: Check for deleg state on MDS from DS.

Marc Eshel eshel at almaden.ibm.com
Wed Jan 16 13:52:46 EST 2008


Ignore this patch an updated one is on the way.
Marc.

pnfs-bounces at linux-nfs.org wrote on 01/16/2008 10:24:05 AM:

> From: Dean Hildebrand <dhildeb at us.ibm.com>
> 
> When a DS verifies a state id on the MDS, the
> list of delegation stateids also needs to be
> searched.
> 
> Signed-off-by: Dean Hildebrand <dhildeb at us.ibm.com>
> ---
>  fs/nfsd/export.c           |    4 ++--
>  fs/nfsd/nfs4state.c        |   35 +++++++++++++++++++++++------------
>  include/linux/nfsd/pnfsd.h |    3 ++-
>  3 files changed, 27 insertions(+), 15 deletions(-)
> 
> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index 6e5b9c7..018bf5e 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -364,13 +364,13 @@ static void svc_export_request(struct cache_detail 
*cd,
>  }
> 
>  #if defined(CONFIG_PNFSD)
> -static int cb_get_state(void *p)
> +static int cb_get_state(struct super_block *sb, void *p)
>  {
>     struct pnfs_get_state *os = (struct pnfs_get_state *)p;
> 
>     dprintk("cb_get_state os %p\n", os);
> 
> -   return nfs4_pnfs_cb_get_state(os);
> +   return nfs4_pnfs_cb_get_state(sb, os);
>  }
>  EXPORT_SYMBOL(cb_get_state);
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index feb77d5..27f284f 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4739,33 +4739,44 @@ out:
>   *
>   */
>  int
> -nfs4_pnfs_cb_get_state(struct pnfs_get_state *arg)
> +nfs4_pnfs_cb_get_state(struct super_block *sb, struct pnfs_get_state 
*arg)
>  {
>     struct nfs4_stateid *stp;
>     int flags = LOCK_STATE | OPEN_STATE; /* search both hash tables */
>     int status = -EINVAL;
> +   struct inode *ino;
> +   struct nfs4_delegation *dl;
> 
> -   dprintk("NFSD: %s=(%08x/%08x/%08x/%08x)\n\n",
> +   dprintk("NFSD: %s sid=(%08x/%08x/%08x/%08x) ion %ld\n\n",
>              __func__,
>              arg->stid.si_boot,
>              arg->stid.si_stateownerid,
>              arg->stid.si_fileid,
> -            arg->stid.si_generation);
> +            arg->stid.si_generation,
> +            arg->ino);
> 
>     stp = find_stateid(&arg->stid, flags);
> -   if (!stp)
> -      goto out;
> +   if (!stp) {
> +      ino = iget(sb, arg->ino);
> +      if (!ino)
> +         goto out;
> 
> -   /* XXX ANDROS: marc removed nfs4_check_fh - how come? */
> +      dl = find_delegation_stateid(ino, &arg->stid);
> +      if (dl)
> +         status = 0;
> 
> -   /* arg->devid is the Data server id, set by the cluster fs */
> -   status = nfs4_add_pnfs_ds_dev(stp, arg->devid);
> -   if (status)
> -      goto out;
> +      iput(ino);
> +   } else {
> +      /* XXX ANDROS: marc removed nfs4_check_fh - how come? */
> 
> -   arg->access = stp->st_access_bmap;
> -   arg->clid = stp->st_stateowner->so_client->cl_clientid;
> +      /* arg->devid is the Data server id, set by the cluster fs */
> +      status = nfs4_add_pnfs_ds_dev(stp, arg->devid);
> +      if (status)
> +         goto out;
> 
> +      arg->access = stp->st_access_bmap;
> +      arg->clid = stp->st_stateowner->so_client->cl_clientid;
> +   }
>  out:
>     return status;
>  }
> diff --git a/include/linux/nfsd/pnfsd.h b/include/linux/nfsd/pnfsd.h
> index de8595f..70facd4 100644
> --- a/include/linux/nfsd/pnfsd.h
> +++ b/include/linux/nfsd/pnfsd.h
> @@ -43,6 +43,7 @@
>  /* pNFS Metadata to Data server state communication*/
>  struct pnfs_get_state {
>     u32         devid;    /* request */
> +   unsigned long      ino;      /* request */
>     stateid_t      stid;     /* request;response */
>     clientid_t      clid;     /* response */
>     u32         access;    /* response */
> @@ -84,7 +85,7 @@ 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 pnfs_get_state *);
> +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 super_block *, struct svc_fh *,
>                    struct nfsd4_pnfs_layoutget *);
> -- 
> 1.5.3.3
> 
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs



More information about the pNFS mailing list