From 8002a303736a47939e2c81fda67ed99d84e4bd7e Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Thu, 1 Oct 2015 08:45:00 +0200 Subject: [PATCH] if: remove kick_sem This was very old provisionary code from the first prototype in 2010. It was leading to the following deadlock on newer kernels: Oct 1 02:44:02 istore-test-bs1 kernel: : INFO: task umount:1040 blocked for more than 120 seconds. Oct 1 02:44:02 istore-test-bs1 kernel: : Tainted: G C 4.3.0-rc3-next-20150929+ #6 Oct 1 02:44:02 istore-test-bs1 kernel: : "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. Oct 1 02:44:02 istore-test-bs1 kernel: : umount D ffff880313164300 0 1040 919 0x00000000 Oct 1 02:44:02 istore-test-bs1 kernel: : ffff8801b3c979d8 0000000000000082 ffff880313164300 ffff8802fe8c6880 Oct 1 02:44:02 istore-test-bs1 kernel: : ffff8801b3c98000 ffff88030fec7650 7fffffffffffffff 0000000000000002 Oct 1 02:44:02 istore-test-bs1 kernel: : 0000000000000000 ffff8801b3c979f0 ffffffff8140917d 7fffffffffffffff Oct 1 02:44:02 istore-test-bs1 kernel: : Call Trace: Oct 1 02:44:02 istore-test-bs1 kernel: : [] schedule+0x76/0x8b Oct 1 02:44:02 istore-test-bs1 kernel: : [] schedule_timeout+0x24/0xe0 Oct 1 02:44:02 istore-test-bs1 kernel: : [] ? _raw_spin_unlock_irq+0x27/0x32 Oct 1 02:44:02 istore-test-bs1 kernel: : [] ? trace_hardirqs_on_caller+0x171/0x18d Oct 1 02:44:02 istore-test-bs1 kernel: : [] ? trace_hardirqs_on+0xd/0xf Oct 1 02:44:02 istore-test-bs1 kernel: : [] ? _raw_spin_unlock_irq+0x27/0x32 Oct 1 02:44:02 istore-test-bs1 kernel: : [] __down_common+0x8e/0xcf Oct 1 02:44:02 istore-test-bs1 kernel: : [] __down+0x18/0x1a Oct 1 02:44:02 istore-test-bs1 kernel: : [] down+0x28/0x38 Oct 1 02:44:02 istore-test-bs1 kernel: : [] if_make_request+0x2d4/0x93d [mars] Oct 1 02:44:02 istore-test-bs1 kernel: : [] ? _raw_spin_unlock+0x22/0x2c Oct 1 02:44:02 istore-test-bs1 kernel: : [] ? create_task_io_context+0x11b/0x12e Oct 1 02:44:02 istore-test-bs1 kernel: : [] ? create_io_context+0x51/0x66 Oct 1 02:44:02 istore-test-bs1 kernel: : [] generic_make_request+0x97/0xd6 Oct 1 02:44:02 istore-test-bs1 kernel: : [] submit_bio+0xeb/0xf6 Oct 1 02:44:02 istore-test-bs1 kernel: : [] _xfs_buf_ioapply+0x2c5/0x327 Oct 1 02:44:02 istore-test-bs1 kernel: : [] xfs_buf_submit+0x68/0x9b Oct 1 02:44:02 istore-test-bs1 kernel: : [] xlog_bdstrat+0x48/0x4f Oct 1 02:44:02 istore-test-bs1 kernel: : [] xlog_sync+0x269/0x339 Oct 1 02:44:02 istore-test-bs1 kernel: : [] xlog_state_release_iclog+0x90/0xa0 Oct 1 02:44:03 istore-test-bs1 kernel: : [] _xfs_log_force+0xfb/0x1bc Oct 1 02:44:03 istore-test-bs1 kernel: : [] xfs_log_force+0xf/0x30 Oct 1 02:44:03 istore-test-bs1 kernel: : [] xfs_fs_sync_fs+0x1d/0x3b Oct 1 02:44:03 istore-test-bs1 kernel: : [] sync_filesystem+0x7a/0x8e Oct 1 02:44:03 istore-test-bs1 kernel: : [] generic_shutdown_super+0x22/0xe5 Oct 1 02:44:03 istore-test-bs1 kernel: : [] kill_block_super+0x22/0x65 Oct 1 02:44:03 istore-test-bs1 kernel: : [] deactivate_locked_super+0x36/0x63 Oct 1 02:44:03 istore-test-bs1 kernel: : [] deactivate_super+0x31/0x34 Oct 1 02:44:03 istore-test-bs1 kernel: : [] cleanup_mnt+0x53/0x71 Oct 1 02:44:03 istore-test-bs1 kernel: : [] __cleanup_mnt+0xd/0xf Oct 1 02:44:03 istore-test-bs1 kernel: : [] task_work_run+0x62/0x8e Oct 1 02:44:03 istore-test-bs1 kernel: : [] prepare_exit_to_usermode+0x8c/0x9d Oct 1 02:44:03 istore-test-bs1 kernel: : [] syscall_return_slowpath+0x82/0x8c Oct 1 02:44:03 istore-test-bs1 kernel: : [] int_ret_from_sys_call+0x25/0x9f Oct 1 02:44:03 istore-test-bs1 kernel: : 1 lock held by umount/1040: Oct 1 02:44:03 istore-test-bs1 kernel: : #0: (&type->s_umount_key#24){++++++}, at: [] deactivate_super+0x29/0x34 --- kernel/mars_if.c | 9 --------- kernel/mars_if.h | 1 - 2 files changed, 10 deletions(-) diff --git a/kernel/mars_if.c b/kernel/mars_if.c index 495048fc..1388e587 100644 --- a/kernel/mars_if.c +++ b/kernel/mars_if.c @@ -254,7 +254,6 @@ void _if_unplug(struct if_input *input) might_sleep(); #endif - down(&input->kick_sem); spin_lock_irqsave(&input->req_lock, flags); if (!list_empty(&input->plug_anchor)) { // move over the whole list @@ -262,7 +261,6 @@ void _if_unplug(struct if_input *input) atomic_set(&input->plugged_count, 0); } spin_unlock_irqrestore(&input->req_lock, flags); - up(&input->kick_sem); while (!list_empty(&tmp_list)) { struct if_mref_aspect *mref_a; @@ -477,8 +475,6 @@ void if_make_request(struct request_queue *q, struct bio *bio) brick_msleep(100); } - down(&input->kick_sem); - bio_for_each_segment(bvec, bio, i) { // remove_this #ifdef HAS_BVEC_ITER @@ -573,7 +569,6 @@ void if_make_request(struct request_queue *q, struct bio *bio) mref = if_alloc_mref(brick); mref_a = if_mref_get_aspect(brick, mref); if (unlikely(!mref_a)) { - up(&input->kick_sem); goto err; } @@ -605,7 +600,6 @@ void if_make_request(struct request_queue *q, struct bio *bio) error = GENERIC_INPUT_CALL(input, mref_get, mref); if (unlikely(error < 0)) { - up(&input->kick_sem); goto err; } @@ -665,8 +659,6 @@ void if_make_request(struct request_queue *q, struct bio *bio) } // while bv_len > 0 } // foreach bvec - up(&input->kick_sem); - if (likely(!total_len)) { error = 0; } else { @@ -1178,7 +1170,6 @@ static int if_input_construct(struct if_input *input) INIT_LIST_HEAD(&input->hash_table[i].hash_anchor); } INIT_LIST_HEAD(&input->plug_anchor); - sema_init(&input->kick_sem, 1); spin_lock_init(&input->req_lock); atomic_set(&input->flying_count, 0); atomic_set(&input->read_flying_count, 0); diff --git a/kernel/mars_if.h b/kernel/mars_if.h index d8f79a24..49fd2bf1 100644 --- a/kernel/mars_if.h +++ b/kernel/mars_if.h @@ -85,7 +85,6 @@ struct if_input { atomic_t total_mref_read_count; atomic_t total_mref_write_count; spinlock_t req_lock; - struct semaphore kick_sem; struct if_hash_anchor *hash_table; };