lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW6Zr-ztojUtf9=g8Tj0pyS9cHLY0hnoJ85mFcSEZaAY3Q@mail.gmail.com>
Date:   Fri, 8 Dec 2023 10:38:30 -0800
From:   Song Liu <song@...nel.org>
To:     linan666@...weicloud.com
Cc:     linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        linan122@...wei.com, yukuai3@...wei.com, yi.zhang@...wei.com,
        houtao1@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH 1/2] md: factor out a helper exceed_read_errors() to check read_errors

On Sun, Dec 3, 2023 at 11:04 PM <linan666@...weicloud.com> wrote:
>
> From: Li Nan <linan122@...wei.com>
>
> Move check_decay_read_errors() to raid1-10.c and factor out a helper
> exceed_read_errors() to check if read_errors exceeds the limit, so that
> raid1 can also use it. There are no functional changes.
>
> Signed-off-by: Li Nan <linan122@...wei.com>
[...]
> +static inline bool exceed_read_errors(struct mddev *mddev, struct md_rdev *rdev)
> +{
> +       int max_read_errors = atomic_read(&mddev->max_corr_read_errors);
> +       int read_errors;
> +
> +       check_decay_read_errors(mddev, rdev);
> +       read_errors =  atomic_inc_return(&rdev->read_errors);
> +       if (read_errors > max_read_errors) {
> +               pr_notice("md:%s: %pg: Raid device exceeded read_error threshold [cur %d:max %d]\n",
> +                         mdname(mddev), rdev->bdev, read_errors, max_read_errors);
> +               pr_notice("md:%s: %pg: Failing raid device\n",
> +                         mdname(mddev), rdev->bdev);

This changed the print message from "md/raid10:" to "md:". We should
try to avoid
such changes. How about we do something like the following?

Thanks,
Song

diff --git i/drivers/md/raid1-10.c w/drivers/md/raid1-10.c
index 3f22edec70e7..6c0ef0fe6ba7 100644
--- i/drivers/md/raid1-10.c
+++ w/drivers/md/raid1-10.c
@@ -173,3 +173,10 @@ static inline void
raid1_prepare_flush_writes(struct bitmap *bitmap)
        else
                md_bitmap_unplug(bitmap);
 }
+
+static inline bool exceed_read_errors(struct mddev *mddev, struct
md_rdev *rdev)
+{
+       pr_notice("md/" RAID_1_10_NAME ":%s: %pg: Raid device ...\n",
+                 ...);
+       ...
+}
diff --git i/drivers/md/raid1.c w/drivers/md/raid1.c
index 9348f1709512..412e98d02a05 100644
--- i/drivers/md/raid1.c
+++ w/drivers/md/raid1.c
@@ -49,6 +49,7 @@ static void lower_barrier(struct r1conf *conf,
sector_t sector_nr);
 #define raid1_log(md, fmt, args...)                            \
        do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid1 "
fmt, ##args); } while (0)

+#define RAID_1_10_NAME "raid1"
 #include "raid1-10.c"

 #define START(node) ((node)->start)
diff --git i/drivers/md/raid10.c w/drivers/md/raid10.c
index 375c11d6159f..a1531b5f15e3 100644
--- i/drivers/md/raid10.c
+++ w/drivers/md/raid10.c
@@ -77,6 +77,8 @@ static void end_reshape(struct r10conf *conf);
 #define raid10_log(md, fmt, args...)                           \
        do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid10 "
fmt, ##args); } while (0)

+#define RAID_1_10_NAME "raid10"
+
 #include "raid1-10.c"

 #define NULL_CMD

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ