Commit b8800921 authored by NeilBrown's avatar NeilBrown Committed by J. Bruce Fields

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: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 32ddd944
...@@ -1966,9 +1966,13 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) ...@@ -1966,9 +1966,13 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
DECODE_TAIL; DECODE_TAIL;
} }
static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode) static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode,
struct svc_export *exp)
{ {
if (IS_I_VERSION(inode)) { if (exp->ex_flags & NFSEXP_V4ROOT) {
*p++ = cpu_to_be32(convert_to_wallclock(exp->cd->flush_time));
*p++ = 0;
} else if (IS_I_VERSION(inode)) {
p = xdr_encode_hyper(p, inode->i_version); p = xdr_encode_hyper(p, inode->i_version);
} else { } else {
*p++ = cpu_to_be32(stat->ctime.tv_sec); *p++ = cpu_to_be32(stat->ctime.tv_sec);
...@@ -2493,7 +2497,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, ...@@ -2493,7 +2497,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
p = xdr_reserve_space(xdr, 8); p = xdr_reserve_space(xdr, 8);
if (!p) if (!p)
goto out_resource; goto out_resource;
p = encode_change(p, &stat, d_inode(dentry)); p = encode_change(p, &stat, d_inode(dentry), exp);
} }
if (bmval0 & FATTR4_WORD0_SIZE) { if (bmval0 & FATTR4_WORD0_SIZE) {
p = xdr_reserve_space(xdr, 8); p = xdr_reserve_space(xdr, 8);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment