[pnfs] [PATCH 3/4] nfsd41: SUPPATTR_EXCLCREAT attribute
J. Bruce Fields
bfields at fieldses.org
Mon May 12 18:27:16 EDT 2008
On Mon, May 12, 2008 at 11:27:08AM -0700, Benny Halevy wrote:
> Return bitmask for supported EXCLUSIVE4_1 create attributes.
>
> Signed-off-by: Benny Halevy <bhalevy at panasas.com>
> ---
> fs/nfsd/nfs4xdr.c | 9 ++++++++-
> include/linux/nfs4.h | 2 ++
> include/linux/nfsd/nfsd.h | 19 +++++++++++++++++++
> 3 files changed, 29 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index eac9656..8173af8 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -2149,7 +2149,14 @@ out_acl:
> }
> WRITE64(stat.ino);
> }
> - BUG_ON(bmval2); /* FIXME: not implemented yet */
> +#if defined(CONFIG_NFSD_V4_1)
> + if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
> + WRITE32(3);
> + WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD0);
> + WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD1);
> + WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD2);
> + }
> +#endif /* CONFIG_NFSD_V4_1 */
>
> *attrlenp = htonl((char *)p - (char *)attrlenp - 4);
> *countp = p - buffer;
> diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
> index f4c8ce2..190f070 100644
> --- a/include/linux/nfs4.h
> +++ b/include/linux/nfs4.h
> @@ -367,6 +367,8 @@ enum lock_type4 {
> #define FATTR4_WORD0_UNIQUE_HANDLES (1UL << 9)
> #define FATTR4_WORD0_LEASE_TIME (1UL << 10)
> #define FATTR4_WORD0_RDATTR_ERROR (1UL << 11)
> +/* Mandatory in NFSv4.1 */
> +#define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11)
>
> /* Recommended Attributes */
> #define FATTR4_WORD0_ACL (1UL << 12)
> diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
> index 64b9e45..f9f0467 100644
> --- a/include/linux/nfsd/nfsd.h
> +++ b/include/linux/nfsd/nfsd.h
> @@ -333,7 +333,12 @@ extern struct timeval nfssvc_boot;
> | FATTR4_WORD1_TIME_DELTA | FATTR4_WORD1_TIME_METADATA \
> | FATTR4_WORD1_TIME_MODIFY | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID)
>
> +#if defined(CONFIG_NFSD_V4_1)
> +#define NFSD_SUPPORTED_ATTRS_WORD2 \
> + FATTR4_WORD2_SUPPATTR_EXCLCREAT
> +#else /* CONFIG_NFSD_V4_1) */
> #define NFSD_SUPPORTED_ATTRS_WORD2 0
> +#endif /* CONFIG_NFSD_V4_1 */
Won't we eventually need both of those definitions available at runtime,
so that we can answer requests for the supported_attrs attribute from
both 4.0 and 4.1 clients?
--b.
>
> /* These will return ERR_INVAL if specified in GETATTR or READDIR. */
> #define NFSD_WRITEONLY_ATTRS_WORD1 \
> @@ -347,6 +352,20 @@ extern struct timeval nfssvc_boot;
> | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_METADATA | FATTR4_WORD1_TIME_MODIFY_SET)
> #define NFSD_WRITEABLE_ATTRS_WORD2 0
>
> +#if defined(CONFIG_NFSD_V4_1)
> +#define NFSD_SUPPATTR_EXCLCREAT_WORD0 \
> + NFSD_WRITEABLE_ATTRS_WORD0
> +/*
> + * we currently store the exclusive create verifier in the v_{a,m}time
> + * attributes so the client can't set these at create time using EXCLUSIVE4_1
> + */
> +#define NFSD_SUPPATTR_EXCLCREAT_WORD1 \
> + (NFSD_WRITEABLE_ATTRS_WORD1 & \
> + ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET))
> +#define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
> + NFSD_WRITEABLE_ATTRS_WORD2
> +#endif /* CONFIG_NFSD_V4_1 */
> +
> #endif /* CONFIG_NFSD_V4 */
>
> #endif /* __KERNEL__ */
> --
> 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