fs: dlm: remove DLM_LSFL_FS from uapi
authorAlexander Aring <aahringo@redhat.com>
Mon, 15 Aug 2022 19:43:25 +0000 (15:43 -0400)
committerDavid Teigland <teigland@redhat.com>
Tue, 23 Aug 2022 19:54:54 +0000 (14:54 -0500)
The DLM_LSFL_FS flag is set in lockspaces created directly
for a kernel user, as opposed to those lockspaces created
for user space applications.  The user space libdlm allowed
this flag to be set for lockspaces created from user space,
but then used by a kernel user.  No kernel user has ever
used this method, so remove the ability to do it.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
drivers/md/md-cluster.c
fs/dlm/lockspace.c
fs/dlm/lockspace.h
fs/dlm/user.c
fs/gfs2/lock_dlm.c
fs/ocfs2/stack_user.c
include/linux/dlm.h
include/uapi/linux/dlm.h

index 742b2349fea34abd448cd0425b0a028177b10daf..10e0c5381d01b719a621d3ee42e70dd739309586 100644 (file)
@@ -876,8 +876,8 @@ static int join(struct mddev *mddev, int nodes)
        memset(str, 0, 64);
        sprintf(str, "%pU", mddev->uuid);
        ret = dlm_new_lockspace(str, mddev->bitmap_info.cluster_name,
-                               DLM_LSFL_FS, LVB_SIZE,
-                               &md_ls_ops, mddev, &ops_rv, &cinfo->lockspace);
+                               0, LVB_SIZE, &md_ls_ops, mddev,
+                               &ops_rv, &cinfo->lockspace);
        if (ret)
                goto err;
        wait_for_completion(&cinfo->completion);
index 41a6504cfab54d410e96600fdd32a8318e92569e..bae050df7abff63d62073b6df50a56a1e976f64f 100644 (file)
@@ -703,10 +703,11 @@ static int new_lockspace(const char *name, const char *cluster,
        return error;
 }
 
-int dlm_new_lockspace(const char *name, const char *cluster,
-                     uint32_t flags, int lvblen,
-                     const struct dlm_lockspace_ops *ops, void *ops_arg,
-                     int *ops_result, dlm_lockspace_t **lockspace)
+static int __dlm_new_lockspace(const char *name, const char *cluster,
+                              uint32_t flags, int lvblen,
+                              const struct dlm_lockspace_ops *ops,
+                              void *ops_arg, int *ops_result,
+                              dlm_lockspace_t **lockspace)
 {
        int error = 0;
 
@@ -732,6 +733,25 @@ int dlm_new_lockspace(const char *name, const char *cluster,
        return error;
 }
 
+int dlm_new_lockspace(const char *name, const char *cluster, uint32_t flags,
+                     int lvblen, const struct dlm_lockspace_ops *ops,
+                     void *ops_arg, int *ops_result,
+                     dlm_lockspace_t **lockspace)
+{
+       return __dlm_new_lockspace(name, cluster, flags | DLM_LSFL_FS, lvblen,
+                                  ops, ops_arg, ops_result, lockspace);
+}
+
+int dlm_new_user_lockspace(const char *name, const char *cluster,
+                          uint32_t flags, int lvblen,
+                          const struct dlm_lockspace_ops *ops,
+                          void *ops_arg, int *ops_result,
+                          dlm_lockspace_t **lockspace)
+{
+       return __dlm_new_lockspace(name, cluster, flags, lvblen, ops,
+                                  ops_arg, ops_result, lockspace);
+}
+
 static int lkb_idr_is_local(int id, void *p, void *data)
 {
        struct dlm_lkb *lkb = p;
index 306fc4f4ea15dbd88eb161b248b3d0f3c56611ce..03f4a4a3a871c6bab0cc92847db45048899d0fc5 100644 (file)
 #ifndef __LOCKSPACE_DOT_H__
 #define __LOCKSPACE_DOT_H__
 
+/* DLM_LSFL_FS
+ *   The lockspace user is in the kernel (i.e. filesystem).  Enables
+ *   direct bast/cast callbacks.
+ *
+ * internal lockspace flag - will be removed in future
+ */
+#define DLM_LSFL_FS    0x00000004
+
 int dlm_lockspace_init(void);
 void dlm_lockspace_exit(void);
 struct dlm_ls *dlm_find_lockspace_global(uint32_t id);
@@ -20,6 +28,11 @@ struct dlm_ls *dlm_find_lockspace_device(int minor);
 void dlm_put_lockspace(struct dlm_ls *ls);
 void dlm_stop_lockspaces(void);
 void dlm_stop_lockspaces_check(void);
+int dlm_new_user_lockspace(const char *name, const char *cluster,
+                          uint32_t flags, int lvblen,
+                          const struct dlm_lockspace_ops *ops,
+                          void *ops_arg, int *ops_result,
+                          dlm_lockspace_t **lockspace);
 
 #endif                         /* __LOCKSPACE_DOT_H__ */
 
index ca27f276a3f5ac9a8397582fb5879d07add3df71..c5d27bccc3dc44fb0c14da9514ffa30c51bfb2b9 100644 (file)
@@ -423,9 +423,9 @@ static int device_create_lockspace(struct dlm_lspace_params *params)
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
-       error = dlm_new_lockspace(params->name, dlm_config.ci_cluster_name, params->flags,
-                                 DLM_USER_LVB_LEN, NULL, NULL, NULL,
-                                 &lockspace);
+       error = dlm_new_user_lockspace(params->name, dlm_config.ci_cluster_name,
+                                      params->flags, DLM_USER_LVB_LEN, NULL,
+                                      NULL, NULL, &lockspace);
        if (error)
                return error;
 
index 6ce369b096d4b633964d617d22fa02163c142617..71911bf9ab34e6e972937e521fa137ca229abd30 100644 (file)
@@ -1302,7 +1302,7 @@ static int gdlm_mount(struct gfs2_sbd *sdp, const char *table)
        memcpy(cluster, table, strlen(table) - strlen(fsname));
        fsname++;
 
-       flags = DLM_LSFL_FS | DLM_LSFL_NEWEXCL;
+       flags = DLM_LSFL_NEWEXCL;
 
        /*
         * create/join lockspace
index a75e2b7d67f56839069368a491773c3710d73f45..64e6ddcfe329a85a329e587b83a7bd610ea18be2 100644 (file)
@@ -991,7 +991,7 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
        lc->oc_type = NO_CONTROLD;
 
        rc = dlm_new_lockspace(conn->cc_name, conn->cc_cluster_name,
-                              DLM_LSFL_FS | DLM_LSFL_NEWEXCL, DLM_LVB_LEN,
+                              DLM_LSFL_NEWEXCL, DLM_LVB_LEN,
                               &ocfs2_ls_ops, conn, &ops_rv, &fsdlm);
        if (rc) {
                if (rc == -EEXIST || rc == -EPROTO)
index ff951e9f6f2081a2e66eb88d9598155c1a67e38c..f5f55c2138ae10ba1bf4a482ea7af53aa74f3355 100644 (file)
@@ -56,9 +56,6 @@ struct dlm_lockspace_ops {
  * DLM_LSFL_TIMEWARN
  *   The dlm should emit netlink messages if locks have been waiting
  *   for a configurable amount of time.  (Unused.)
- * DLM_LSFL_FS
- *   The lockspace user is in the kernel (i.e. filesystem).  Enables
- *   direct bast/cast callbacks.
  * DLM_LSFL_NEWEXCL
  *   dlm_new_lockspace() should return -EEXIST if the lockspace exists.
  *
index 0d2eca28756762b4b56dc531842ccf8ad137bc85..1923f4f3b05e215af202dc44f223f82fd843b6ed 100644 (file)
@@ -69,7 +69,6 @@ struct dlm_lksb {
 /* dlm_new_lockspace() flags */
 
 #define DLM_LSFL_TIMEWARN      0x00000002
-#define DLM_LSFL_FS            0x00000004
 #define DLM_LSFL_NEWEXCL       0x00000008