diff options
author | Dongsheng Yang <dongsheng.yang@easystack.cn> | 2018-12-18 04:31:48 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2019-01-07 16:47:48 -0500 |
commit | 02b2f549d502b46e68b97ea1452fb8853b3327dd (patch) | |
tree | 415c1a23112a0edc7ec00813f64cb65a9ebec5fd /net/ceph | |
parent | bfeffd155283772bbe78c6a05dec7c0128ee500c (diff) |
libceph: allow setting abort_on_full for rbd
Introduce a new option abort_on_full, default to false. Then
we can get -ENOSPC when the pool is full, or reaches quota.
[ Don't show abort_on_full in /proc/mounts. ]
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/ceph_common.c | 11 | ||||
-rw-r--r-- | net/ceph/debugfs.c | 2 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 4 |
3 files changed, 13 insertions, 4 deletions
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 87afb9ec4c68..9cab80207ced 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c | |||
@@ -255,6 +255,7 @@ enum { | |||
255 | Opt_nocephx_sign_messages, | 255 | Opt_nocephx_sign_messages, |
256 | Opt_tcp_nodelay, | 256 | Opt_tcp_nodelay, |
257 | Opt_notcp_nodelay, | 257 | Opt_notcp_nodelay, |
258 | Opt_abort_on_full, | ||
258 | }; | 259 | }; |
259 | 260 | ||
260 | static match_table_t opt_tokens = { | 261 | static match_table_t opt_tokens = { |
@@ -280,6 +281,7 @@ static match_table_t opt_tokens = { | |||
280 | {Opt_nocephx_sign_messages, "nocephx_sign_messages"}, | 281 | {Opt_nocephx_sign_messages, "nocephx_sign_messages"}, |
281 | {Opt_tcp_nodelay, "tcp_nodelay"}, | 282 | {Opt_tcp_nodelay, "tcp_nodelay"}, |
282 | {Opt_notcp_nodelay, "notcp_nodelay"}, | 283 | {Opt_notcp_nodelay, "notcp_nodelay"}, |
284 | {Opt_abort_on_full, "abort_on_full"}, | ||
283 | {-1, NULL} | 285 | {-1, NULL} |
284 | }; | 286 | }; |
285 | 287 | ||
@@ -535,6 +537,10 @@ ceph_parse_options(char *options, const char *dev_name, | |||
535 | opt->flags &= ~CEPH_OPT_TCP_NODELAY; | 537 | opt->flags &= ~CEPH_OPT_TCP_NODELAY; |
536 | break; | 538 | break; |
537 | 539 | ||
540 | case Opt_abort_on_full: | ||
541 | opt->flags |= CEPH_OPT_ABORT_ON_FULL; | ||
542 | break; | ||
543 | |||
538 | default: | 544 | default: |
539 | BUG_ON(token); | 545 | BUG_ON(token); |
540 | } | 546 | } |
@@ -549,7 +555,8 @@ out: | |||
549 | } | 555 | } |
550 | EXPORT_SYMBOL(ceph_parse_options); | 556 | EXPORT_SYMBOL(ceph_parse_options); |
551 | 557 | ||
552 | int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) | 558 | int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, |
559 | bool show_all) | ||
553 | { | 560 | { |
554 | struct ceph_options *opt = client->options; | 561 | struct ceph_options *opt = client->options; |
555 | size_t pos = m->count; | 562 | size_t pos = m->count; |
@@ -574,6 +581,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) | |||
574 | seq_puts(m, "nocephx_sign_messages,"); | 581 | seq_puts(m, "nocephx_sign_messages,"); |
575 | if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0) | 582 | if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0) |
576 | seq_puts(m, "notcp_nodelay,"); | 583 | seq_puts(m, "notcp_nodelay,"); |
584 | if (show_all && (opt->flags & CEPH_OPT_ABORT_ON_FULL)) | ||
585 | seq_puts(m, "abort_on_full,"); | ||
577 | 586 | ||
578 | if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) | 587 | if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) |
579 | seq_printf(m, "mount_timeout=%d,", | 588 | seq_printf(m, "mount_timeout=%d,", |
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c index 02952605d121..46f65709a6ff 100644 --- a/net/ceph/debugfs.c +++ b/net/ceph/debugfs.c | |||
@@ -375,7 +375,7 @@ static int client_options_show(struct seq_file *s, void *p) | |||
375 | struct ceph_client *client = s->private; | 375 | struct ceph_client *client = s->private; |
376 | int ret; | 376 | int ret; |
377 | 377 | ||
378 | ret = ceph_print_client_options(s, client); | 378 | ret = ceph_print_client_options(s, client, true); |
379 | if (ret) | 379 | if (ret) |
380 | return ret; | 380 | return ret; |
381 | 381 | ||
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index d23a9f81f3d7..fa9530dd876e 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -2315,7 +2315,7 @@ again: | |||
2315 | (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || | 2315 | (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || |
2316 | pool_full(osdc, req->r_t.base_oloc.pool))) { | 2316 | pool_full(osdc, req->r_t.base_oloc.pool))) { |
2317 | dout("req %p full/pool_full\n", req); | 2317 | dout("req %p full/pool_full\n", req); |
2318 | if (osdc->abort_on_full) { | 2318 | if (ceph_test_opt(osdc->client, ABORT_ON_FULL)) { |
2319 | err = -ENOSPC; | 2319 | err = -ENOSPC; |
2320 | } else { | 2320 | } else { |
2321 | pr_warn_ratelimited("FULL or reached pool quota\n"); | 2321 | pr_warn_ratelimited("FULL or reached pool quota\n"); |
@@ -2545,7 +2545,7 @@ static void ceph_osdc_abort_on_full(struct ceph_osd_client *osdc) | |||
2545 | { | 2545 | { |
2546 | bool victims = false; | 2546 | bool victims = false; |
2547 | 2547 | ||
2548 | if (osdc->abort_on_full && | 2548 | if (ceph_test_opt(osdc->client, ABORT_ON_FULL) && |
2549 | (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || have_pool_full(osdc))) | 2549 | (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || have_pool_full(osdc))) |
2550 | for_each_request(osdc, abort_on_full_fn, &victims); | 2550 | for_each_request(osdc, abort_on_full_fn, &victims); |
2551 | } | 2551 | } |