dm integrity: limit the rate of error messages
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 6 Mar 2019 13:29:34 +0000 (08:29 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 13:35:28 +0000 (14:35 +0100)
commit 225557446856448039a9e495da37b72c20071ef2 upstream.

When using dm-integrity underneath md-raid, some tests with raid
auto-correction trigger large amounts of integrity failures - and all
these failures print an error message. These messages can bring the
system to a halt if the system is using serial console.

Fix this by limiting the rate of error messages - it improves the speed
of raid recovery and avoids the hang.

Fixes: 7eada909bfd7a ("dm: add integrity target")
Cc: stable@vger.kernel.org # v4.12+
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-integrity.c

index b10e4c5641ea37817c77dd8dfcb043c0710aa6a6..da4baea9cf836e76c82899b5c4c8ea77c745439e 100644 (file)
@@ -1276,8 +1276,8 @@ again:
                                                checksums_ptr - checksums, !dio->write ? TAG_CMP : TAG_WRITE);
                        if (unlikely(r)) {
                                if (r > 0) {
-                                       DMERR("Checksum failed at sector 0x%llx",
-                                             (unsigned long long)(sector - ((r + ic->tag_size - 1) / ic->tag_size)));
+                                       DMERR_LIMIT("Checksum failed at sector 0x%llx",
+                                                   (unsigned long long)(sector - ((r + ic->tag_size - 1) / ic->tag_size)));
                                        r = -EILSEQ;
                                        atomic64_inc(&ic->number_of_mismatches);
                                }
@@ -1469,8 +1469,8 @@ retry_kmap:
 
                                        integrity_sector_checksum(ic, logical_sector, mem + bv.bv_offset, checksums_onstack);
                                        if (unlikely(memcmp(checksums_onstack, journal_entry_tag(ic, je), ic->tag_size))) {
-                                               DMERR("Checksum failed when reading from journal, at sector 0x%llx",
-                                                     (unsigned long long)logical_sector);
+                                               DMERR_LIMIT("Checksum failed when reading from journal, at sector 0x%llx",
+                                                           (unsigned long long)logical_sector);
                                        }
                                }
 #endif