unsigned i;
u64 b;
+ /*
+ * This conditional is kind of gross, but we may be called from the
+ * device add path, before the new device has actually been added to the
+ * running filesystem:
+ */
if (c) {
lockdep_assert_held(&c->sb_lock);
percpu_down_read(&c->usage_lock);
+ } else {
+ preempt_disable();
}
for (i = 0; i < layout->nr_superblocks; i++) {
if (c) {
spin_unlock(&c->journal.lock);
percpu_up_read(&c->usage_lock);
+ } else {
+ preempt_enable();
}
}
if (!journal_buckets)
goto err;
+ /*
+ * We may be called from the device add path, before the new device has
+ * actually been added to the running filesystem:
+ */
if (c)
spin_lock(&c->journal.lock);
long bucket;
if (new_fs) {
- percpu_down_read(&c->usage_lock);
bucket = bch2_bucket_alloc_new_fs(ca);
- percpu_up_read(&c->usage_lock);
-
if (bucket < 0) {
ret = -ENOSPC;
goto err;
if (c) {
percpu_down_read(&c->usage_lock);
spin_lock(&c->journal.lock);
+ } else {
+ preempt_disable();
}
__array_insert_item(ja->buckets, ja->nr, ja->last_idx);
if (c) {
spin_unlock(&c->journal.lock);
percpu_up_read(&c->usage_lock);
+ } else {
+ preempt_enable();
}
if (!new_fs)