summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2018-04-25 13:26:23 -0400
committerJ. Bruce Fields <bfields@redhat.com>2018-06-17 10:41:31 -0400
commita85857633b04d57f4524cca0a2bfaf87b2543f9f (patch)
tree3ee6fe22387608309977b5cc7576107ddae67ff7
parent16945141c3567bb8561de3677de1ec657675bb15 (diff)
nfsd4: support change_attr_type attribute
The change attribute is what is used by clients to revalidate their caches. Our server may use i_version or ctime for that purpose. Those choices behave slightly differently, and it may be useful to the client to know which we're using. This attribute tells the client that. The Linux client doesn't yet use this attribute yet, though. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4xdr.c10
-rw-r--r--fs/nfsd/nfsd.h1
-rw-r--r--include/linux/nfs4.h8
3 files changed, 19 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 4161031ae14e..fb4991889f89 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2891,6 +2891,16 @@ out_acl:
2891 goto out; 2891 goto out;
2892 } 2892 }
2893 2893
2894 if (bmval2 & FATTR4_WORD2_CHANGE_ATTR_TYPE) {
2895 p = xdr_reserve_space(xdr, 4);
2896 if (!p)
2897 goto out_resource;
2898 if (IS_I_VERSION(d_inode(dentry)))
2899 *p++ = cpu_to_be32(NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR);
2900 else
2901 *p++ = cpu_to_be32(NFS4_CHANGE_TYPE_IS_TIME_METADATA);
2902 }
2903
2894 if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) { 2904 if (bmval2 & FATTR4_WORD2_SECURITY_LABEL) {
2895 status = nfsd4_encode_security_label(xdr, rqstp, context, 2905 status = nfsd4_encode_security_label(xdr, rqstp, context,
2896 contextlen); 2906 contextlen);
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 3fce905d0365..066899929863 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -360,6 +360,7 @@ void nfsd_lockd_shutdown(void);
360 360
361#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \ 361#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \
362 (NFSD4_1_SUPPORTED_ATTRS_WORD2 | \ 362 (NFSD4_1_SUPPORTED_ATTRS_WORD2 | \
363 FATTR4_WORD2_CHANGE_ATTR_TYPE | \
363 FATTR4_WORD2_MODE_UMASK | \ 364 FATTR4_WORD2_MODE_UMASK | \
364 NFSD4_2_SECURITY_ATTRS) 365 NFSD4_2_SECURITY_ATTRS)
365 366
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 57ffaa20d564..0877ed333733 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -374,6 +374,13 @@ enum lock_type4 {
374 NFS4_WRITEW_LT = 4 374 NFS4_WRITEW_LT = 4
375}; 375};
376 376
377enum change_attr_type4 {
378 NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR = 0,
379 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER = 1,
380 NFS4_CHANGE_TYPE_IS_VERSION_COUNTER_NOPNFS = 2,
381 NFS4_CHANGE_TYPE_IS_TIME_METADATA = 3,
382 NFS4_CHANGE_TYPE_IS_UNDEFINED = 4
383};
377 384
378/* Mandatory Attributes */ 385/* Mandatory Attributes */
379#define FATTR4_WORD0_SUPPORTED_ATTRS (1UL << 0) 386#define FATTR4_WORD0_SUPPORTED_ATTRS (1UL << 0)
@@ -441,6 +448,7 @@ enum lock_type4 {
441#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 448#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
442#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 449#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
443#define FATTR4_WORD2_CLONE_BLKSIZE (1UL << 13) 450#define FATTR4_WORD2_CLONE_BLKSIZE (1UL << 13)
451#define FATTR4_WORD2_CHANGE_ATTR_TYPE (1UL << 15)
444#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16) 452#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
445#define FATTR4_WORD2_MODE_UMASK (1UL << 17) 453#define FATTR4_WORD2_MODE_UMASK (1UL << 17)
446 454