dm writecache: report invalid return from writecache_map helpers
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 27 Jul 2021 13:45:13 +0000 (09:45 -0400)
committerMike Snitzer <snitzer@redhat.com>
Tue, 10 Aug 2021 17:27:48 +0000 (13:27 -0400)
If some "writecache_map_*" function returns invalid state, it is a bug.
So, we should report it and not fail silently.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-writecache.c

index 64d7a79..e89868c 100644 (file)
@@ -1545,10 +1545,13 @@ done:
                return DM_MAPIO_SUBMITTED;
 
        case WC_MAP_ERROR:
-       default:
                wc_unlock(wc);
                bio_io_error(bio);
                return DM_MAPIO_SUBMITTED;
+
+       default:
+               BUG();
+               return -1;
        }
 }