]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
afs: Fix "kAFS: AFS vnode with undefined type 0"
authorDavid Howells <dhowells@redhat.com>
Wed, 15 May 2019 22:06:24 +0000 (23:06 +0100)
committerDavid Howells <dhowells@redhat.com>
Thu, 16 May 2019 14:48:20 +0000 (15:48 +0100)
Under some circumstances afs_select_fileserver() can return without setting
an error in fc->error.  The problem is in the no_more_servers segment where
the accumulated errors from attempts to contact various servers are
integrated into an afs_error-type variable 'e'.  The resultant error code
is, however, then abandoned.

Fix this by getting the error out of e.error and putting it in 'error' so
that the next part will store it into fc->error.

Not doing this causes a report like the following:

    kAFS: AFS vnode with undefined type 0
    kAFS: A=0 m=0 s=0 v=0
    kAFS: vnode 20000025:1:1

because the code following the server selection loop then sees what it
thinks is a successful invocation because fc.error is 0.  However, it can't
apply the status record because it's all zeros.

The report is followed on the first instance with a trace looking something
like:

     dump_stack+0x67/0x8e
     afs_inode_init_from_status.isra.2+0x21b/0x487
     afs_fetch_status+0x119/0x1df
     afs_iget+0x130/0x295
     afs_get_tree+0x31d/0x595
     vfs_get_tree+0x1f/0xe8
     fc_mount+0xe/0x36
     afs_d_automount+0x328/0x3c3
     follow_managed+0x109/0x20a
     lookup_fast+0x3bf/0x3f8
     do_last+0xc3/0x6a4
     path_openat+0x1af/0x236
     do_filp_open+0x51/0xae
     ? _raw_spin_unlock+0x24/0x2d
     ? __alloc_fd+0x1a5/0x1b7
     do_sys_open+0x13b/0x1e8
     do_syscall_64+0x7d/0x1b3
     entry_SYSCALL_64_after_hwframe+0x49/0xbe

Fixes: 4584ae96ae30 ("afs: Fix missing net error handling")
Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/rotate.c

index c3ae324781f846b8122b6b0a80085efaafdcaaba..838810da8d5c2ca2da5ae6ebebb4707c3d948b8d 100644 (file)
@@ -459,6 +459,8 @@ no_more_servers:
                                     s->probe.abort_code);
        }
 
+       error = e.error;
+
 failed_set_error:
        fc->error = error;
 failed: