From d54114d0c54f7d037ad1009f6db7081124c4c9b8 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Tue, 3 Nov 2020 17:04:01 +0800 Subject: [PATCH] LU-15873 obd: skip checking read-only fs health 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 Change-Id: Ica83b9c871f7bee62cef6504deb0dcc32dd20afb Reviewed-by: Wang Shilong Reviewed-by: Andreas Dilger Reviewed-by: Li Xi Reviewed-on: https://review.whamcloud.com/48095 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: Oleg Drokin --- lustre/include/obd.h | 3 ++- lustre/include/obd_class.h | 4 ++++ lustre/obdclass/obd_sysfs.c | 3 +++ lustre/ofd/ofd_dev.c | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index c9d1518..1e8df87 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -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; diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 4ca1dc6..35ae464 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -39,6 +39,7 @@ #include #include #include +#include #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); diff --git a/lustre/obdclass/obd_sysfs.c b/lustre/obdclass/obd_sysfs.c index 5d9430a..b293e06 100644 --- a/lustre/obdclass/obd_sysfs.c +++ b/lustre/obdclass/obd_sysfs.c @@ -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); diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 6b9ea6e..b230132 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -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)); -- 1.8.3.1