Commit dcfae32f authored by David Howells's avatar David Howells

FS-Cache: Don't use spin_is_locked() in assertions

Under certain circumstances, spin_is_locked() is hardwired to 0 - even when the
code would normally be in a locked section where it should return 1.  This
means it cannot be used for an assertion that checks that a spinlock is locked.

Remove such usages from FS-Cache.

The following oops might otherwise be observed:

FS-Cache: Assertion failed
BUG: failure at fs/fscache/operation.c:270/fscache_start_operations()!
Kernel panic - not syncing: BUG!
CPU: 0 PID: 10 Comm: kworker/u2:1 Not tainted 3.10.0-rc1-00133-ge7ebb75 #2
Workqueue: fscache_operation fscache_op_work_func [fscache]
7f091c48 603c8947 7f090000 7f9b1361 7f25f080 00000001 7f26d440 7f091c90
60299eb8 7f091d90 602951c5 7f26d440 3000000008 7f091da0 7f091cc0 7f091cd0
00000007 00000007 00000006 7f091ae0 00000010 0000010e 7f9af330 7f091ae0
Call Trace:
7f091c88: [<60299eb8>] dump_stack+0x17/0x19
7f091c98: [<602951c5>] panic+0xf4/0x1e9
7f091d38: [<6002b10e>] set_signals+0x1e/0x40
7f091d58: [<6005b89e>] __wake_up+0x4e/0x70
7f091d98: [<7f9aa003>] fscache_start_operations+0x43/0x50 [fscache]
7f091da8: [<7f9aa1e3>] fscache_op_complete+0x1d3/0x220 [fscache]
7f091db8: [<60082985>] unlock_page+0x55/0x60
7f091de8: [<7fb25bb0>] cachefiles_read_copier+0x250/0x330 [cachefiles]
7f091e58: [<7f9ab03c>] fscache_op_work_func+0xac/0x120 [fscache]
7f091e88: [<6004d5b0>] process_one_work+0x250/0x3a0
7f091ef8: [<6004edc7>] worker_thread+0x177/0x2a0
7f091f38: [<6004ec50>] worker_thread+0x0/0x2a0
7f091f58: [<60054418>] kthread+0xd8/0xe0
7f091f68: [<6005bb27>] finish_task_switch.isra.64+0x37/0xa0
7f091fd8: [<600185cf>] new_thread_handler+0x8f/0xb0
Reported-by: default avatarMilosz Tanski <milosz@adfin.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Reviewed-and-tested-By: default avatarMilosz Tanski <milosz@adfin.com>
parent 1bb4b7f9
...@@ -260,15 +260,14 @@ void fscache_abort_object(struct fscache_object *object) ...@@ -260,15 +260,14 @@ void fscache_abort_object(struct fscache_object *object)
} }
/* /*
* jump start the operation processing on an object * Jump start the operation processing on an object. The caller must hold
* object->lock.
*/ */
void fscache_start_operations(struct fscache_object *object) void fscache_start_operations(struct fscache_object *object)
{ {
struct fscache_operation *op; struct fscache_operation *op;
bool stop = false; bool stop = false;
ASSERT(spin_is_locked(&object->lock));
while (!list_empty(&object->pending_ops) && !stop) { while (!list_empty(&object->pending_ops) && !stop) {
op = list_entry(object->pending_ops.next, op = list_entry(object->pending_ops.next,
struct fscache_operation, pend_link); struct fscache_operation, pend_link);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment