diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2021-12-24 14:22:28 -0500 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2022-01-08 14:42:03 -0500 |
commit | 58f258f65267542959487dbe8b5641754411843d (patch) | |
tree | 0325e51e71d053be504e4fa58d6ad6ff9857dcde /fs/nfsd/nfsfh.c | |
parent | 75acacb6583df0b9328dc701d8eeea05af49b8b5 (diff) | |
download | linux-rpi-58f258f65267542959487dbe8b5641754411843d.tar.gz linux-rpi-58f258f65267542959487dbe8b5641754411843d.tar.bz2 linux-rpi-58f258f65267542959487dbe8b5641754411843d.zip |
Revert "nfsd: skip some unnecessary stats in the v4 case"
On the wire, I observed NFSv4 OPEN(CREATE) operations sometimes
returning a reasonable-looking value in the cinfo.before field and
zero in the cinfo.after field.
RFC 8881 Section 10.8.1 says:
> When a client is making changes to a given directory, it needs to
> determine whether there have been changes made to the directory by
> other clients. It does this by using the change attribute as
> reported before and after the directory operation in the associated
> change_info4 value returned for the operation.
and
> ... The post-operation change
> value needs to be saved as the basis for future change_info4
> comparisons.
A good quality client implementation therefore saves the zero
cinfo.after value. During a subsequent OPEN operation, it will
receive a different non-zero value in the cinfo.before field for
that directory, and it will incorrectly believe the directory has
changed, triggering an undesirable directory cache invalidation.
There are filesystem types where fs_supports_change_attribute()
returns false, tmpfs being one. On NFSv4 mounts, this means the
fh_getattr() call site in fill_pre_wcc() and fill_post_wcc() is
never invoked. Subsequently, nfsd4_change_attribute() is invoked
with an uninitialized @stat argument.
In fill_pre_wcc(), @stat contains stale stack garbage, which is
then placed on the wire. In fill_post_wcc(), ->fh_post_wc is all
zeroes, so zero is placed on the wire. Both of these values are
meaningless.
This fix can be applied immediately to stable kernels. Once there
are more regression tests in this area, this optimization can be
attempted again.
Fixes: 428a23d2bf0c ("nfsd: skip some unnecessary stats in the v4 case")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/nfsfh.c')
0 files changed, 0 insertions, 0 deletions