Whamcloud - gitweb
LU-15873 obd: skip checking read-only fs health 95/48095/5
authorBobi Jam <bobijam@whamcloud.com>
Tue, 3 Nov 2020 09:04:01 +0000 (17:04 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 1 Sep 2022 05:54:52 +0000 (05:54 +0000)
Health check upon read-only file system would fail and STONITH
ensues.

Add obd_device::obd_read_only to record read-only flag of the
obd_device. And skip checking the health of read-only devices.

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Ica83b9c871f7bee62cef6504deb0dcc32dd20afb
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-on: https://review.whamcloud.com/48095
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/obd.h
lustre/include/obd_class.h
lustre/obdclass/obd_sysfs.c
lustre/ofd/ofd_dev.c

index c9d1518..1e8df87 100644 (file)
@@ -635,7 +635,8 @@ struct obd_device {
                obd_no_ir:1,            /* no imperative recovery. */
                obd_process_conf:1,     /* device is processing mgs config */
                obd_checksum_dump:1,    /* dump pages upon cksum error */
-               obd_dynamic_nids:1;     /* Allow dynamic NIDs on device */
+               obd_dynamic_nids:1,     /* Allow dynamic NIDs on device */
+               obd_read_only:1;        /* device is read-only */
 #ifdef HAVE_SERVER_SUPPORT
        /* no committed-transno notification */
        unsigned long                   obd_no_transno:1;
index 4ca1dc6..35ae464 100644 (file)
@@ -39,6 +39,7 @@
 #include <lustre_lib.h>
 #include <uapi/linux/lustre/lustre_idl.h>
 #include <lprocfs_status.h>
+#include <dt_object.h>
 
 #define OBD_STATFS_NODELAY     0x0001  /* requests should be send without delay
                                         * and resends for avoid deadlocks */
@@ -558,6 +559,9 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
                        if (!IS_ERR(dev)) {
                                obd->obd_lu_dev = dev;
                                dev->ld_obd = obd;
+                               if (lu_device_is_dt(dev) &&
+                                   lu2dt_dev(dev)->dd_rdonly)
+                                       obd->obd_read_only = 1;
                                rc = 0;
                        } else
                                rc = PTR_ERR(dev);
index 5d9430a..b293e06 100644 (file)
@@ -252,6 +252,9 @@ health_check_show(struct kobject *kobj, struct attribute *attr, char *buf)
                if (obd->obd_stopping)
                        continue;
 
+               if (obd->obd_read_only)
+                       continue;
+
                class_incref(obd, __func__, current);
                read_unlock(&obd_dev_lock);
 
index 6b9ea6e..b230132 100644 (file)
@@ -203,6 +203,8 @@ static int ofd_stack_init(const struct lu_env *env,
        d = m->ofd_osd_exp->exp_obd->obd_lu_dev;
        LASSERT(d);
        m->ofd_osd = lu2dt_dev(d);
+       if (m->ofd_osd->dd_rdonly)
+               ofd_obd(m)->obd_read_only = 1;
 
        snprintf(info->fti_u.name, sizeof(info->fti_u.name),
                 "%s-osd", lustre_cfg_string(cfg, 0));