Commit dd69ac64 authored by Federico Vaga's avatar Federico Vaga

zio_change_current_trigger: change only if ti is not BUSY

If a trigger instance is busy, so you cannot change the trigger. You
must wait until data_done, or diasable the trigger before.
Signed-off-by: 's avatarFederico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent a6c7e2dd
......@@ -482,8 +482,16 @@ static int zio_change_current_trigger(struct zio_cset *cset, char *name)
struct zio_ti *ti, *ti_old = cset->ti;
int err;
/* FIXME get all necessary spinlock */
pr_debug("%s\n", __func__);
spin_lock(&cset->lock);
if (ti_old->flags & ZTI_BUSY) {
spin_unlock(&cset->lock);
return -EBUSY;
}
/* Set ti BUSY, so it cannot fire */
ti_old->flags |= ZTI_BUSY;
spin_unlock(&cset->lock);
if (strlen(name) > ZIO_OBJ_NAME_LEN)
return -EINVAL; /* name too long */
if (unlikely(strcmp(name, trig_old->head.name) == 0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment