aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cachefiles/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cachefiles/namei.c')
-rw-r--r--fs/cachefiles/namei.c102
1 files changed, 75 insertions, 27 deletions
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index 3df86952ca64..00a0cda8f47a 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -27,6 +27,76 @@ static int cachefiles_wait_bit(void *flags)
27 return 0; 27 return 0;
28} 28}
29 29
30#define CACHEFILES_KEYBUF_SIZE 512
31
32/*
33 * dump debugging info about an object
34 */
35static noinline
36void __cachefiles_printk_object(struct cachefiles_object *object,
37 const char *prefix,
38 u8 *keybuf)
39{
40 struct fscache_cookie *cookie;
41 unsigned keylen, loop;
42
43 printk(KERN_ERR "%sobject: OBJ%x\n",
44 prefix, object->fscache.debug_id);
45 printk(KERN_ERR "%sobjstate=%s fl=%lx swfl=%lx ev=%lx[%lx]\n",
46 prefix, fscache_object_states[object->fscache.state],
47 object->fscache.flags, object->fscache.work.flags,
48 object->fscache.events,
49 object->fscache.event_mask & FSCACHE_OBJECT_EVENTS_MASK);
50 printk(KERN_ERR "%sops=%u inp=%u exc=%u\n",
51 prefix, object->fscache.n_ops, object->fscache.n_in_progress,
52 object->fscache.n_exclusive);
53 printk(KERN_ERR "%sparent=%p\n",
54 prefix, object->fscache.parent);
55
56 spin_lock(&object->fscache.lock);
57 cookie = object->fscache.cookie;
58 if (cookie) {
59 printk(KERN_ERR "%scookie=%p [pr=%p nd=%p fl=%lx]\n",
60 prefix,
61 object->fscache.cookie,
62 object->fscache.cookie->parent,
63 object->fscache.cookie->netfs_data,
64 object->fscache.cookie->flags);
65 if (keybuf)
66 keylen = cookie->def->get_key(cookie->netfs_data, keybuf,
67 CACHEFILES_KEYBUF_SIZE);
68 else
69 keylen = 0;
70 } else {
71 printk(KERN_ERR "%scookie=NULL\n", prefix);
72 keylen = 0;
73 }
74 spin_unlock(&object->fscache.lock);
75
76 if (keylen) {
77 printk(KERN_ERR "%skey=[%u] '", prefix, keylen);
78 for (loop = 0; loop < keylen; loop++)
79 printk("%02x", keybuf[loop]);
80 printk("'\n");
81 }
82}
83
84/*
85 * dump debugging info about a pair of objects
86 */
87static noinline void cachefiles_printk_object(struct cachefiles_object *object,
88 struct cachefiles_object *xobject)
89{
90 u8 *keybuf;
91
92 keybuf = kmalloc(CACHEFILES_KEYBUF_SIZE, GFP_NOIO);
93 if (object)
94 __cachefiles_printk_object(object, "", keybuf);
95 if (xobject)
96 __cachefiles_printk_object(xobject, "x", keybuf);
97 kfree(keybuf);
98}
99
30/* 100/*
31 * record the fact that an object is now active 101 * record the fact that an object is now active
32 */ 102 */
@@ -42,8 +112,11 @@ static void cachefiles_mark_object_active(struct cachefiles_cache *cache,
42try_again: 112try_again:
43 write_lock(&cache->active_lock); 113 write_lock(&cache->active_lock);
44 114
45 if (test_and_set_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) 115 if (test_and_set_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) {
116 printk(KERN_ERR "CacheFiles: Error: Object already active\n");
117 cachefiles_printk_object(object, NULL);
46 BUG(); 118 BUG();
119 }
47 120
48 dentry = object->dentry; 121 dentry = object->dentry;
49 _p = &cache->active_nodes.rb_node; 122 _p = &cache->active_nodes.rb_node;
@@ -76,32 +149,7 @@ wait_for_old_object:
76 printk(KERN_ERR "\n"); 149 printk(KERN_ERR "\n");
77 printk(KERN_ERR "CacheFiles: Error:" 150 printk(KERN_ERR "CacheFiles: Error:"
78 " Unexpected object collision\n"); 151 " Unexpected object collision\n");
79 printk(KERN_ERR "xobject: OBJ%x\n", 152 cachefiles_printk_object(object, xobject);
80 xobject->fscache.debug_id);
81 printk(KERN_ERR "xobjstate=%s\n",
82 fscache_object_states[xobject->fscache.state]);
83 printk(KERN_ERR "xobjflags=%lx\n", xobject->fscache.flags);
84 printk(KERN_ERR "xobjevent=%lx [%lx]\n",
85 xobject->fscache.events, xobject->fscache.event_mask);
86 printk(KERN_ERR "xops=%u inp=%u exc=%u\n",
87 xobject->fscache.n_ops, xobject->fscache.n_in_progress,
88 xobject->fscache.n_exclusive);
89 printk(KERN_ERR "xcookie=%p [pr=%p nd=%p fl=%lx]\n",
90 xobject->fscache.cookie,
91 xobject->fscache.cookie->parent,
92 xobject->fscache.cookie->netfs_data,
93 xobject->fscache.cookie->flags);
94 printk(KERN_ERR "xparent=%p\n",
95 xobject->fscache.parent);
96 printk(KERN_ERR "object: OBJ%x\n",
97 object->fscache.debug_id);
98 printk(KERN_ERR "cookie=%p [pr=%p nd=%p fl=%lx]\n",
99 object->fscache.cookie,
100 object->fscache.cookie->parent,
101 object->fscache.cookie->netfs_data,
102 object->fscache.cookie->flags);
103 printk(KERN_ERR "parent=%p\n",
104 object->fscache.parent);
105 BUG(); 153 BUG();
106 } 154 }
107 atomic_inc(&xobject->usage); 155 atomic_inc(&xobject->usage);