--- orig/fs/buffer.c 2003-01-07 16:09:44.000000000 -0700 +++ linux-2.4.20/fs/buffer.c 2003-01-07 16:09:44.000000000 -0700 @@ -221,6 +221,8 @@ continue; spin_unlock(&lru_list_lock); + conditional_schedule(); + write_locked_buffers(array, count); return -EAGAIN; } @@ -228,6 +230,7 @@ __refile_buffer(bh); } spin_unlock(&lru_list_lock); + conditional_schedule(); if (count) write_locked_buffers(array, count); @@ -280,9 +283,11 @@ spin_unlock(&lru_list_lock); wait_on_buffer (bh); put_bh(bh); + conditional_schedule(); return -EAGAIN; } spin_unlock(&lru_list_lock); + conditional_schedule(); return 0; } @@ -957,6 +962,7 @@ for (;;) { struct buffer_head * bh; + conditional_schedule(); bh = get_hash_table(dev, block, size); if (bh) { touch_buffer(bh); --- orig/mm/filemap.c 2003-01-07 16:09:44.000000000 -0700 +++ linux-2.4.20/mm/filemap.c 2003-01-07 16:09:44.000000000 -0700 @@ -409,11 +409,8 @@ } page_cache_release(page); - if (current->need_resched) { - __set_current_state(TASK_RUNNING); - schedule(); - } + conditional_schedule(); spin_lock(&pagecache_lock); goto restart; } @@ -704,6 +701,8 @@ struct page **hash = page_hash(mapping, offset); struct page *page; + conditional_schedule(); + spin_lock(&pagecache_lock); page = __find_page_nolock(mapping, offset, *hash); spin_unlock(&pagecache_lock);