Skip to content

Commit

Permalink
Btrfs: don't look at bio flags after submit_bio
Browse files Browse the repository at this point in the history
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: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Mar 15, 2010
1 parent a343832 commit 5ff7ba3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,13 @@ static noinline int run_scheduled_bios(struct btrfs_device *device)
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);
Expand Down

0 comments on commit 5ff7ba3

Please sign in to comment.