From: Artem Bityutskiy <dedekind1@gmail.com>
To: Joel Reardon <joel@clambassador.com>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] UBI: add ubi_lnum_purge function to clear work queue for a lnum
Date: Sat, 19 May 2012 13:52:44 +0300 [thread overview]
Message-ID: <1337424764.2041.12.camel@koala> (raw)
In-Reply-To: <1337424475.2041.8.camel@koala>
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
On Sat, 2012-05-19 at 13:47 +0300, Artem Bityutskiy wrote:
> If you walk the list and read pointers, and someone else modifies them,
> you may be in trouble. You cannot traverse the list without the
> spinlock. And once you dropped the spinlock - you have to start over
> because your 'wrk' pointer may point to a non-existing object, because
> this object might have been already freed. This is why I added 2 loops.
Actually we ourselves free it in ->func() :-) I think it is saner to not
even use the list_for_each_entry(), but just take the element off the
head, unlock the spinlock use "container_of()", and call ->func(). So we
need only one loop, not 2.
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-05-19 10:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-15 7:44 [PATCH V2] UBI: add ubi_lnum_purge function to clear work queue for a lnum Joel Reardon
2012-05-15 11:40 ` Artem Bityutskiy
2012-05-19 9:46 ` Joel Reardon
2012-05-19 10:47 ` Artem Bityutskiy
2012-05-19 10:52 ` Artem Bityutskiy [this message]
2012-05-20 11:10 ` [PATCH V3] UBI: modify ubi_wl_flush " Joel Reardon
2012-05-20 19:27 ` [PATCH V4] " Joel Reardon
2012-05-21 11:41 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337424764.2041.12.camel@koala \
--to=dedekind1@gmail.com \
--cc=joel@clambassador.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).