From 2f74550e9c9b4dfca2cf78ae1cd86a55be7fd72f Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Wed, 20 Mar 2024 09:24:30 +0100 Subject: [PATCH] LU-17431 ost: add ioctl handler for oss Adding ioctl handler for oss allows managing dynamic nodemaps on OSS side. Test-Parameters: trivial Signed-off-by: Sebastien Buisson Change-Id: I90f4c6988bed2ba721e366ae088983958d484a2f Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54505 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/ost/ost_handler.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index b9e8ff8..80fa454 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "ost_internal.h" @@ -411,12 +412,38 @@ static int ost_health_check(const struct lu_env *env, struct obd_device *obd) return rc != 0 ? 1 : 0; } +/* ioctls on obd dev */ +static int oss_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); +} + /* use obd ops to offer management infrastructure */ static const struct obd_ops ost_obd_ops = { .o_owner = THIS_MODULE, .o_setup = ost_setup, .o_cleanup = ost_cleanup, .o_health_check = ost_health_check, + .o_iocontrol = oss_iocontrol, }; static int __init ost_init(void) -- 1.8.3.1