[Drbd-dev] schedule_timeout() called without setting task state first

Lars Ellenberg lars.ellenberg at linbit.com
Wed Jun 12 16:03:45 CEST 2019


On Wed, Jun 05, 2019 at 09:59:30AM -0600, David Butterfield wrote:
> The logic in new_or_recycle_send_buffer_page() calls schedule_timeout() without first setting
> the task state.  This will merely yield the processor but not actually wait.  Is that intended?
> 
> In drbd_main.c:
> 968 static void new_or_recycle_send_buffer_page(struct drbd_send_buffer *sbuf)
> 969 {
> 970         while (1) {
> 971                 struct page *page;
> 972                 int count = page_count(sbuf->page);
> 973
> 974                 BUG_ON(count == 0);
> 975                 if (count == 1)
> 976                         goto have_page;
> 977
> 978                 page = alloc_page(GFP_NOIO | __GFP_NORETRY | __GFP_NOWARN);
> 979                 if (page) {
> 980                         put_page(sbuf->page);
> 981                         sbuf->page = page;
> 982                         goto have_page;
> 983                 }
> 984
> 985                 //XXX Don't you need to set something like TASK_*INTERRUPTIBLE first?
> 986                 //XXX I think this just yields the processor but the thread remains runnable(?)
> 987                 schedule_timeout(HZ / 10);

was likely meant to be a schedule_timeout_uninterruptible(), yes.
Frequent typo, unfortunately.

	Lars



More information about the drbd-dev mailing list