From: Akash B Date: Tue, 17 Jan 2023 15:51:19 +0000 (-0500) Subject: LU-16479 utils: Add option to manage degraded ZFS OST X-Git-Tag: 2.15.55~153 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F60%2F49660%2F6;p=fs%2Flustre-release.git LU-16479 utils: Add option to manage degraded ZFS OST Add new Lustre specific ZFS dataset user property to control/manage degraded ZFS OSTs, also modify the existing lustre/scripts/statechange-lustre.sh zedlet accordingly. Extend the same to mkfs.lustre utility to add this property by default when creating a new Lustre ZFS server. HPE-bug-id: LUS-11447 Test-Parameters: trivial fstype=zfs testlist=sanity Signed-off-by: Akash B Change-Id: I7032538f507c9ad20d5b109b54e3c3bab8138458 Reviewed-by: Dipak Ghosh Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49660 Reviewed-by: Brian Behlendorf Reviewed-by: Oleg Drokin Reviewed-by: Siddarth Raj Reviewed-by: Nikitas Angelinas Tested-by: Maloo Tested-by: jenkins --- diff --git a/lustre/include/uapi/linux/lustre/lustre_param.h b/lustre/include/uapi/linux/lustre/lustre_param.h index 8b91770..e9df823 100644 --- a/lustre/include/uapi/linux/lustre/lustre_param.h +++ b/lustre/include/uapi/linux/lustre/lustre_param.h @@ -70,6 +70,7 @@ #define PARAM_ID_UPCALL "identity_upcall=" /* identity upcall */ #define PARAM_ROOTSQUASH "root_squash=" /* root squash */ #define PARAM_NOSQUASHNIDS "nosquash_nids=" /* no squash nids */ +#define PARAM_AUTODEGRADE "autodegrade=" /* autodegrade OST's */ /* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */ #define PARAM_OST "ost." diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 58a57c2..ddb4adc 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -4385,6 +4385,10 @@ active_err: GOTO(end, rc); } + /* For handling degraded zfs OST */ + if (class_match_param(ptr, PARAM_AUTODEGRADE, NULL) == 0) + GOTO(end, rc); + LCONSOLE_WARN("Ignoring unrecognized param '%s'\n", ptr); end: diff --git a/lustre/scripts/statechange-lustre.sh b/lustre/scripts/statechange-lustre.sh index b06e490..f7b08dd 100755 --- a/lustre/scripts/statechange-lustre.sh +++ b/lustre/scripts/statechange-lustre.sh @@ -53,14 +53,17 @@ sync_degrade_state() local dataset="$1" local state="$2" local service=$($ZFS list -H -o lustre:svname ${dataset}) - - zed_log_msg "Lustre:sync_degrade_state pool:${dataset} degraded:${state}" + local autodegrade=$($ZFS get -rH -s local -t filesystem -o value \ + lustre:autodegrade ${dataset}) if [ -n "${service}" ] && [ "${service}" != "-" ] ; then local current=$($LCTL get_param -n obdfilter.${service}.degraded) - if [ "${current}" != "${state}" ] ; then + if [ "${current}" != "${state}" ] && + [ "${autodegrade}" == "on" ] ; then $LCTL set_param obdfilter.${service}.degraded=${state} + ds_state="pool:${dataset} degraded:${state}" + zed_log_msg "Lustre:sync_degrade_state $ds_state" fi fi } diff --git a/lustre/utils/mkfs_lustre.c b/lustre/utils/mkfs_lustre.c index 251b57b..94d35ce 100644 --- a/lustre/utils/mkfs_lustre.c +++ b/lustre/utils/mkfs_lustre.c @@ -765,6 +765,13 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop, } } + if (ldd->ldd_mount_type == LDD_MT_ZFS && + (ldd->ldd_flags & LDD_F_SV_TYPE_OST)) { + rc = add_param(ldd->ldd_params, PARAM_AUTODEGRADE, "on"); + if (rc) + return rc; + } + if (strlen(new_fsname) > 0) { if (!(mop->mo_flags & (MO_FORCEFORMAT | MO_RENAME)) && (!(ldd->ldd_flags & (LDD_F_VIRGIN | LDD_F_WRITECONF)))) {