RE: efi_pstore: question about how to remove create_sysfs_entry()from a write callback.

From: Seiji Aguchi
Date: Tue Aug 14 2012 - 17:38:24 EST


>
> Something like this (pseudo) may work:
>
> /* Loop until we have all entries in efivars. */ while (1) {
> variable_name = kzalloc(1024, GFP_KERNEL );
> spin_lock_irqsave(&efivars->lock);
> bool found = false;
> while (1) {
> ret = ops->get_next_variable(variable_name)
> if (ret == EFI_NOT_FOUND)
> break;
> if (!variable_is_already_present(variable, &efivars->list) {
> found = true;
> break;
> }
> }
> if (!found) {
> kfree(variable_name);
> break;
> }
> <Register in sysfs>
> }
>

Thanks. It seems to work.
I will create a patch based on your pseudo code above.

>
> If we are calling into pstore_info ops though from interrupt context, it seems we'll need to fix the immediate problem of updating the
> locking throughout to be interrupt safe.
>

I agree with you. It should be fixing. I will update the locking to be interrupt safe as well.

Seiji
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/