Message ID | 1544694488-19310-1-git-send-email-dongsheng.yang@easystack.cn (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3] libceph: introduce new option abort_on_full | expand |
On 12/13/18 5:48 PM, Dongsheng Yang wrote: > Introduce a new option abort_on_full, default to false. Then > we can get -ENOSPC when the pool is full, or reaches quota. > --- > fs/ceph/super.c | 2 +- > include/linux/ceph/libceph.h | 1 + > net/ceph/ceph_common.c | 10 ++++++++++ > 3 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/fs/ceph/super.c b/fs/ceph/super.c > index b5ecd6f..f97857a 100644 > --- a/fs/ceph/super.c > +++ b/fs/ceph/super.c > @@ -632,6 +632,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, > goto fail; > } > > + opt->flags |= CEPH_OPT_ABORTONFULL; According to your change log, it should not be set here. Thanks, CHengguang > fsc->client = ceph_create_client(opt, fsc); > if (IS_ERR(fsc->client)) { > err = PTR_ERR(fsc->client); > @@ -640,7 +641,6 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, > opt = NULL; /* fsc->client now owns this */ > > fsc->client->extra_mon_dispatch = extra_mon_dispatch; > - fsc->client->osdc.abort_on_full = true; > > if (!fsopt->mds_namespace) { > ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, > diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h > index 68bb09c..0fc40bb7 100644 > --- a/include/linux/ceph/libceph.h > +++ b/include/linux/ceph/libceph.h > @@ -35,6 +35,7 @@ > #define CEPH_OPT_NOMSGAUTH (1<<4) /* don't require msg signing feat */ > #define CEPH_OPT_TCP_NODELAY (1<<5) /* TCP_NODELAY on TCP sockets */ > #define CEPH_OPT_NOMSGSIGN (1<<6) /* don't sign msgs */ > +#define CEPH_OPT_ABORTONFULL (1<<7) /* abort request with -ENOSPC when pool is full */ > > #define CEPH_OPT_DEFAULT (CEPH_OPT_TCP_NODELAY) > > diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c > index 87afb9e..9932251 100644 > --- a/net/ceph/ceph_common.c > +++ b/net/ceph/ceph_common.c > @@ -255,6 +255,7 @@ enum { > Opt_nocephx_sign_messages, > Opt_tcp_nodelay, > Opt_notcp_nodelay, > + Opt_abort_on_full, > }; > > static match_table_t opt_tokens = { > @@ -280,6 +281,7 @@ enum { > {Opt_nocephx_sign_messages, "nocephx_sign_messages"}, > {Opt_tcp_nodelay, "tcp_nodelay"}, > {Opt_notcp_nodelay, "notcp_nodelay"}, > + {Opt_abort_on_full, "abort_on_full"}, > {-1, NULL} > }; > > @@ -535,6 +537,10 @@ struct ceph_options * > opt->flags &= ~CEPH_OPT_TCP_NODELAY; > break; > > + case Opt_abort_on_full: > + opt->flags |= CEPH_OPT_ABORTONFULL; > + break; > + > default: > BUG_ON(token); > } > @@ -574,6 +580,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) > seq_puts(m, "nocephx_sign_messages,"); > if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0) > seq_puts(m, "notcp_nodelay,"); > + if (opt->flags & CEPH_OPT_ABORTONFULL) > + seq_puts(m, "abort_on_full,"); > > if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) > seq_printf(m, "mount_timeout=%d,", > @@ -653,6 +661,8 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) > if (err < 0) > goto fail_monc; > > + if (ceph_test_opt(client, ABORTONFULL)) > + client->osdc.abort_on_full = true; > return client; > > fail_monc:
On Thu, Dec 13, 2018 at 10:49 AM Dongsheng Yang <dongsheng.yang@easystack.cn> wrote: > > Introduce a new option abort_on_full, default to false. Then > we can get -ENOSPC when the pool is full, or reaches quota. > --- > fs/ceph/super.c | 2 +- > include/linux/ceph/libceph.h | 1 + > net/ceph/ceph_common.c | 10 ++++++++++ > 3 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/fs/ceph/super.c b/fs/ceph/super.c > index b5ecd6f..f97857a 100644 > --- a/fs/ceph/super.c > +++ b/fs/ceph/super.c > @@ -632,6 +632,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, > goto fail; > } > > + opt->flags |= CEPH_OPT_ABORTONFULL; > fsc->client = ceph_create_client(opt, fsc); > if (IS_ERR(fsc->client)) { > err = PTR_ERR(fsc->client); > @@ -640,7 +641,6 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, > opt = NULL; /* fsc->client now owns this */ > > fsc->client->extra_mon_dispatch = extra_mon_dispatch; > - fsc->client->osdc.abort_on_full = true; Don't move it above ceph_create_client(), do ceph_set_opt here. > > if (!fsopt->mds_namespace) { > ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, > diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h > index 68bb09c..0fc40bb7 100644 > --- a/include/linux/ceph/libceph.h > +++ b/include/linux/ceph/libceph.h > @@ -35,6 +35,7 @@ > #define CEPH_OPT_NOMSGAUTH (1<<4) /* don't require msg signing feat */ > #define CEPH_OPT_TCP_NODELAY (1<<5) /* TCP_NODELAY on TCP sockets */ > #define CEPH_OPT_NOMSGSIGN (1<<6) /* don't sign msgs */ > +#define CEPH_OPT_ABORTONFULL (1<<7) /* abort request with -ENOSPC when pool is full */ Make it CEPH_OPT_ABORT_ON_FULL. > > #define CEPH_OPT_DEFAULT (CEPH_OPT_TCP_NODELAY) > > diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c > index 87afb9e..9932251 100644 > --- a/net/ceph/ceph_common.c > +++ b/net/ceph/ceph_common.c > @@ -255,6 +255,7 @@ enum { > Opt_nocephx_sign_messages, > Opt_tcp_nodelay, > Opt_notcp_nodelay, > + Opt_abort_on_full, > }; > > static match_table_t opt_tokens = { > @@ -280,6 +281,7 @@ enum { > {Opt_nocephx_sign_messages, "nocephx_sign_messages"}, > {Opt_tcp_nodelay, "tcp_nodelay"}, > {Opt_notcp_nodelay, "notcp_nodelay"}, > + {Opt_abort_on_full, "abort_on_full"}, > {-1, NULL} > }; > > @@ -535,6 +537,10 @@ struct ceph_options * > opt->flags &= ~CEPH_OPT_TCP_NODELAY; > break; > > + case Opt_abort_on_full: > + opt->flags |= CEPH_OPT_ABORTONFULL; > + break; > + > default: > BUG_ON(token); > } > @@ -574,6 +580,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) > seq_puts(m, "nocephx_sign_messages,"); > if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0) > seq_puts(m, "notcp_nodelay,"); > + if (opt->flags & CEPH_OPT_ABORTONFULL) > + seq_puts(m, "abort_on_full,"); > > if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) > seq_printf(m, "mount_timeout=%d,", > @@ -653,6 +661,8 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) > if (err < 0) > goto fail_monc; > > + if (ceph_test_opt(client, ABORTONFULL)) > + client->osdc.abort_on_full = true; Let's get rid of ceph_osd_client::abort_on_full. Replace it with ceph_test_opt in __submit_request() and ceph_osdc_abort_on_full(). Thanks, Ilya
On 12/13/2018 06:41 PM, cgxu519 wrote: > On 12/13/18 5:48 PM, Dongsheng Yang wrote: >> Introduce a new option abort_on_full, default to false. Then >> we can get -ENOSPC when the pool is full, or reaches quota. >> --- >> fs/ceph/super.c | 2 +- >> include/linux/ceph/libceph.h | 1 + >> net/ceph/ceph_common.c | 10 ++++++++++ >> 3 files changed, 12 insertions(+), 1 deletion(-) >> >> diff --git a/fs/ceph/super.c b/fs/ceph/super.c >> index b5ecd6f..f97857a 100644 >> --- a/fs/ceph/super.c >> +++ b/fs/ceph/super.c >> @@ -632,6 +632,7 @@ static struct ceph_fs_client >> *create_fs_client(struct ceph_mount_options *fsopt, >> goto fail; >> } >> + opt->flags |= CEPH_OPT_ABORTONFULL; > > According to your change log, it should not be set here. Do you mean "default to false"? No, the default to false mean the default in libceph is false, please take a look at CEPH_OPT_DEFAULT. But there are two user of libceph, cephfs and krbd. cephfs was always using abort_on_full, so set this flag in cephfs. Thax > > > Thanks, > CHengguang > >> fsc->client = ceph_create_client(opt, fsc); >> if (IS_ERR(fsc->client)) { >> err = PTR_ERR(fsc->client); >> @@ -640,7 +641,6 @@ static struct ceph_fs_client >> *create_fs_client(struct ceph_mount_options *fsopt, >> opt = NULL; /* fsc->client now owns this */ >> fsc->client->extra_mon_dispatch = extra_mon_dispatch; >> - fsc->client->osdc.abort_on_full = true; >> if (!fsopt->mds_namespace) { >> ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, >> diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h >> index 68bb09c..0fc40bb7 100644 >> --- a/include/linux/ceph/libceph.h >> +++ b/include/linux/ceph/libceph.h >> @@ -35,6 +35,7 @@ >> #define CEPH_OPT_NOMSGAUTH (1<<4) /* don't require msg signing >> feat */ >> #define CEPH_OPT_TCP_NODELAY (1<<5) /* TCP_NODELAY on TCP >> sockets */ >> #define CEPH_OPT_NOMSGSIGN (1<<6) /* don't sign msgs */ >> +#define CEPH_OPT_ABORTONFULL (1<<7) /* abort request with >> -ENOSPC when pool is full */ >> #define CEPH_OPT_DEFAULT (CEPH_OPT_TCP_NODELAY) >> diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c >> index 87afb9e..9932251 100644 >> --- a/net/ceph/ceph_common.c >> +++ b/net/ceph/ceph_common.c >> @@ -255,6 +255,7 @@ enum { >> Opt_nocephx_sign_messages, >> Opt_tcp_nodelay, >> Opt_notcp_nodelay, >> + Opt_abort_on_full, >> }; >> static match_table_t opt_tokens = { >> @@ -280,6 +281,7 @@ enum { >> {Opt_nocephx_sign_messages, "nocephx_sign_messages"}, >> {Opt_tcp_nodelay, "tcp_nodelay"}, >> {Opt_notcp_nodelay, "notcp_nodelay"}, >> + {Opt_abort_on_full, "abort_on_full"}, >> {-1, NULL} >> }; >> @@ -535,6 +537,10 @@ struct ceph_options * >> opt->flags &= ~CEPH_OPT_TCP_NODELAY; >> break; >> + case Opt_abort_on_full: >> + opt->flags |= CEPH_OPT_ABORTONFULL; >> + break; >> + >> default: >> BUG_ON(token); >> } >> @@ -574,6 +580,8 @@ int ceph_print_client_options(struct seq_file *m, >> struct ceph_client *client) >> seq_puts(m, "nocephx_sign_messages,"); >> if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0) >> seq_puts(m, "notcp_nodelay,"); >> + if (opt->flags & CEPH_OPT_ABORTONFULL) >> + seq_puts(m, "abort_on_full,"); >> if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) >> seq_printf(m, "mount_timeout=%d,", >> @@ -653,6 +661,8 @@ struct ceph_client *ceph_create_client(struct >> ceph_options *opt, void *private) >> if (err < 0) >> goto fail_monc; >> + if (ceph_test_opt(client, ABORTONFULL)) >> + client->osdc.abort_on_full = true; >> return client; >> fail_monc: > >
On 12/14/2018 03:45 AM, Ilya Dryomov wrote: > On Thu, Dec 13, 2018 at 10:49 AM Dongsheng Yang > <dongsheng.yang@easystack.cn> wrote: >> Introduce a new option abort_on_full, default to false. Then >> we can get -ENOSPC when the pool is full, or reaches quota. >> --- >> fs/ceph/super.c | 2 +- >> include/linux/ceph/libceph.h | 1 + >> net/ceph/ceph_common.c | 10 ++++++++++ >> 3 files changed, 12 insertions(+), 1 deletion(-) >> >> diff --git a/fs/ceph/super.c b/fs/ceph/super.c >> index b5ecd6f..f97857a 100644 >> --- a/fs/ceph/super.c >> +++ b/fs/ceph/super.c >> @@ -632,6 +632,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, >> goto fail; >> } >> >> + opt->flags |= CEPH_OPT_ABORTONFULL; >> fsc->client = ceph_create_client(opt, fsc); >> if (IS_ERR(fsc->client)) { >> err = PTR_ERR(fsc->client); >> @@ -640,7 +641,6 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, >> opt = NULL; /* fsc->client now owns this */ >> >> fsc->client->extra_mon_dispatch = extra_mon_dispatch; >> - fsc->client->osdc.abort_on_full = true; > Don't move it above ceph_create_client(), do ceph_set_opt here. ok > >> if (!fsopt->mds_namespace) { >> ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, >> diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h >> index 68bb09c..0fc40bb7 100644 >> --- a/include/linux/ceph/libceph.h >> +++ b/include/linux/ceph/libceph.h >> @@ -35,6 +35,7 @@ >> #define CEPH_OPT_NOMSGAUTH (1<<4) /* don't require msg signing feat */ >> #define CEPH_OPT_TCP_NODELAY (1<<5) /* TCP_NODELAY on TCP sockets */ >> #define CEPH_OPT_NOMSGSIGN (1<<6) /* don't sign msgs */ >> +#define CEPH_OPT_ABORTONFULL (1<<7) /* abort request with -ENOSPC when pool is full */ > Make it CEPH_OPT_ABORT_ON_FULL. okey > >> #define CEPH_OPT_DEFAULT (CEPH_OPT_TCP_NODELAY) >> >> diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c >> index 87afb9e..9932251 100644 >> --- a/net/ceph/ceph_common.c >> +++ b/net/ceph/ceph_common.c >> @@ -255,6 +255,7 @@ enum { >> Opt_nocephx_sign_messages, >> Opt_tcp_nodelay, >> Opt_notcp_nodelay, >> + Opt_abort_on_full, >> }; >> >> static match_table_t opt_tokens = { >> @@ -280,6 +281,7 @@ enum { >> {Opt_nocephx_sign_messages, "nocephx_sign_messages"}, >> {Opt_tcp_nodelay, "tcp_nodelay"}, >> {Opt_notcp_nodelay, "notcp_nodelay"}, >> + {Opt_abort_on_full, "abort_on_full"}, >> {-1, NULL} >> }; >> >> @@ -535,6 +537,10 @@ struct ceph_options * >> opt->flags &= ~CEPH_OPT_TCP_NODELAY; >> break; >> >> + case Opt_abort_on_full: >> + opt->flags |= CEPH_OPT_ABORTONFULL; >> + break; >> + >> default: >> BUG_ON(token); >> } >> @@ -574,6 +580,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) >> seq_puts(m, "nocephx_sign_messages,"); >> if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0) >> seq_puts(m, "notcp_nodelay,"); >> + if (opt->flags & CEPH_OPT_ABORTONFULL) >> + seq_puts(m, "abort_on_full,"); >> >> if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) >> seq_printf(m, "mount_timeout=%d,", >> @@ -653,6 +661,8 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) >> if (err < 0) >> goto fail_monc; >> >> + if (ceph_test_opt(client, ABORTONFULL)) >> + client->osdc.abort_on_full = true; > Let's get rid of ceph_osd_client::abort_on_full. Replace it with > ceph_test_opt in __submit_request() and ceph_osdc_abort_on_full(). okey > > Thanks, > > Ilya >
On 12/14/18 9:03 AM, Dongsheng Yang wrote: > > > On 12/13/2018 06:41 PM, cgxu519 wrote: >> On 12/13/18 5:48 PM, Dongsheng Yang wrote: >>> Introduce a new option abort_on_full, default to false. Then >>> we can get -ENOSPC when the pool is full, or reaches quota. >>> --- >>> fs/ceph/super.c | 2 +- >>> include/linux/ceph/libceph.h | 1 + >>> net/ceph/ceph_common.c | 10 ++++++++++ >>> 3 files changed, 12 insertions(+), 1 deletion(-) >>> >>> diff --git a/fs/ceph/super.c b/fs/ceph/super.c >>> index b5ecd6f..f97857a 100644 >>> --- a/fs/ceph/super.c >>> +++ b/fs/ceph/super.c >>> @@ -632,6 +632,7 @@ static struct ceph_fs_client >>> *create_fs_client(struct ceph_mount_options *fsopt, >>> goto fail; >>> } >>> + opt->flags |= CEPH_OPT_ABORTONFULL; >> >> According to your change log, it should not be set here. > > Do you mean "default to false"? > > No, the default to false mean the default in libceph is false, please > take > a look at CEPH_OPT_DEFAULT. > > But there are two user of libceph, cephfs and krbd. cephfs was > always using abort_on_full, so set this flag in cephfs. Yeah, you are right. Please ignore that. Thanks,
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index b5ecd6f..f97857a 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -632,6 +632,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, goto fail; } + opt->flags |= CEPH_OPT_ABORTONFULL; fsc->client = ceph_create_client(opt, fsc); if (IS_ERR(fsc->client)) { err = PTR_ERR(fsc->client); @@ -640,7 +641,6 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, opt = NULL; /* fsc->client now owns this */ fsc->client->extra_mon_dispatch = extra_mon_dispatch; - fsc->client->osdc.abort_on_full = true; if (!fsopt->mds_namespace) { ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 68bb09c..0fc40bb7 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h @@ -35,6 +35,7 @@ #define CEPH_OPT_NOMSGAUTH (1<<4) /* don't require msg signing feat */ #define CEPH_OPT_TCP_NODELAY (1<<5) /* TCP_NODELAY on TCP sockets */ #define CEPH_OPT_NOMSGSIGN (1<<6) /* don't sign msgs */ +#define CEPH_OPT_ABORTONFULL (1<<7) /* abort request with -ENOSPC when pool is full */ #define CEPH_OPT_DEFAULT (CEPH_OPT_TCP_NODELAY) diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 87afb9e..9932251 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c @@ -255,6 +255,7 @@ enum { Opt_nocephx_sign_messages, Opt_tcp_nodelay, Opt_notcp_nodelay, + Opt_abort_on_full, }; static match_table_t opt_tokens = { @@ -280,6 +281,7 @@ enum { {Opt_nocephx_sign_messages, "nocephx_sign_messages"}, {Opt_tcp_nodelay, "tcp_nodelay"}, {Opt_notcp_nodelay, "notcp_nodelay"}, + {Opt_abort_on_full, "abort_on_full"}, {-1, NULL} }; @@ -535,6 +537,10 @@ struct ceph_options * opt->flags &= ~CEPH_OPT_TCP_NODELAY; break; + case Opt_abort_on_full: + opt->flags |= CEPH_OPT_ABORTONFULL; + break; + default: BUG_ON(token); } @@ -574,6 +580,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) seq_puts(m, "nocephx_sign_messages,"); if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0) seq_puts(m, "notcp_nodelay,"); + if (opt->flags & CEPH_OPT_ABORTONFULL) + seq_puts(m, "abort_on_full,"); if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) seq_printf(m, "mount_timeout=%d,", @@ -653,6 +661,8 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) if (err < 0) goto fail_monc; + if (ceph_test_opt(client, ABORTONFULL)) + client->osdc.abort_on_full = true; return client; fail_monc: