|
|
@@ -1749,7 +1749,22 @@ offload_to_thread:
|
|
|
queue_work(ic->wait_wq, &dio->work);
|
|
|
return;
|
|
|
}
|
|
|
+ if (journal_read_pos != NOT_FOUND)
|
|
|
+ dio->range.n_sectors = ic->sectors_per_block;
|
|
|
wait_and_add_new_range(ic, &dio->range);
|
|
|
+ /*
|
|
|
+ * wait_and_add_new_range drops the spinlock, so the journal
|
|
|
+ * may have been changed arbitrarily. We need to recheck.
|
|
|
+ * To simplify the code, we restrict I/O size to just one block.
|
|
|
+ */
|
|
|
+ if (journal_read_pos != NOT_FOUND) {
|
|
|
+ sector_t next_sector;
|
|
|
+ unsigned new_pos = find_journal_node(ic, dio->range.logical_sector, &next_sector);
|
|
|
+ if (unlikely(new_pos != journal_read_pos)) {
|
|
|
+ remove_range_unlocked(ic, &dio->range);
|
|
|
+ goto retry;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
spin_unlock_irq(&ic->endio_wait.lock);
|
|
|
|