Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ff7ba3a authored by Chris Mason's avatar Chris Mason
Browse files

Btrfs: don't look at bio flags after submit_bio



After callling submit_bio, the bio can be freed at any time.  The
btrfs submission thread helper was checking the bio flags too late,
which might not give the correct answer.

When CONFIG_DEBUG_PAGE_ALLOC is turned on, it can lead to oopsen.

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent a343832f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -256,13 +256,13 @@ loop_lock:
			wake_up(&fs_info->async_submit_wait);

		BUG_ON(atomic_read(&cur->bi_cnt) == 0);
		submit_bio(cur->bi_rw, cur);
		num_run++;
		batch_run++;

		if (bio_rw_flagged(cur, BIO_RW_SYNCIO))
			num_sync_run++;

		submit_bio(cur->bi_rw, cur);
		num_run++;
		batch_run++;
		if (need_resched()) {
			if (num_sync_run) {
				blk_run_backing_dev(bdi, NULL);