ceph: add 'noshare' mount option support
PATCH 1/1 ceph: add 'noshare' mount option support
From: Xiubo Li <[email protected]>
This will disable different mount points to share superblocks.
URL: https://tracker.ceph.com/issues/46883
--- fs/ceph/super.c | 12 ++++++++++++ fs/ceph/super.h | 1 + 2 files changed, 13 insertions(+)
fs/ceph/super.c +12 -0
@@ -159,6 +159,7 @@ enum { Opt_quotadf, Opt_copyfrom, Opt_wsync, + Opt_sharesb, }; enum ceph_recover_session_mode {
@@ -199,6 +200,7 @@ static const struct fs_parameter_spec ceph_mount_parameters[] = {fsparam_string ("source" , Opt_source),fsparam_u32 ("wsize" , Opt_wsize),fsparam_flag_no ("wsync" , Opt_wsync), + fsparam_flag_no ("sharesb", Opt_sharesb), {} };
@@ -455,6 +457,12 @@ static int ceph_parse_mount_param(struct fs_context *fc,else fsopt->flags |=CEPH_MOUNT_OPT_ASYNC_DIROPS ;break ; +case Opt_sharesb: +if (!result.negated) + fsopt->flags &= ~CEPH_MOUNT_OPT_NO_SHARE_SB ; +else + fsopt->flags |=CEPH_MOUNT_OPT_NO_SHARE_SB ; +break ;default :BUG (); }
@@ -1007,6 +1015,10 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)dout ("ceph_compare_super %p\n" , sb); +if (fsopt->flags &CEPH_MOUNT_OPT_NO_SHARE_SB || + other->mount_options->flags &CEPH_MOUNT_OPT_NO_SHARE_SB ) +return 0 ; +if (compare_mount_options (fsopt, opt, other)) {dout ("monitor(s)/mount options don't match\n" );return 0 ;
fs/ceph/super.h +1 -0
@@ -44,6 +44,7 @@#define CEPH_MOUNT_OPT_NOQUOTADF (1<<13)/* no root dir quota in statfs */ #define CEPH_MOUNT_OPT_NOCOPYFROM (1<<14)/* don't use RADOS 'copy-from' op */ #define CEPH_MOUNT_OPT_ASYNC_DIROPS (1<<15)/* allow async directory ops */ +#define CEPH_MOUNT_OPT_NO_SHARE_SB (1<<16)/* disable sharing the same superblock */ #define CEPH_MOUNT_OPT_DEFAULT \ (CEPH_MOUNT_OPT_DCACHE | \
Signature · 1 line
2.18.4
Quoted 4 lines · On Tue, 2020-10-13 at 18:31 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
This will disable different mount points to share superblocks.
Why? What problem does this solve? Don't make us dig through random tracker bugs to determine this, please. :)
Also, the subject mentions a "noshare" mount option, but the code below will be expecting sharesb/nosharesb.
Quoted 63 lines
URL: https://tracker.ceph.com/issues/46883
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/super.c | 12 ++++++++++++ fs/ceph/super.h | 1 + 2 files changed, 13 insertions(+)fs/ceph/super.c +12
-0@@ -159,6 +159,7 @@ enum { Opt_quotadf, Opt_copyfrom, Opt_wsync, + Opt_sharesb, }; enum ceph_recover_session_mode {@@ -199,6 +200,7 @@ static const struct fs_parameter_spec ceph_mount_parameters[] = {fsparam_string ("source" , Opt_source),fsparam_u32 ("wsize" , Opt_wsize),fsparam_flag_no ("wsync" , Opt_wsync), + fsparam_flag_no ("sharesb", Opt_sharesb), {} };@@ -455,6 +457,12 @@ static int ceph_parse_mount_param(struct fs_context *fc,else fsopt->flags |=CEPH_MOUNT_OPT_ASYNC_DIROPS ;break ; +case Opt_sharesb: +if (!result.negated) + fsopt->flags &= ~CEPH_MOUNT_OPT_NO_SHARE_SB ; +else + fsopt->flags |=CEPH_MOUNT_OPT_NO_SHARE_SB ; +break ;default :BUG (); }@@ -1007,6 +1015,10 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)dout ("ceph_compare_super %p\n" , sb); +if (fsopt->flags &CEPH_MOUNT_OPT_NO_SHARE_SB || + other->mount_options->flags &CEPH_MOUNT_OPT_NO_SHARE_SB ) +return 0 ; +if (compare_mount_options (fsopt, opt, other)) {dout ("monitor(s)/mount options don't match\n" );return 0 ;fs/ceph/super.h +1
-0@@ -44,6 +44,7 @@#define CEPH_MOUNT_OPT_NOQUOTADF (1<<13)/* no root dir quota in statfs */ #define CEPH_MOUNT_OPT_NOCOPYFROM (1<<14)/* don't use RADOS 'copy-from' op */ #define CEPH_MOUNT_OPT_ASYNC_DIROPS (1<<15)/* allow async directory ops */ +#define CEPH_MOUNT_OPT_NO_SHARE_SB (1<<16)/* disable sharing the same superblock */ #define CEPH_MOUNT_OPT_DEFAULT \ (CEPH_MOUNT_OPT_DCACHE | \
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 7 lines · Jeff Layton
Quoted 4 lines · On Tue, 2020-10-13 at 18:31 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
This will disable different mount points to share superblocks.
Why? What problem does this solve? Don't make us dig through random tracker bugs to determine this, please. :)
So, should we just mannully trigger to crash the kernel to get the coredump ?
Quoted 66 lines
Also, the subject mentions a "noshare" mount option, but the code below will be expecting sharesb/nosharesb.
Quoted 63 lines
URL: https://tracker.ceph.com/issues/46883
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/super.c | 12 ++++++++++++ fs/ceph/super.h | 1 + 2 files changed, 13 insertions(+)fs/ceph/super.c +12
-0@@ -159,6 +159,7 @@ enum { Opt_quotadf, Opt_copyfrom, Opt_wsync, + Opt_sharesb, }; enum ceph_recover_session_mode {@@ -199,6 +200,7 @@ static const struct fs_parameter_spec ceph_mount_parameters[] = {fsparam_string ("source" , Opt_source),fsparam_u32 ("wsize" , Opt_wsize),fsparam_flag_no ("wsync" , Opt_wsync), + fsparam_flag_no ("sharesb", Opt_sharesb), {} };@@ -455,6 +457,12 @@ static int ceph_parse_mount_param(struct fs_context *fc,else fsopt->flags |=CEPH_MOUNT_OPT_ASYNC_DIROPS ;break ; +case Opt_sharesb: +if (!result.negated) + fsopt->flags &= ~CEPH_MOUNT_OPT_NO_SHARE_SB ; +else + fsopt->flags |=CEPH_MOUNT_OPT_NO_SHARE_SB ; +break ;default :BUG (); }@@ -1007,6 +1015,10 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)dout ("ceph_compare_super %p\n" , sb); +if (fsopt->flags &CEPH_MOUNT_OPT_NO_SHARE_SB || + other->mount_options->flags &CEPH_MOUNT_OPT_NO_SHARE_SB ) +return 0 ; +if (compare_mount_options (fsopt, opt, other)) {dout ("monitor(s)/mount options don't match\n" );return 0 ;fs/ceph/super.h +1
-0@@ -44,6 +44,7 @@#define CEPH_MOUNT_OPT_NOQUOTADF (1<<13)/* no root dir quota in statfs */ #define CEPH_MOUNT_OPT_NOCOPYFROM (1<<14)/* don't use RADOS 'copy-from' op */ #define CEPH_MOUNT_OPT_ASYNC_DIROPS (1<<15)/* allow async directory ops */ +#define CEPH_MOUNT_OPT_NO_SHARE_SB (1<<16)/* disable sharing the same superblock */ #define CEPH_MOUNT_OPT_DEFAULT \ (CEPH_MOUNT_OPT_DCACHE | \
Quoted 4 lines · Xiubo Li
Quoted 3 lines · Jeff Layton
Quoted 2 lines · On Tue, 2020-10-13 at 18:31 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
This will disable different mount points to share superblocks.
Why? What problem does this solve? Don't make us dig through random tracker bugs to determine this, please. :)
So, should we just mannully trigger to crash the kernel to get the coredump ?
Looking at the tracker ticket, it looks like you want this to work around some issues with lazy unmounts in tests. If so, then sure, forcing a coredump might give you an indication of what happened.
In general though, this sounds like a hacky workaround for the problem in that tracker. I suggest we don't do this and work toward solving the real problems that caused the test writers to use lazy umounts in the first place...
Quoted 69 lines
Quoted 67 lines
Also, the subject mentions a "noshare" mount option, but the code below will be expecting sharesb/nosharesb.
Quoted 63 lines
URL: https://tracker.ceph.com/issues/46883
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/super.c | 12 ++++++++++++ fs/ceph/super.h | 1 + 2 files changed, 13 insertions(+)fs/ceph/super.c +12
-0@@ -159,6 +159,7 @@ enum { Opt_quotadf, Opt_copyfrom, Opt_wsync, + Opt_sharesb, }; enum ceph_recover_session_mode {@@ -199,6 +200,7 @@ static const struct fs_parameter_spec ceph_mount_parameters[] = {fsparam_string ("source" , Opt_source),fsparam_u32 ("wsize" , Opt_wsize),fsparam_flag_no ("wsync" , Opt_wsync), + fsparam_flag_no ("sharesb", Opt_sharesb), {} };@@ -455,6 +457,12 @@ static int ceph_parse_mount_param(struct fs_context *fc,else fsopt->flags |=CEPH_MOUNT_OPT_ASYNC_DIROPS ;break ; +case Opt_sharesb: +if (!result.negated) + fsopt->flags &= ~CEPH_MOUNT_OPT_NO_SHARE_SB ; +else + fsopt->flags |=CEPH_MOUNT_OPT_NO_SHARE_SB ; +break ;default :BUG (); }@@ -1007,6 +1015,10 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)dout ("ceph_compare_super %p\n" , sb); +if (fsopt->flags &CEPH_MOUNT_OPT_NO_SHARE_SB || + other->mount_options->flags &CEPH_MOUNT_OPT_NO_SHARE_SB ) +return 0 ; +if (compare_mount_options (fsopt, opt, other)) {dout ("monitor(s)/mount options don't match\n" );return 0 ;fs/ceph/super.h +1
-0@@ -44,6 +44,7 @@#define CEPH_MOUNT_OPT_NOQUOTADF (1<<13)/* no root dir quota in statfs */ #define CEPH_MOUNT_OPT_NOCOPYFROM (1<<14)/* don't use RADOS 'copy-from' op */ #define CEPH_MOUNT_OPT_ASYNC_DIROPS (1<<15)/* allow async directory ops */ +#define CEPH_MOUNT_OPT_NO_SHARE_SB (1<<16)/* disable sharing the same superblock */ #define CEPH_MOUNT_OPT_DEFAULT \ (CEPH_MOUNT_OPT_DCACHE | \
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 12 lines · Jeff Layton
Quoted 11 lines · Xiubo Li
Quoted 7 lines · Jeff Layton
Quoted 4 lines · On Tue, 2020-10-13 at 18:31 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
This will disable different mount points to share superblocks.
Why? What problem does this solve? Don't make us dig through random tracker bugs to determine this, please. :)
So, should we just mannully trigger to crash the kernel to get the coredump ?
Quoted 8 lines
Looking at the tracker ticket, it looks like you want this to work around some issues with lazy unmounts in tests. If so, then sure, forcing a coredump might give you an indication of what happened.
In general though, this sounds like a hacky workaround for the problem in that tracker. I suggest we don't do this and work toward solving the real problems that caused the test writers to use lazy umounts in the first place...
Okay, will try this.
Thanks.
Quoted 67 lines
Quoted 67 lines
Quoted 66 lines
Also, the subject mentions a "noshare" mount option, but the code below will be expecting sharesb/nosharesb.
Quoted 63 lines
URL: https://tracker.ceph.com/issues/46883
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/super.c | 12 ++++++++++++ fs/ceph/super.h | 1 + 2 files changed, 13 insertions(+)fs/ceph/super.c +12
-0@@ -159,6 +159,7 @@ enum { Opt_quotadf, Opt_copyfrom, Opt_wsync, + Opt_sharesb, }; enum ceph_recover_session_mode {@@ -199,6 +200,7 @@ static const struct fs_parameter_spec ceph_mount_parameters[] = {fsparam_string ("source" , Opt_source),fsparam_u32 ("wsize" , Opt_wsize),fsparam_flag_no ("wsync" , Opt_wsync), + fsparam_flag_no ("sharesb", Opt_sharesb), {} };@@ -455,6 +457,12 @@ static int ceph_parse_mount_param(struct fs_context *fc,else fsopt->flags |=CEPH_MOUNT_OPT_ASYNC_DIROPS ;break ; +case Opt_sharesb: +if (!result.negated) + fsopt->flags &= ~CEPH_MOUNT_OPT_NO_SHARE_SB ; +else + fsopt->flags |=CEPH_MOUNT_OPT_NO_SHARE_SB ; +break ;default :BUG (); }@@ -1007,6 +1015,10 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)dout ("ceph_compare_super %p\n" , sb); +if (fsopt->flags &CEPH_MOUNT_OPT_NO_SHARE_SB || + other->mount_options->flags &CEPH_MOUNT_OPT_NO_SHARE_SB ) +return 0 ; +if (compare_mount_options (fsopt, opt, other)) {dout ("monitor(s)/mount options don't match\n" );return 0 ;fs/ceph/super.h +1
-0@@ -44,6 +44,7 @@#define CEPH_MOUNT_OPT_NOQUOTADF (1<<13)/* no root dir quota in statfs */ #define CEPH_MOUNT_OPT_NOCOPYFROM (1<<14)/* don't use RADOS 'copy-from' op */ #define CEPH_MOUNT_OPT_ASYNC_DIROPS (1<<15)/* allow async directory ops */ +#define CEPH_MOUNT_OPT_NO_SHARE_SB (1<<16)/* disable sharing the same superblock */ #define CEPH_MOUNT_OPT_DEFAULT \ (CEPH_MOUNT_OPT_DCACHE | \