* [PATCH] dm cache metadata: fix cmd_read_lock acquiring write lock
@ 2016-04-17 5:37 Ahmed Samy
2016-04-17 15:23 ` Mike Snitzer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmed Samy @ 2016-04-17 5:37 UTC (permalink / raw)
To: dm-devel; +Cc: Ahmed Samy, Mike Snitzer, stable
commit 9567366fefdd ("dm cache metadata: fix READ_LOCK macros and cleanup WRITE_LOCK macros")
seemed to use down_write instead of down_read in cmd_read_lock(), yet
releasing it with up_read() in READ_UNLOCK. Fix it.
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
---
drivers/md/dm-cache-metadata.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
index 65ce698..3970cda 100644
--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -894,9 +894,9 @@ static bool cmd_write_lock(struct dm_cache_metadata *cmd)
static bool cmd_read_lock(struct dm_cache_metadata *cmd)
{
- down_write(&cmd->root_lock);
+ down_read(&cmd->root_lock);
if (cmd->fail_io) {
- up_write(&cmd->root_lock);
+ up_read(&cmd->root_lock);
return false;
}
return true;
--
2.8.1.210.gb8b4d93
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: dm cache metadata: fix cmd_read_lock acquiring write lock
2016-04-17 5:37 [PATCH] dm cache metadata: fix cmd_read_lock acquiring write lock Ahmed Samy
@ 2016-04-17 15:23 ` Mike Snitzer
0 siblings, 0 replies; 2+ messages in thread
From: Mike Snitzer @ 2016-04-17 15:23 UTC (permalink / raw)
To: Ahmed Samy; +Cc: dm-devel, stable
On Sun, Apr 17 2016 at 1:37P -0400,
Ahmed Samy <f.fallen45@gmail.com> wrote:
> commit 9567366fefdd ("dm cache metadata: fix READ_LOCK macros and cleanup WRITE_LOCK macros")
> seemed to use down_write instead of down_read in cmd_read_lock(), yet
> releasing it with up_read() in READ_UNLOCK. Fix it.
>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Ugh, very frustrating -- I must've looked at this code 3 different times
to try to make sure I didn't have a thinko. And strangely sparse didn't
catch this locking bug (from cut-n-paste).
Anyway, thanks... I'll see if I can get this to Linus ASAP.
Mike
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-17 15:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-17 5:37 [PATCH] dm cache metadata: fix cmd_read_lock acquiring write lock Ahmed Samy
2016-04-17 15:23 ` Mike Snitzer
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).