Skip to content

Commit b134d68

Browse files
committed
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 <[email protected]>
1 parent 6c6c1d6 commit b134d68

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

fs/afs/dir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
776776
ti = afs_iget(dir->i_sb, key, &cookie->fids[i],
777777
&cookie->statuses[i],
778778
&cookie->callbacks[i],
779-
cbi);
779+
cbi, dvnode);
780780
if (i == 0) {
781781
inode = ti;
782782
} else {
@@ -1125,7 +1125,7 @@ static void afs_vnode_new_inode(struct afs_fs_cursor *fc,
11251125
return;
11261126

11271127
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);
11291129
if (IS_ERR(inode)) {
11301130
/* ENOMEM or EINTR at a really inconvenient time - just abandon
11311131
* the new directory on the server.

fs/afs/inode.c

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,36 @@ static const struct inode_operations afs_symlink_inode_operations = {
2929
.listxattr = afs_listxattr,
3030
};
3131

32+
static 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+
3257
/*
3358
* Initialise an inode from the vnode status.
3459
*/
35-
static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key)
60+
static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key,
61+
struct afs_vnode *parent_vnode)
3662
{
3763
struct inode *inode = AFS_VNODE_TO_I(vnode);
3864

@@ -80,7 +106,7 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key)
80106
inode_nohighmem(inode);
81107
break;
82108
default:
83-
printk("kAFS: AFS vnode with undefined type\n");
109+
dump_vnode(vnode, parent_vnode);
84110
read_sequnlock_excl(&vnode->cb_lock);
85111
return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type);
86112
}
@@ -270,7 +296,8 @@ static void afs_get_inode_cache(struct afs_vnode *vnode)
270296
*/
271297
struct inode *afs_iget(struct super_block *sb, struct key *key,
272298
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)
274301
{
275302
struct afs_iget_data data = { .fid = *fid };
276303
struct afs_super_info *as;
@@ -327,7 +354,7 @@ struct inode *afs_iget(struct super_block *sb, struct key *key,
327354
vnode->cb_expires_at += ktime_get_real_seconds();
328355
}
329356

330-
ret = afs_inode_init_from_status(vnode, key);
357+
ret = afs_inode_init_from_status(vnode, key, parent_vnode);
331358
if (ret < 0)
332359
goto bad_inode;
333360

fs/afs/internal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,8 @@ extern struct inode *afs_iget_pseudo_dir(struct super_block *, bool);
993993
extern struct inode *afs_iget(struct super_block *, struct key *,
994994
struct afs_fid *, struct afs_file_status *,
995995
struct afs_callback *,
996-
struct afs_cb_interest *);
996+
struct afs_cb_interest *,
997+
struct afs_vnode *);
997998
extern void afs_zap_data(struct afs_vnode *);
998999
extern int afs_validate(struct afs_vnode *, struct key *);
9991000
extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int);

fs/afs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ static int afs_fill_super(struct super_block *sb, struct afs_fs_context *ctx)
453453
fid.vnode = 1;
454454
fid.vnode_hi = 0;
455455
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);
457457
}
458458

459459
if (IS_ERR(inode))

0 commit comments

Comments
 (0)