scst, persistent reservations: Fix a locking error

Avoid that a command like sg_raw -r256 /dev/sda 5e 04 00 00 00 00 00 20 00 00
triggers the following error messages on a kernel with PROVE_LOCKING enabled:

=====================================
[ BUG: bad unlock balance detected! ]
3.7.0-rc5-debug+ #1 Tainted: G           O
-------------------------------------
disk010_1/9985 is trying to release lock (&dev->dev_pr_mutex) at:
[<ffffffff814b742e>] mutex_unlock+0xe/0x10
but there are no more locks to release!

other info that might help us debug this:
no locks held by disk010_1/9985.

stack backtrace:
Pid: 9985, comm: disk010_1 Tainted: G           O 3.7.0-rc5-debug+ #1
Call Trace:
 [<ffffffff8109598e>] print_unlock_inbalance_bug+0xfe/0x110
 [<ffffffff81098bc6>] lock_release+0x1f6/0x260
 [<ffffffff814b734a>] __mutex_unlock_slowpath+0x9a/0x170
 [<ffffffff814b742e>] mutex_unlock+0xe/0x10
 [<ffffffffa02d7d0f>] scst_pr_write_unlock+0x4f/0xd0 [scst]
 [<ffffffffa02db83c>] scst_persistent_reserve_in_local+0x2cc/0x470 [scst]
 [<ffffffffa02d99bf>] scst_do_local_exec+0x15f/0x1c0 [scst]
 [<ffffffffa02e35d0>] scst_exec_check_blocking+0xd0/0x2c0 [scst]
 [<ffffffffa02e3955>] scst_exec_check_sn+0x195/0x2f0 [scst]
 [<ffffffffa02e5249>] scst_process_active_cmd+0x549/0x780 [scst]
 [<ffffffffa02e5509>] scst_do_job_active+0x89/0x1a0 [scst]
 [<ffffffffa02e5883>] scst_cmd_thread+0x183/0x310 [scst]
 [<ffffffff81063ccd>] kthread+0xed/0x100
 [<ffffffff814c2aac>] ret_from_fork+0x7c/0xb0

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4641 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-12-12 00:09:11 +00:00
parent ed9ac5b9de
commit e9ce622422

View File

@@ -2190,7 +2190,6 @@ static int scst_persistent_reserve_in_local(struct scst_cmd *cmd)
break;
default:
PRINT_ERROR("Unsupported action %x", action);
scst_pr_write_unlock(dev);
goto out_unsup_act;
}