From 3c17de6a840b2903d963f997ee65e55f55c5c75a Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Wed, 20 Mar 2024 09:20:52 +0100 Subject: [PATCH] LU-17431 mdt: add ioctl handler for mds Adding ioctl handler for mds allows managing dynamic nodemaps on MDS side. Test-Parameters: trivial Signed-off-by: Sebastien Buisson Change-Id: I6a68a17d3f12c799238a93242bbd385e6eeb1d0b Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54504 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_mds.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lustre/mdt/mdt_mds.c b/lustre/mdt/mdt_mds.c index e94fed6..3e58bed 100644 --- a/lustre/mdt/mdt_mds.c +++ b/lustre/mdt/mdt_mds.c @@ -52,6 +52,7 @@ #include "mdt_internal.h" #include #include +#include #include struct mds_device { @@ -656,9 +657,35 @@ static int mds_health_check(const struct lu_env *env, struct obd_device *obd) return rc != 0 ? 1 : 0; } +/* ioctls on obd dev */ +static int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len, + void *karg, void __user *uarg) +{ + struct obd_device *obd = exp->exp_obd; + struct obd_ioctl_data *data; + int rc = 0; + + ENTRY; + CDEBUG(D_IOCTL, "%s: cmd=%x len=%u karg=%pK uarg=%pK\n", + obd->obd_name, cmd, len, karg, uarg); + + data = karg; + /* we only support nodemap ioctls, for now */ + if (cmd != OBD_IOC_NODEMAP) + GOTO(out, rc = -EINVAL); + + rc = server_iocontrol_nodemap(obd, data, true); + if (rc) + GOTO(out, rc); + +out: + RETURN(rc); +} + static const struct obd_ops mds_obd_device_ops = { .o_owner = THIS_MODULE, .o_health_check = mds_health_check, + .o_iocontrol = mds_iocontrol, }; int mds_mod_init(void) -- 1.8.3.1