Whamcloud - gitweb
LU-13308 mdc: support additional flags for OBD_IOC_CHLG_POLL ioctl 82/54982/3
authorJames Simmons <jsimmons@infradead.org>
Thu, 2 May 2024 01:31:53 +0000 (21:31 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 18 Nov 2024 17:43:33 +0000 (17:43 +0000)
Currently the mdc kernel code expects the flag argument for
OBD_IOC_CHLG_POLL ioctl to only be CHANGELOG_FLAG_FOLLOW. With
IPv6 we need to send a request to the kernel to present the NID
in the struct lnet_nid format since we can't just send large NIDs
to user land if we are using older tools.

With the newer user land tools we will be sending an expanded flag
which the current kernel changelog code can't handle. Rework the
code to support the new flag if we end up with the case of newer
user land tools and an older kernel. This code will also maintain
backwards compatiblity with the older user land tools.

Lustre-change: https://review.whamcloud.com/52361
Lustre-commit: 8320394725180b76e76f36b8a513f3c7bf11e65c

Change-Id: I26a80d30ce2ebf2075a2a8f510ff81d6b0b8d848
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52361
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Etienne AUJAMES <eaujames@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54982
Reviewed-by: Aurelien Degremont <adegremont@nvidia.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_ioctl.h
lustre/mdc/mdc_changelog.c
lustre/utils/liblustreapi_chlg.c

index bfd91cf..4a70e11 100644 (file)
@@ -220,7 +220,9 @@ enum obd_abort_recovery_flags {
 #define OBD_IOC_START_LFSCK    _IOWR('f', 230, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_STOP_LFSCK     _IOW('f', 231, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_QUERY_LFSCK    _IOR('f', 232, struct obd_ioctl_data)
-#define OBD_IOC_CHLG_POLL      _IOR('f', 233, long)
+#define OBD_IOC_CHLG_SET_FLAGS _IOR('f', 233, long)
+/* for compatibility issues with old apps */
+#define OBD_IOC_CHLG_POLL OBD_IOC_CHLG_SET_FLAGS
 /*     lustre/lustre_user.h    240-249 */
 /* was LIBCFS_IOC_DEBUG_MASK   _IOWR('f', 250, long) until 2.11 */
 
index aea492b..67d6576 100644 (file)
@@ -97,7 +97,7 @@ struct chlg_reader_state {
        struct list_head            crs_rec_queue;
        unsigned int                crs_last_catidx;
        unsigned int                crs_last_idx;
-       bool                        crs_poll;
+       unsigned int                crs_flags;
 };
 
 struct chlg_rec_entry {
@@ -340,7 +340,8 @@ again:
                CERROR("%s: fail to process llog: rc = %d\n", obd->obd_name, rc);
                GOTO(err_out, rc);
        }
-       if (!kthread_should_stop() && crs->crs_poll) {
+       if (!kthread_should_stop() &&
+           (crs->crs_flags & CHANGELOG_FLAG_FOLLOW)) {
                llog_cat_close(NULL, llh);
                llog_ctxt_put(ctx);
                class_decref(obd, "changelog", crs);
@@ -707,14 +708,14 @@ static unsigned int chlg_poll(struct file *file, poll_table *wait)
        return mask;
 }
 
-static long chlg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+static long chlg_ioctl(struct file *file, unsigned int cmd, unsigned long flags)
 {
        int rc;
 
        struct chlg_reader_state *crs = file->private_data;
        switch (cmd) {
        case OBD_IOC_CHLG_POLL:
-               crs->crs_poll = !!arg;
+               crs->crs_flags = flags;
                rc = 0;
                break;
        default:
index ebb2450..3fa0210 100644 (file)
@@ -153,7 +153,9 @@ int llapi_changelog_start(void **priv, enum changelog_send_flag flags,
 
        if (flags & CHANGELOG_FLAG_FOLLOW) {
                int rc;
-               rc = ioctl(cp->clp_fd, OBD_IOC_CHLG_POLL, 1);
+
+               rc = ioctl(cp->clp_fd, OBD_IOC_CHLG_SET_FLAGS,
+                          CHANGELOG_FLAG_FOLLOW);
                if (rc < 0)
                        llapi_err_noerrno(LLAPI_MSG_ERROR, "can't enable "
                                          "CHANGELOG_FLAG_FOLLOW");