Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cachefiles: Change %p in format strings to something else

Change plain %p in format strings in cachefiles code to something more
useful, since %p is now hashed before printing and thus no longer matches
the contents of an oops register dump.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
cc: linux-cachefs@redhat.com
Link: https://lore.kernel.org/r/160588476042.3465195.6837847445880367183.stgit@warthog.procyon.org.uk/ # rfc
Link: https://lore.kernel.org/r/162431200692.2908479.9253374494073633778.stgit@warthog.procyon.org.uk/

+28 -34
-2
fs/cachefiles/bind.c
··· 108 108 atomic_set(&fsdef->usage, 1); 109 109 fsdef->type = FSCACHE_COOKIE_TYPE_INDEX; 110 110 111 - _debug("- fsdef %p", fsdef); 112 - 113 111 /* look up the directory at the root of the cache */ 114 112 ret = kern_path(cache->rootdirname, LOOKUP_DIRECTORY, &path); 115 113 if (ret < 0)
+3 -3
fs/cachefiles/interface.c
··· 33 33 34 34 cache = container_of(_cache, struct cachefiles_cache, cache); 35 35 36 - _enter("{%s},%p,", cache->cache.identifier, cookie); 36 + _enter("{%s},%x,", cache->cache.identifier, cookie->debug_id); 37 37 38 38 lookup_data = kmalloc(sizeof(*lookup_data), cachefiles_gfp); 39 39 if (!lookup_data) ··· 96 96 lookup_data->key = key; 97 97 object->lookup_data = lookup_data; 98 98 99 - _leave(" = %p [%p]", &object->fscache, lookup_data); 99 + _leave(" = %x [%p]", object->fscache.debug_id, lookup_data); 100 100 return &object->fscache; 101 101 102 102 nomem_key: ··· 379 379 const struct cred *saved_cred; 380 380 int ret; 381 381 382 - _enter("%p", _cache); 382 + _enter("%s", _cache->tag->name); 383 383 384 384 cache = container_of(_cache, struct cachefiles_cache, cache); 385 385
+1 -1
fs/cachefiles/key.c
··· 150 150 key[len++] = 0; 151 151 key[len] = 0; 152 152 153 - _leave(" = %p %d", key, len); 153 + _leave(" = %s %d", key, len); 154 154 return key; 155 155 }
+22 -26
fs/cachefiles/namei.c
··· 39 39 pr_err("%sops=%u inp=%u exc=%u\n", 40 40 prefix, object->fscache.n_ops, object->fscache.n_in_progress, 41 41 object->fscache.n_exclusive); 42 - pr_err("%sparent=%p\n", 43 - prefix, object->fscache.parent); 42 + pr_err("%sparent=%x\n", 43 + prefix, object->fscache.parent ? object->fscache.parent->debug_id : 0); 44 44 45 45 spin_lock(&object->fscache.lock); 46 46 cookie = object->fscache.cookie; 47 47 if (cookie) { 48 - pr_err("%scookie=%p [pr=%p nd=%p fl=%lx]\n", 48 + pr_err("%scookie=%x [pr=%x nd=%p fl=%lx]\n", 49 49 prefix, 50 - object->fscache.cookie, 51 - object->fscache.cookie->parent, 52 - object->fscache.cookie->netfs_data, 53 - object->fscache.cookie->flags); 50 + cookie->debug_id, 51 + cookie->parent ? cookie->parent->debug_id : 0, 52 + cookie->netfs_data, 53 + cookie->flags); 54 54 pr_err("%skey=[%u] '", prefix, cookie->key_len); 55 55 k = (cookie->key_len <= sizeof(cookie->inline_key)) ? 56 56 cookie->inline_key : cookie->key; ··· 110 110 111 111 /* found the dentry for */ 112 112 found_dentry: 113 - kdebug("preemptive burial: OBJ%x [%s] %p", 113 + kdebug("preemptive burial: OBJ%x [%s] %pd", 114 114 object->fscache.debug_id, 115 115 object->fscache.state->name, 116 116 dentry); ··· 140 140 struct rb_node **_p, *_parent = NULL; 141 141 struct dentry *dentry; 142 142 143 - _enter(",%p", object); 143 + _enter(",%x", object->fscache.debug_id); 144 144 145 145 try_again: 146 146 write_lock(&cache->active_lock); ··· 298 298 299 299 _enter(",'%pd','%pd'", dir, rep); 300 300 301 - _debug("remove %p from %p", rep, dir); 302 - 303 301 /* non-directories can just be unlinked */ 304 302 if (!d_is_dir(rep)) { 305 303 _debug("unlink stale object"); ··· 444 446 struct dentry *dir; 445 447 int ret; 446 448 447 - _enter(",OBJ%x{%p}", object->fscache.debug_id, object->dentry); 449 + _enter(",OBJ%x{%pd}", object->fscache.debug_id, object->dentry); 448 450 449 451 ASSERT(object->dentry); 450 452 ASSERT(d_backing_inode(object->dentry)); ··· 497 499 const char *name; 498 500 int ret, nlen; 499 501 500 - _enter("OBJ%x{%p},OBJ%x,%s,", 502 + _enter("OBJ%x{%pd},OBJ%x,%s,", 501 503 parent->fscache.debug_id, parent->dentry, 502 504 object->fscache.debug_id, key); 503 505 ··· 540 542 541 543 inode = d_backing_inode(next); 542 544 trace_cachefiles_lookup(object, next, inode); 543 - _debug("next -> %p %s", next, inode ? "positive" : "negative"); 545 + _debug("next -> %pd %s", next, inode ? "positive" : "negative"); 544 546 545 547 if (!key) 546 548 object->new = !inode; ··· 576 578 } 577 579 ASSERT(d_backing_inode(next)); 578 580 579 - _debug("mkdir -> %p{%p{ino=%lu}}", 580 - next, d_backing_inode(next), d_backing_inode(next)->i_ino); 581 + _debug("mkdir -> %pd{ino=%lu}", 582 + next, d_backing_inode(next)->i_ino); 581 583 582 584 } else if (!d_can_lookup(next)) { 583 585 pr_err("inode %lu is not a directory\n", ··· 605 607 606 608 ASSERT(d_backing_inode(next)); 607 609 608 - _debug("create -> %p{%p{ino=%lu}}", 609 - next, d_backing_inode(next), d_backing_inode(next)->i_ino); 610 + _debug("create -> %pd{ino=%lu}", 611 + next, d_backing_inode(next)->i_ino); 610 612 611 613 } else if (!d_can_lookup(next) && 612 614 !d_is_reg(next) ··· 772 774 goto lookup_error; 773 775 } 774 776 775 - _debug("subdir -> %p %s", 777 + _debug("subdir -> %pd %s", 776 778 subdir, d_backing_inode(subdir) ? "positive" : "negative"); 777 779 778 780 /* we need to create the subdir if it doesn't exist yet */ ··· 798 800 } 799 801 ASSERT(d_backing_inode(subdir)); 800 802 801 - _debug("mkdir -> %p{%p{ino=%lu}}", 802 - subdir, 803 - d_backing_inode(subdir), 804 - d_backing_inode(subdir)->i_ino); 803 + _debug("mkdir -> %pd{ino=%lu}", 804 + subdir, d_backing_inode(subdir)->i_ino); 805 805 } 806 806 807 807 inode_unlock(d_inode(dir)); ··· 874 878 if (IS_ERR(victim)) 875 879 goto lookup_error; 876 880 877 - //_debug("victim -> %p %s", 881 + //_debug("victim -> %pd %s", 878 882 // victim, d_backing_inode(victim) ? "positive" : "negative"); 879 883 880 884 /* if the object is no longer there then we probably retired the object ··· 905 909 906 910 read_unlock(&cache->active_lock); 907 911 908 - //_leave(" = %p", victim); 912 + //_leave(" = %pd", victim); 909 913 return victim; 910 914 911 915 object_in_use: ··· 951 955 if (IS_ERR(victim)) 952 956 return PTR_ERR(victim); 953 957 954 - _debug("victim -> %p %s", 958 + _debug("victim -> %pd %s", 955 959 victim, d_backing_inode(victim) ? "positive" : "negative"); 956 960 957 961 /* okay... the victim is not being used so we can cull it
+2 -2
fs/cachefiles/xattr.c
··· 36 36 else 37 37 snprintf(type, 3, "%02x", object->fscache.cookie->def->type); 38 38 39 - _enter("%p{%s}", object, type); 39 + _enter("%x{%s}", object->fscache.debug_id, type); 40 40 41 41 /* attempt to install a type label directly */ 42 42 ret = vfs_setxattr(&init_user_ns, dentry, cachefiles_xattr_cache, type, ··· 134 134 if (!dentry) 135 135 return -ESTALE; 136 136 137 - _enter("%p,#%d", object, auxdata->len); 137 + _enter("%x,#%d", object->fscache.debug_id, auxdata->len); 138 138 139 139 /* attempt to install the cache metadata directly */ 140 140 _debug("SET #%u", auxdata->len);