afs: Fix over zealous "vnode modified" warnings
authorDavid Howells <dhowells@redhat.com>
Wed, 19 Jun 2019 09:56:03 +0000 (10:56 +0100)
committerDavid Howells <dhowells@redhat.com>
Thu, 20 Jun 2019 15:49:34 +0000 (16:49 +0100)
Occasionally, warnings like this:

vnode modified 2af7 on {10000b:1} [exp 2af2] YFS.FetchStatus(vnode)

are emitted into the kernel log.  This indicates that when we were applying
the updated vnode (file) status retrieved from the server to an inode we
saw that the data version number wasn't what we were expecting (in this
case it's 0x2af7 rather than 0x2af2).

We've usually received a callback from the server prior to this point - or
the callback promise has lapsed - so the warning is merely informative and
the state is to be expected.

Fix this by only emitting the warning if the we still think that we have a
valid callback promise and haven't received a callback.

Also change the format slightly so so that the new data version doesn't
look like part of the text, the like is prefixed with "kAFS: " and the
message is ranked as a warning.

Fixes: 31143d5d515e ("AFS: implement basic file write support")
Reported-by: Ian Wienand <iwienand@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/inode.c

index b42d9d09669c863ce51ef463bc695085c072eccd..dd8931345a8df8b3bcb5c887ea878cec4c23eea8 100644 (file)
@@ -207,11 +207,13 @@ static void afs_apply_status(struct afs_fs_cursor *fc,
 
        if (expected_version &&
            *expected_version != status->data_version) {
-               kdebug("vnode modified %llx on {%llx:%llu} [exp %llx] %s",
-                      (unsigned long long) status->data_version,
-                      vnode->fid.vid, vnode->fid.vnode,
-                      (unsigned long long) *expected_version,
-                      fc->type ? fc->type->name : "???");
+               if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags))
+                       pr_warn("kAFS: vnode modified {%llx:%llu} %llx->%llx %s\n",
+                               vnode->fid.vid, vnode->fid.vnode,
+                               (unsigned long long)*expected_version,
+                               (unsigned long long)status->data_version,
+                               fc->type ? fc->type->name : "???");
+
                vnode->invalid_before = status->data_version;
                if (vnode->status.type == AFS_FTYPE_DIR) {
                        if (test_and_clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags))