aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-04-25 09:26:52 -0400
committerDavid Howells <dhowells@redhat.com>2019-05-07 11:48:44 -0400
commitb134d687dd9369bb2407a23c6ecc9e0a15d8bb20 (patch)
treed47c8ca5259eb85c26b79756243469964ea19ff4
parent6c6c1d63c243025956f061e67fff3a615aa0f6be (diff)
afs: Log more information for "kAFS: AFS vnode with undefined type\n"
Log more information when "kAFS: AFS vnode with undefined type\n" is displayed due to a vnode record being retrieved from the server that appears to have a duff file type (usually 0). This prints more information to try and help pin down the problem. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--fs/afs/dir.c4
-rw-r--r--fs/afs/inode.c35
-rw-r--r--fs/afs/internal.h3
-rw-r--r--fs/afs/super.c2
4 files changed, 36 insertions, 8 deletions
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 48706eefc63b..9a466be583d2 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -776,7 +776,7 @@ success:
776 ti = afs_iget(dir->i_sb, key, &cookie->fids[i], 776 ti = afs_iget(dir->i_sb, key, &cookie->fids[i],
777 &cookie->statuses[i], 777 &cookie->statuses[i],
778 &cookie->callbacks[i], 778 &cookie->callbacks[i],
779 cbi); 779 cbi, dvnode);
780 if (i == 0) { 780 if (i == 0) {
781 inode = ti; 781 inode = ti;
782 } else { 782 } else {
@@ -1125,7 +1125,7 @@ static void afs_vnode_new_inode(struct afs_fs_cursor *fc,
1125 return; 1125 return;
1126 1126
1127 inode = afs_iget(fc->vnode->vfs_inode.i_sb, fc->key, 1127 inode = afs_iget(fc->vnode->vfs_inode.i_sb, fc->key,
1128 newfid, newstatus, newcb, fc->cbi); 1128 newfid, newstatus, newcb, fc->cbi, fc->vnode);
1129 if (IS_ERR(inode)) { 1129 if (IS_ERR(inode)) {
1130 /* ENOMEM or EINTR at a really inconvenient time - just abandon 1130 /* ENOMEM or EINTR at a really inconvenient time - just abandon
1131 * the new directory on the server. 1131 * the new directory on the server.
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 3eef20ff285b..0362cc7e1c7c 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -29,10 +29,36 @@ static const struct inode_operations afs_symlink_inode_operations = {
29 .listxattr = afs_listxattr, 29 .listxattr = afs_listxattr,
30}; 30};
31 31
32static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)
33{
34 static unsigned long once_only;
35
36 pr_warn("kAFS: AFS vnode with undefined type %u\n",
37 vnode->status.type);
38 pr_warn("kAFS: A=%d m=%o s=%llx v=%llx\n",
39 vnode->status.abort_code,
40 vnode->status.mode,
41 vnode->status.size,
42 vnode->status.data_version);
43 pr_warn("kAFS: vnode %llx:%llx:%x\n",
44 vnode->fid.vid,
45 vnode->fid.vnode,
46 vnode->fid.unique);
47 if (parent_vnode)
48 pr_warn("kAFS: dir %llx:%llx:%x\n",
49 parent_vnode->fid.vid,
50 parent_vnode->fid.vnode,
51 parent_vnode->fid.unique);
52
53 if (!test_and_set_bit(0, &once_only))
54 dump_stack();
55}
56
32/* 57/*
33 * Initialise an inode from the vnode status. 58 * Initialise an inode from the vnode status.
34 */ 59 */
35static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key) 60static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key,
61 struct afs_vnode *parent_vnode)
36{ 62{
37 struct inode *inode = AFS_VNODE_TO_I(vnode); 63 struct inode *inode = AFS_VNODE_TO_I(vnode);
38 64
@@ -80,7 +106,7 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key)
80 inode_nohighmem(inode); 106 inode_nohighmem(inode);
81 break; 107 break;
82 default: 108 default:
83 printk("kAFS: AFS vnode with undefined type\n"); 109 dump_vnode(vnode, parent_vnode);
84 read_sequnlock_excl(&vnode->cb_lock); 110 read_sequnlock_excl(&vnode->cb_lock);
85 return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type); 111 return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type);
86 } 112 }
@@ -270,7 +296,8 @@ static void afs_get_inode_cache(struct afs_vnode *vnode)
270 */ 296 */
271struct inode *afs_iget(struct super_block *sb, struct key *key, 297struct inode *afs_iget(struct super_block *sb, struct key *key,
272 struct afs_fid *fid, struct afs_file_status *status, 298 struct afs_fid *fid, struct afs_file_status *status,
273 struct afs_callback *cb, struct afs_cb_interest *cbi) 299 struct afs_callback *cb, struct afs_cb_interest *cbi,
300 struct afs_vnode *parent_vnode)
274{ 301{
275 struct afs_iget_data data = { .fid = *fid }; 302 struct afs_iget_data data = { .fid = *fid };
276 struct afs_super_info *as; 303 struct afs_super_info *as;
@@ -327,7 +354,7 @@ struct inode *afs_iget(struct super_block *sb, struct key *key,
327 vnode->cb_expires_at += ktime_get_real_seconds(); 354 vnode->cb_expires_at += ktime_get_real_seconds();
328 } 355 }
329 356
330 ret = afs_inode_init_from_status(vnode, key); 357 ret = afs_inode_init_from_status(vnode, key, parent_vnode);
331 if (ret < 0) 358 if (ret < 0)
332 goto bad_inode; 359 goto bad_inode;
333 360
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 91204e1428f2..585a5952f608 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -993,7 +993,8 @@ extern struct inode *afs_iget_pseudo_dir(struct super_block *, bool);
993extern struct inode *afs_iget(struct super_block *, struct key *, 993extern struct inode *afs_iget(struct super_block *, struct key *,
994 struct afs_fid *, struct afs_file_status *, 994 struct afs_fid *, struct afs_file_status *,
995 struct afs_callback *, 995 struct afs_callback *,
996 struct afs_cb_interest *); 996 struct afs_cb_interest *,
997 struct afs_vnode *);
997extern void afs_zap_data(struct afs_vnode *); 998extern void afs_zap_data(struct afs_vnode *);
998extern int afs_validate(struct afs_vnode *, struct key *); 999extern int afs_validate(struct afs_vnode *, struct key *);
999extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int); 1000extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int);
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 18334fa1a0d2..df5b0d8ef049 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -453,7 +453,7 @@ static int afs_fill_super(struct super_block *sb, struct afs_fs_context *ctx)
453 fid.vnode = 1; 453 fid.vnode = 1;
454 fid.vnode_hi = 0; 454 fid.vnode_hi = 0;
455 fid.unique = 1; 455 fid.unique = 1;
456 inode = afs_iget(sb, ctx->key, &fid, NULL, NULL, NULL); 456 inode = afs_iget(sb, ctx->key, &fid, NULL, NULL, NULL, NULL);
457 } 457 }
458 458
459 if (IS_ERR(inode)) 459 if (IS_ERR(inode))