dm cache metadata: fix cmd_read_lock() acquiring write lock
authorAhmed Samy <f.fallen45@gmail.com>
Sun, 17 Apr 2016 05:37:09 +0000 (05:37 +0000)
committerMike Snitzer <snitzer@redhat.com>
Sun, 17 Apr 2016 15:24:46 +0000 (11:24 -0400)
Commit 9567366fefdd ("dm cache metadata: fix READ_LOCK macros and
cleanup WRITE_LOCK macros") uses down_write() instead of down_read() in
cmd_read_lock(), yet up_read() is used to release the lock in
READ_UNLOCK().  Fix it.

Fixes: 9567366fefdd ("dm cache metadata: fix READ_LOCK macros and cleanup WRITE_LOCK macros")
Cc: stable@vger.kernel.org
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-cache-metadata.c

index 65ce6985f87a0a940aed6bf6bc9a70663a84c9fa..3970cda10080988887bfa07329241d94afd1b883 100644 (file)
@@ -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;