bcachefs: Don't try to delete stripes when RO

We weren't checking for errors when trying to delet stripes, which meant
ec_stripe_delete_work() would spin trying to delete the same stripe over
and over.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2019-07-10 16:04:58 -04:00 committed by Kent Overstreet
parent f57a6a5d41
commit 97fd13ad76
2 changed files with 6 additions and 2 deletions

View File

@ -626,7 +626,8 @@ void bch2_stripes_heap_update(struct bch_fs *c,
bch2_stripes_heap_insert(c, m, idx);
}
if (stripe_idx_to_delete(c) >= 0)
if (stripe_idx_to_delete(c) >= 0 &&
!percpu_ref_is_dying(&c->writes))
schedule_work(&c->ec_stripe_delete_work);
}
@ -684,7 +685,8 @@ static void ec_stripe_delete_work(struct work_struct *work)
if (idx < 0)
break;
ec_stripe_delete(c, idx);
if (ec_stripe_delete(c, idx))
break;
}
mutex_unlock(&c->ec_stripe_create_lock);

View File

@ -366,6 +366,8 @@ static int bch2_fs_read_write_late(struct bch_fs *c)
schedule_delayed_work(&c->pd_controllers_update, 5 * HZ);
schedule_work(&c->ec_stripe_delete_work);
return 0;
}