diff options
author | NeilBrown <neilb@suse.com> | 2017-01-30 01:17:00 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2017-02-06 17:29:22 -0500 |
commit | b880092109323d1cc608c420fa712d3e19508e13 (patch) | |
tree | 72b71f8ba1a047c2302cfabd3d6383471ddf145b | |
parent | 32ddd944a056c786f6acdd95ed29e994adc613a2 (diff) |
NFSDv4: use export cache flushtime for changeid on V4ROOT objects.
If you change the set of filesystems that are exported, then
the contents of various directories in the NFSv4 pseudo-root
is likely to change. However the change-id of those
directories is currently tied to the underlying directory,
so the client may not see the changes in a timely fashion.
This patch changes the change-id number to be derived from the
"flush_time" of the export cache. Whenever any changes are
made to the set of exported filesystems, this flush_time is
updated. The result is that clients see changes to the set
of exported filesystems much more quickly, often immediately.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 3cc190755958..7e4df80456ff 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1966,9 +1966,13 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
1966 | DECODE_TAIL; | 1966 | DECODE_TAIL; |
1967 | } | 1967 | } |
1968 | 1968 | ||
1969 | static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode) | 1969 | static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode, |
1970 | struct svc_export *exp) | ||
1970 | { | 1971 | { |
1971 | if (IS_I_VERSION(inode)) { | 1972 | if (exp->ex_flags & NFSEXP_V4ROOT) { |
1973 | *p++ = cpu_to_be32(convert_to_wallclock(exp->cd->flush_time)); | ||
1974 | *p++ = 0; | ||
1975 | } else if (IS_I_VERSION(inode)) { | ||
1972 | p = xdr_encode_hyper(p, inode->i_version); | 1976 | p = xdr_encode_hyper(p, inode->i_version); |
1973 | } else { | 1977 | } else { |
1974 | *p++ = cpu_to_be32(stat->ctime.tv_sec); | 1978 | *p++ = cpu_to_be32(stat->ctime.tv_sec); |
@@ -2493,7 +2497,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, | |||
2493 | p = xdr_reserve_space(xdr, 8); | 2497 | p = xdr_reserve_space(xdr, 8); |
2494 | if (!p) | 2498 | if (!p) |
2495 | goto out_resource; | 2499 | goto out_resource; |
2496 | p = encode_change(p, &stat, d_inode(dentry)); | 2500 | p = encode_change(p, &stat, d_inode(dentry), exp); |
2497 | } | 2501 | } |
2498 | if (bmval0 & FATTR4_WORD0_SIZE) { | 2502 | if (bmval0 & FATTR4_WORD0_SIZE) { |
2499 | p = xdr_reserve_space(xdr, 8); | 2503 | p = xdr_reserve_space(xdr, 8); |