[GIT PULL] afs: Fixes for bugs found by xfstests

From: David Howells
Date: Tue Jun 16 2020 - 17:51:56 EST


Hi Linus,

I've managed to get xfstests kind of working with afs. Here are a set of
patches that fix most of the bugs found.

There are a number of primary issues:

(1) Incorrect handling of mtime and non-handling of ctime. It might be
argued, that the latter isn't a bug since the AFS protocol doesn't
support ctime, but I should probably still update it locally.

(2) Shared-write mmap, truncate and writeback bugs. This includes not
changing i_size under the callback lock, overwriting local i_size with
the reply from the server after a partial writeback, not limiting the
writeback from an mmapped page to EOF.

(3) Checks for an abort code indicating that the primary vnode in an
operation was deleted by a third-party are done in the wrong place.

(4) Silly rename bugs. This includes an incomplete conversion to the new
operation handling, duplicate nlink handling, nlink changing not being
done inside the callback lock and insufficient handling of third-party
conflicting directory changes.

And some secondary ones:

(1) The UAEOVERFLOW abort code should map to EOVERFLOW not EREMOTEIO.

(2) Remove a couple of unused or incompletely used bits.

(3) Remove a couple of redundant success checks.

These seem to fix all the data-corruption bugs found by "./check -afs -g
quick", along with the obvious silly rename bugs and time bugs.

There are still some test failures, but they seem to fall into two classes:
firstly, the authentication/security model is different to the standard
UNIX model and permission is arbitrated by the server and cached locally;
and secondly, there are a number of features that AFS does not support
(such as mknod). But in these cases, the tests themselves need to be
adapted or skipped.

Using the in-kernel afs client with xfstests also found a bug in the
AuriStor AFS server that has been fixed for a future release.

David
---
The following changes since commit b3a9e3b9622ae10064826dccb4f7a52bd88c7407:

Linux 5.8-rc1 (2020-06-14 12:45:04 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/afs-fixes-20200616

for you to fetch changes up to b6489a49f7b71964e37978d6f89bbdbdb263f6f5:

afs: Fix silly rename (2020-06-16 22:00:28 +0100)

----------------------------------------------------------------
AFS fixes

----------------------------------------------------------------
David Howells (12):
afs: Fix non-setting of mtime when writing into mmap
afs: afs_write_end() should change i_size under the right lock
afs: Fix EOF corruption
afs: Concoct ctimes
afs: Fix truncation issues and mmap writeback size
afs: Fix the mapping of the UAEOVERFLOW abort code
afs: Remove yfs_fs_fetch_file_status() as it's not used
afs: Fix yfs_fs_fetch_status() to honour vnode selector
afs: Remove afs_operation::abort_code
afs: Fix use of afs_check_for_remote_deletion()
afs: afs_vnode_commit_status() doesn't need to check the RPC error
afs: Fix silly rename

fs/afs/dir.c | 62 ++++++++++++++++++++++++++++++----
fs/afs/dir_silly.c | 38 +++++++++++++++------
fs/afs/file.c | 2 +-
fs/afs/flock.c | 4 +--
fs/afs/fs_operation.c | 10 +++++-
fs/afs/inode.c | 91 ++++++++++++++++++++++++++++++++++++++-----------
fs/afs/internal.h | 36 +++++++++++++-------
fs/afs/misc.c | 1 +
fs/afs/write.c | 12 +++++--
fs/afs/yfsclient.c | 93 ++++++++++++++-------------------------------------
10 files changed, 225 insertions(+), 124 deletions(-)