ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ceph: add debugfs entries signifying new mount syntax support
@ 2021-08-25  5:50 Venky Shankar
  2021-08-25  5:50 ` [PATCH v2 1/2] libceph: export ceph_debugfs_dir for use in ceph.ko Venky Shankar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Venky Shankar @ 2021-08-25  5:50 UTC (permalink / raw)
  To: jlayton, pdonnell; +Cc: ceph-devel, Venky Shankar

v2:
 - export ceph_debugfs_dir
 - include v1 mount support debugfs entry
 - create debugfs entries under /<>/ceph/client_features dir

[This is based on top of new mount syntax series]

Patrick proposed the idea of having debugfs entries to signify if
kernel supports the new (v2) mount syntax. The primary use of this
information is to catch any bugs in the new syntax implementation.

This would be done as follows::

The userspace mount helper tries to mount using the new mount syntax
and fallsback to using old syntax if the mount using new syntax fails.
However, a bug in the new mount syntax implementation can silently
result in the mount helper switching to old syntax.

So, the debugfs entries can be relied upon by the mount helper to
check if the kernel supports the new mount syntax. Cases when the
mount using the new syntax fails, but the kernel does support the
new mount syntax, the mount helper could probably log before switching
to the old syntax (or fail the mount altogether when run in test mode).

Debugfs entries are as follows::

    /sys/kernel/debug/ceph/
    ....
    ....
    /sys/kernel/debug/ceph/client_features
    /sys/kernel/debug/ceph/client_features/v2_mount_syntax
    /sys/kernel/debug/ceph/client_features/v1_mount_syntax
    ....
    ....

Venky Shankar (2):
  libceph: export ceph_debugfs_dir for use in ceph.ko
  ceph: add debugfs entries for mount syntax support

 fs/ceph/debugfs.c            | 36 ++++++++++++++++++++++++++++++++++++
 fs/ceph/super.c              |  3 +++
 fs/ceph/super.h              |  2 ++
 include/linux/ceph/debugfs.h |  2 ++
 net/ceph/debugfs.c           |  3 ++-
 5 files changed, 45 insertions(+), 1 deletion(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] libceph: export ceph_debugfs_dir for use in ceph.ko
  2021-08-25  5:50 [PATCH v2 0/2] ceph: add debugfs entries signifying new mount syntax support Venky Shankar
@ 2021-08-25  5:50 ` Venky Shankar
  2021-08-25  5:50 ` [PATCH v2 2/2] ceph: add debugfs entries for mount syntax support Venky Shankar
  2021-08-25 17:27 ` [PATCH v2 0/2] ceph: add debugfs entries signifying new " Jeff Layton
  2 siblings, 0 replies; 6+ messages in thread
From: Venky Shankar @ 2021-08-25  5:50 UTC (permalink / raw)
  To: jlayton, pdonnell; +Cc: ceph-devel, Venky Shankar

Signed-off-by: Venky Shankar <vshankar@redhat.com>
---
 include/linux/ceph/debugfs.h | 2 ++
 net/ceph/debugfs.c           | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h
index 8b3a1a7a953a..464c7dfced87 100644
--- a/include/linux/ceph/debugfs.h
+++ b/include/linux/ceph/debugfs.h
@@ -4,6 +4,8 @@
 
 #include <linux/ceph/types.h>
 
+extern struct dentry *ceph_debugfs_dir;
+
 /* debugfs.c */
 extern void ceph_debugfs_init(void);
 extern void ceph_debugfs_cleanup(void);
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c
index 2110439f8a24..774e0c0fd18a 100644
--- a/net/ceph/debugfs.c
+++ b/net/ceph/debugfs.c
@@ -29,7 +29,8 @@
  *      .../bdi         - symlink to ../../bdi/something
  */
 
-static struct dentry *ceph_debugfs_dir;
+struct dentry *ceph_debugfs_dir;
+EXPORT_SYMBOL(ceph_debugfs_dir);
 
 static int monmap_show(struct seq_file *s, void *p)
 {
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] ceph: add debugfs entries for mount syntax support
  2021-08-25  5:50 [PATCH v2 0/2] ceph: add debugfs entries signifying new mount syntax support Venky Shankar
  2021-08-25  5:50 ` [PATCH v2 1/2] libceph: export ceph_debugfs_dir for use in ceph.ko Venky Shankar
@ 2021-08-25  5:50 ` Venky Shankar
  2021-09-21 14:01   ` Patrick Donnelly
  2021-08-25 17:27 ` [PATCH v2 0/2] ceph: add debugfs entries signifying new " Jeff Layton
  2 siblings, 1 reply; 6+ messages in thread
From: Venky Shankar @ 2021-08-25  5:50 UTC (permalink / raw)
  To: jlayton, pdonnell; +Cc: ceph-devel, Venky Shankar

Signed-off-by: Venky Shankar <vshankar@redhat.com>
---
 fs/ceph/debugfs.c | 36 ++++++++++++++++++++++++++++++++++++
 fs/ceph/super.c   |  3 +++
 fs/ceph/super.h   |  2 ++
 3 files changed, 41 insertions(+)

diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index 66989c880adb..f9ff70704423 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -22,6 +22,14 @@
 #include "mds_client.h"
 #include "metric.h"
 
+#define CLIENT_FEATURES_DIR_NAME   "client_features"
+#define MOUNT_DEVICE_V1_SUPPORT_FILE_NAME "v1_mount_syntax"
+#define MOUNT_DEVICE_V2_SUPPORT_FILE_NAME "v2_mount_syntax"
+
+static struct dentry *ceph_client_features_dir;
+static struct dentry *ceph_mount_device_v1_support;
+static struct dentry *ceph_mount_device_v2_support;
+
 static int mdsmap_show(struct seq_file *s, void *p)
 {
 	int i;
@@ -416,6 +424,26 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
 						  &status_fops);
 }
 
+void ceph_fs_debugfs_client_features_init(void)
+{
+	ceph_client_features_dir = debugfs_create_dir(CLIENT_FEATURES_DIR_NAME,
+						      ceph_debugfs_dir);
+	ceph_mount_device_v1_support = debugfs_create_file(MOUNT_DEVICE_V1_SUPPORT_FILE_NAME,
+							   0400,
+							   ceph_client_features_dir,
+							   NULL, NULL);
+	ceph_mount_device_v2_support = debugfs_create_file(MOUNT_DEVICE_V2_SUPPORT_FILE_NAME,
+							   0400,
+							   ceph_client_features_dir,
+							   NULL, NULL);
+}
+
+void ceph_fs_debugfs_client_features_cleanup(void)
+{
+	debugfs_remove(ceph_mount_device_v1_support);
+	debugfs_remove(ceph_mount_device_v2_support);
+	debugfs_remove(ceph_client_features_dir);
+}
 
 #else  /* CONFIG_DEBUG_FS */
 
@@ -427,4 +455,12 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
 {
 }
 
+void ceph_fs_debugfs_client_features_init(void)
+{
+}
+
+void ceph_fs_debugfs_client_features_cleanup(void)
+{
+}
+
 #endif  /* CONFIG_DEBUG_FS */
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 609ffc8c2d78..21d59deb042d 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -1404,6 +1404,8 @@ static int __init init_ceph(void)
 	if (ret)
 		goto out_caches;
 
+	ceph_fs_debugfs_client_features_init();
+
 	pr_info("loaded (mds proto %d)\n", CEPH_MDSC_PROTOCOL);
 
 	return 0;
@@ -1417,6 +1419,7 @@ static int __init init_ceph(void)
 static void __exit exit_ceph(void)
 {
 	dout("exit_ceph\n");
+	ceph_fs_debugfs_client_features_cleanup();
 	unregister_filesystem(&ceph_fs_type);
 	destroy_caches();
 }
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 8f71184b7c85..7e7b140cab5d 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -1231,6 +1231,8 @@ extern int ceph_locks_to_pagelist(struct ceph_filelock *flocks,
 /* debugfs.c */
 extern void ceph_fs_debugfs_init(struct ceph_fs_client *client);
 extern void ceph_fs_debugfs_cleanup(struct ceph_fs_client *client);
+extern void ceph_fs_debugfs_client_features_init(void);
+extern void ceph_fs_debugfs_client_features_cleanup(void);
 
 /* quota.c */
 static inline bool __ceph_has_any_quota(struct ceph_inode_info *ci)
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] ceph: add debugfs entries signifying new mount syntax support
  2021-08-25  5:50 [PATCH v2 0/2] ceph: add debugfs entries signifying new mount syntax support Venky Shankar
  2021-08-25  5:50 ` [PATCH v2 1/2] libceph: export ceph_debugfs_dir for use in ceph.ko Venky Shankar
  2021-08-25  5:50 ` [PATCH v2 2/2] ceph: add debugfs entries for mount syntax support Venky Shankar
@ 2021-08-25 17:27 ` Jeff Layton
  2021-08-26 13:17   ` Venky Shankar
  2 siblings, 1 reply; 6+ messages in thread
From: Jeff Layton @ 2021-08-25 17:27 UTC (permalink / raw)
  To: Venky Shankar, pdonnell; +Cc: ceph-devel

On Wed, 2021-08-25 at 11:20 +0530, Venky Shankar wrote:
> v2:
>  - export ceph_debugfs_dir
>  - include v1 mount support debugfs entry
>  - create debugfs entries under /<>/ceph/client_features dir
> 
> [This is based on top of new mount syntax series]
> 
> Patrick proposed the idea of having debugfs entries to signify if
> kernel supports the new (v2) mount syntax. The primary use of this
> information is to catch any bugs in the new syntax implementation.
> 
> This would be done as follows::
> 
> The userspace mount helper tries to mount using the new mount syntax
> and fallsback to using old syntax if the mount using new syntax fails.
> However, a bug in the new mount syntax implementation can silently
> result in the mount helper switching to old syntax.
> 
> So, the debugfs entries can be relied upon by the mount helper to
> check if the kernel supports the new mount syntax. Cases when the
> mount using the new syntax fails, but the kernel does support the
> new mount syntax, the mount helper could probably log before switching
> to the old syntax (or fail the mount altogether when run in test mode).
> 
> Debugfs entries are as follows::
> 
>     /sys/kernel/debug/ceph/
>     ....
>     ....
>     /sys/kernel/debug/ceph/client_features
>     /sys/kernel/debug/ceph/client_features/v2_mount_syntax
>     /sys/kernel/debug/ceph/client_features/v1_mount_syntax
>     ....
>     ....
> 

There are at least some scripts in teuthology that iterate over all of
the directories under /sys/kernel/debug/ceph/. Once you add this, some
of them may become confused.

I think we might want a more generic top-level directory for this sort
of thing, so that we only need to deal with the fallout once if we want
to put other generic info in there.

Maybe something like this?

    /sys/kernel/debug/ceph/meta/
    /sys/kernel/debug/ceph/meta/client_features

I'd be open to different names for "meta" too.

Also, do we really want to present this info via directories? I would
have thought something more like a "meta/mount_syntax" file there that
just prints "v1 v2" when read.

What's easier for scripting?

> Venky Shankar (2):
>   libceph: export ceph_debugfs_dir for use in ceph.ko
>   ceph: add debugfs entries for mount syntax support
> 
>  fs/ceph/debugfs.c            | 36 ++++++++++++++++++++++++++++++++++++
>  fs/ceph/super.c              |  3 +++
>  fs/ceph/super.h              |  2 ++
>  include/linux/ceph/debugfs.h |  2 ++
>  net/ceph/debugfs.c           |  3 ++-
>  5 files changed, 45 insertions(+), 1 deletion(-)
> 

-- 
Jeff Layton <jlayton@redhat.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] ceph: add debugfs entries signifying new mount syntax support
  2021-08-25 17:27 ` [PATCH v2 0/2] ceph: add debugfs entries signifying new " Jeff Layton
@ 2021-08-26 13:17   ` Venky Shankar
  0 siblings, 0 replies; 6+ messages in thread
From: Venky Shankar @ 2021-08-26 13:17 UTC (permalink / raw)
  To: Jeff Layton; +Cc: Patrick Donnelly, ceph-devel

On Wed, Aug 25, 2021 at 10:57 PM Jeff Layton <jlayton@redhat.com> wrote:
>
> On Wed, 2021-08-25 at 11:20 +0530, Venky Shankar wrote:
> > v2:
> >  - export ceph_debugfs_dir
> >  - include v1 mount support debugfs entry
> >  - create debugfs entries under /<>/ceph/client_features dir
> >
> > [This is based on top of new mount syntax series]
> >
> > Patrick proposed the idea of having debugfs entries to signify if
> > kernel supports the new (v2) mount syntax. The primary use of this
> > information is to catch any bugs in the new syntax implementation.
> >
> > This would be done as follows::
> >
> > The userspace mount helper tries to mount using the new mount syntax
> > and fallsback to using old syntax if the mount using new syntax fails.
> > However, a bug in the new mount syntax implementation can silently
> > result in the mount helper switching to old syntax.
> >
> > So, the debugfs entries can be relied upon by the mount helper to
> > check if the kernel supports the new mount syntax. Cases when the
> > mount using the new syntax fails, but the kernel does support the
> > new mount syntax, the mount helper could probably log before switching
> > to the old syntax (or fail the mount altogether when run in test mode).
> >
> > Debugfs entries are as follows::
> >
> >     /sys/kernel/debug/ceph/
> >     ....
> >     ....
> >     /sys/kernel/debug/ceph/client_features
> >     /sys/kernel/debug/ceph/client_features/v2_mount_syntax
> >     /sys/kernel/debug/ceph/client_features/v1_mount_syntax
> >     ....
> >     ....
> >
>
> There are at least some scripts in teuthology that iterate over all of
> the directories under /sys/kernel/debug/ceph/. Once you add this, some
> of them may become confused.
>
> I think we might want a more generic top-level directory for this sort
> of thing, so that we only need to deal with the fallout once if we want
> to put other generic info in there.

Hmm, makes sense.

>
> Maybe something like this?
>
>     /sys/kernel/debug/ceph/meta/
>     /sys/kernel/debug/ceph/meta/client_features
>
> I'd be open to different names for "meta" too.

meta, misc, info, ...

I do not have a strong opinion on the naming.

>
> Also, do we really want to present this info via directories? I would
> have thought something more like a "meta/mount_syntax" file there that
> just prints "v1 v2" when read.
>
> What's easier for scripting?

One reason I kept these as files was to not do parsing stuff and just
rely on stat().

>
> > Venky Shankar (2):
> >   libceph: export ceph_debugfs_dir for use in ceph.ko
> >   ceph: add debugfs entries for mount syntax support
> >
> >  fs/ceph/debugfs.c            | 36 ++++++++++++++++++++++++++++++++++++
> >  fs/ceph/super.c              |  3 +++
> >  fs/ceph/super.h              |  2 ++
> >  include/linux/ceph/debugfs.h |  2 ++
> >  net/ceph/debugfs.c           |  3 ++-
> >  5 files changed, 45 insertions(+), 1 deletion(-)
> >
>
> --
> Jeff Layton <jlayton@redhat.com>
>


-- 
Cheers,
Venky


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] ceph: add debugfs entries for mount syntax support
  2021-08-25  5:50 ` [PATCH v2 2/2] ceph: add debugfs entries for mount syntax support Venky Shankar
@ 2021-09-21 14:01   ` Patrick Donnelly
  0 siblings, 0 replies; 6+ messages in thread
From: Patrick Donnelly @ 2021-09-21 14:01 UTC (permalink / raw)
  To: Venky Shankar; +Cc: Jeff Layton, Ceph Development

On Wed, Aug 25, 2021 at 1:51 AM Venky Shankar <vshankar@redhat.com> wrote:
>
> Signed-off-by: Venky Shankar <vshankar@redhat.com>
> ---
>  fs/ceph/debugfs.c | 36 ++++++++++++++++++++++++++++++++++++
>  fs/ceph/super.c   |  3 +++
>  fs/ceph/super.h   |  2 ++
>  3 files changed, 41 insertions(+)
>
> diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
> index 66989c880adb..f9ff70704423 100644
> --- a/fs/ceph/debugfs.c
> +++ b/fs/ceph/debugfs.c
> @@ -22,6 +22,14 @@
>  #include "mds_client.h"
>  #include "metric.h"
>
> +#define CLIENT_FEATURES_DIR_NAME   "client_features"
> +#define MOUNT_DEVICE_V1_SUPPORT_FILE_NAME "v1_mount_syntax"
> +#define MOUNT_DEVICE_V2_SUPPORT_FILE_NAME "v2_mount_syntax"
> +
> +static struct dentry *ceph_client_features_dir;
> +static struct dentry *ceph_mount_device_v1_support;
> +static struct dentry *ceph_mount_device_v2_support;
> +
>  static int mdsmap_show(struct seq_file *s, void *p)
>  {
>         int i;
> @@ -416,6 +424,26 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
>                                                   &status_fops);
>  }
>
> +void ceph_fs_debugfs_client_features_init(void)
> +{
> +       ceph_client_features_dir = debugfs_create_dir(CLIENT_FEATURES_DIR_NAME,
> +                                                     ceph_debugfs_dir);
> +       ceph_mount_device_v1_support = debugfs_create_file(MOUNT_DEVICE_V1_SUPPORT_FILE_NAME,
> +                                                          0400,
> +                                                          ceph_client_features_dir,
> +                                                          NULL, NULL);
> +       ceph_mount_device_v2_support = debugfs_create_file(MOUNT_DEVICE_V2_SUPPORT_FILE_NAME,
> +                                                          0400,
> +                                                          ceph_client_features_dir,
> +                                                          NULL, NULL);
> +}

Makes sense to me. I can see having separate files for each syntax
type is expedient. If Jeff is cool with this then so am I.

-- 
Patrick Donnelly, Ph.D.
He / Him / His
Principal Software Engineer
Red Hat Sunnyvale, CA
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-21 14:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25  5:50 [PATCH v2 0/2] ceph: add debugfs entries signifying new mount syntax support Venky Shankar
2021-08-25  5:50 ` [PATCH v2 1/2] libceph: export ceph_debugfs_dir for use in ceph.ko Venky Shankar
2021-08-25  5:50 ` [PATCH v2 2/2] ceph: add debugfs entries for mount syntax support Venky Shankar
2021-09-21 14:01   ` Patrick Donnelly
2021-08-25 17:27 ` [PATCH v2 0/2] ceph: add debugfs entries signifying new " Jeff Layton
2021-08-26 13:17   ` Venky Shankar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).