Re: tgtd stuck when trying to delete a target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 07 Oct 2008 17:33:10 +0200
Doron Shoham <dorons@xxxxxxxxxxxx> wrote:

> Hi,
> 
> tgtd runs into a deadlock when trying to delete a target.
> 
> >From gdb:
> 
> #0  0x0000003c064074e5 in pthread_join () from /lib64/libpthread.so.0
> #1  0x000000000041b5ad in bs_thread_close (info=0x10651fd8) at bs.c:272
> #2  0x0000000000412697 in tgt_device_destroy (tid=<value optimized out>, lun=1, force=1) at target.c:587
> #3  0x00000000004128b4 in tgt_target_destroy (lld_no=0, tid=1) at target.c:1731
> #4  0x000000000040ff93 in tgt_mgmt (mtask=0x1064d580) at mgmt.c:85
> #5  0x0000000000410263 in mtask_handler (fd=11, events=<value optimized out>, data=<value optimized out>) at mgmt.c:441
> #6  0x000000000040f3c6 in main (argc=<value optimized out>, argv=<value optimized out>) at tgtd.c:236
> 
> The deadlock occurs in pthread_join () called by bs_thread_close (at bs.c line 272).
> 
> I believe that it is caused by commit: "handle pthread_create failure in backing store pthread code"
> (d97cd33a7244aed71d1b618ff3e6f826479d6163)
> 
> Tomo - can you please check it out?

Thanks,

I messed up bs_thread_close() in

commit 25ef48caa7bb2ed152b421c4f291d9bc44b91d53
Author: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
Date:   Sat Oct 4 19:09:51 2008 +0900

    ssc: use only one background thread

    It's the easiest way to avoid complicated locking for metadata access.

    Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>


Sorry about that. The attached patch works for me. Can you try?


diff --git a/usr/bs.c b/usr/bs.c
index e20189f..542ef55 100644
--- a/usr/bs.c
+++ b/usr/bs.c
@@ -268,7 +268,8 @@ void bs_thread_close(struct bs_thread_info *info)
 	info->stop = 1;
 	pthread_cond_broadcast(&info->pending_cond);
 
-	for (i = 0; i < info->worker_thread[i]; i++)
+	for (i = 0; info->worker_thread[i] &&
+		     i < ARRAY_SIZE(info->worker_thread); i++)
 		pthread_join(info->worker_thread[i], NULL);
 
 	pthread_cond_destroy(&info->finished_cond);


--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux