Skip to contentSkip to conversation

BUG? a suspected race bug at cleaner_kthread()

DISCUSSION 홍신 shin hong 2 participants 2 messages Sep 3, 2009 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hello. I am reporting a suspected race bug at cleaner_kthread() in btrfs/disk-io.c of Linux 2.6.30.4.

I hope this report is helpful. Please examine the report and please let me know your opinion.

clear_ktherad() is spawned as a thread by open_ctree().

The function is finished if kthread_should_stop() or root->fs_info->closing becomes non-zero.

If clear_kthread() is finished before other thread invoke kthread_stop() for clear_kthread(),
the caller of kthread_stop() might have problem (waiting indefinitely).

It seems that close_ctree() set fs_info->closing and then kthread_stop(root->fs_info->cleaner_kthread) so that it might result this type of error.

Thank you

Sincerely
Shin Hong

#1 lore raw

2009/9/3 =ED=99=8D=EC=8B=A0 shin hong <[email protected]>:

Quoted 6 lines

Hello. I am reporting a suspected race bug at cleaner_kthread() in btrfs/disk-io.c of Linux 2.6.30.4.

I hope this report is helpful. Please examine the report and please let me know your opinion.

Quoted 8 lines

clear_ktherad() is spawned as a thread by open_ctree().

The function is finished if kthread_should_stop() or root->fs_info->closing becomes non-zero.

If clear_kthread() is finished before other thread invoke kthread_stop() for clear_kthread(),
the caller of kthread_stop() might have problem (waiting indefinitely=

).

Quoted 5 lines

It seems that close_ctree() set fs_info->closing and then kthread_stop(root->fs_info->cleaner_kthread) so that it might result this type of error.

You are right. Would you please send a patch.

Note: there is similar bug in transaction_kthread.

Yan, Zheng
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html