spin_lock() needed ?
dwmw2 at infradead.org
Fri Nov 12 07:34:36 EST 2004
On Thu, 2004-11-11 at 21:44 +0300, Artem B. Bityuckiy wrote:
> So, I think we should hold the c->erase_completion_lock here. I mean:
> jffs2_add_physical_node_ref(c, raw);
> spin_lock(&c->erase_completion_lock); /* <--------- this */
> raw->next_in_ino = f->inocache->nodes;
> f->inocache->nodes = raw;
> spin_unlock(&c->erase_completion_lock); /* <--------- and this */
> Can anybody comment this please?
I think you're right -- if the first node in the per-inode list is
obsolete, then this can happen. README.Locking agrees with this
But I'm not sure the first node _can_ be obsolete. After all, nodes
become obsolete because we do something to make them so, and we can only
do that by writing a _new_ node... which ends up at the head of the
But it certainly wants a bloody great comment to that effect, at the
very least -- I suppose we might as well just take the lock.
In fact I suspect it may be possible to get an obsolete node at the head
of the list, immediately after booting. There's no real ordering on the
list at that point.
More information about the linux-mtd