Skip to content

Commit 3e1199d

Browse files
Milosz Tanskidhowells
Milosz Tanski
authored andcommitted
FS-Cache: refcount becomes corrupt under vma pressure.
In rare cases under heavy VMA pressure the ref count for a fscache cookie becomes corrupt. In this case we decrement ref count even if we fail before incrementing the refcount. FS-Cache: Assertion failed bnode-eca5f9c6/syslog 0 > 0 is false ------------[ cut here ]------------ kernel BUG at fs/fscache/cookie.c:519! invalid opcode: 0000 [#1] SMP Call Trace: [<ffffffffa01ba060>] __fscache_relinquish_cookie+0x50/0x220 [fscache] [<ffffffffa02d64ce>] ceph_fscache_unregister_inode_cookie+0x3e/0x50 [ceph] [<ffffffffa02ae1d3>] ceph_destroy_inode+0x33/0x200 [ceph] [<ffffffff811cf67e>] ? __fsnotify_inode_delete+0xe/0x10 [<ffffffff811a9e0c>] destroy_inode+0x3c/0x70 [<ffffffff811a9f51>] evict+0x111/0x180 [<ffffffff811aa763>] iput+0x103/0x190 [<ffffffff811a5de8>] __dentry_kill+0x1c8/0x220 [<ffffffff811a5f31>] shrink_dentry_list+0xf1/0x250 [<ffffffff811a762c>] prune_dcache_sb+0x4c/0x60 [<ffffffff811930af>] super_cache_scan+0xff/0x170 [<ffffffff8113d7a0>] shrink_slab_node+0x140/0x2c0 [<ffffffff8113f2da>] shrink_slab+0x8a/0x130 [<ffffffff81142572>] balance_pgdat+0x3e2/0x5d0 [<ffffffff811428ca>] kswapd+0x16a/0x4a0 [<ffffffff810a43f0>] ? __wake_up_sync+0x20/0x20 [<ffffffff81142760>] ? balance_pgdat+0x5d0/0x5d0 [<ffffffff81083e09>] kthread+0xc9/0xe0 [<ffffffff81010000>] ? ftrace_raw_event_xen_mmu_release_ptpage+0x70/0x90 [<ffffffff81083d40>] ? flush_kthread_worker+0xb0/0xb0 [<ffffffff8159f63c>] ret_from_fork+0x7c/0xb0 [<ffffffff81083d40>] ? flush_kthread_worker+0xb0/0xb0 RIP [<ffffffffa01b984b>] __fscache_disable_cookie+0x1db/0x210 [fscache] RSP <ffff8803bc85f9b8> ---[ end trace 254d0d7c74a01f25 ]--- Signed-off-by: Milosz Tanski <[email protected]> Signed-off-by: David Howells <[email protected]>
1 parent 920bce2 commit 3e1199d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/fscache/page.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ int __fscache_attr_changed(struct fscache_cookie *cookie)
198198
{
199199
struct fscache_operation *op;
200200
struct fscache_object *object;
201-
bool wake_cookie;
201+
bool wake_cookie = false;
202202

203203
_enter("%p", cookie);
204204

@@ -228,15 +228,16 @@ int __fscache_attr_changed(struct fscache_cookie *cookie)
228228

229229
__fscache_use_cookie(cookie);
230230
if (fscache_submit_exclusive_op(object, op) < 0)
231-
goto nobufs;
231+
goto nobufs_dec;
232232
spin_unlock(&cookie->lock);
233233
fscache_stat(&fscache_n_attr_changed_ok);
234234
fscache_put_operation(op);
235235
_leave(" = 0");
236236
return 0;
237237

238-
nobufs:
238+
nobufs_dec:
239239
wake_cookie = __fscache_unuse_cookie(cookie);
240+
nobufs:
240241
spin_unlock(&cookie->lock);
241242
kfree(op);
242243
if (wake_cookie)

0 commit comments

Comments
 (0)