Re: [PATCH RESEND] klist: don't iterate over deleted entries

From: Alan Stern
Date: Mon Aug 25 2008 - 12:21:40 EST


On Mon, 25 Aug 2008, Tejun Heo wrote:

> A klist entry is kept on the list till all its current iterations are
> finished; however, a new iteration after deletion also iterates over
> deleted entries as long as their reference count stays above zero.
> This causes problems for cases where there are users which iterate
> over the list while synchronized against list manipulations and
> natuarally expect already deleted entries to not show up during
> iteration.
>
> This patch implements dead flag which gets set on deletion so that
> iteration can skip already deleted entries. The dead flag piggy backs
> on the lowest bit of knode->n_klist and only visible to klist
> implementation proper.

This seems like a reasonable sort of thing to do. I had considered
something like it in the past, but never bothered because it wasn't
needed at the time.

Alan Stern

--
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/