From patchwork Wed Dec 12 09:55:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10725903 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E244112E for ; Wed, 12 Dec 2018 09:56:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F8622996C for ; Wed, 12 Dec 2018 09:56:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7367C2A379; Wed, 12 Dec 2018 09:56:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7322A2996C for ; Wed, 12 Dec 2018 09:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbeLLJ4A (ORCPT ); Wed, 12 Dec 2018 04:56:00 -0500 Received: from m50212.mail.qiye.163.com ([123.125.50.212]:50159 "EHLO m50212.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726856AbeLLJ4A (ORCPT ); Wed, 12 Dec 2018 04:56:00 -0500 Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp4 (Coremail) with SMTP id PtOowEAZ8UMi2xBc9yE4AA--.169S2; Wed, 12 Dec 2018 17:55:46 +0800 (CST) From: Dongsheng Yang To: idryomov@gmail.com, jdurgin@redhat.com Cc: ceph-devel@vger.kernel.org, Dongsheng Yang Subject: [PATCH V2] libceph: introduce new option abort_on_full Date: Wed, 12 Dec 2018 04:55:43 -0500 Message-Id: <1544608543-11911-1-git-send-email-dongsheng.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544518554-21982-1-git-send-email-dongsheng.yang@easystack.cn> References: <1544518554-21982-1-git-send-email-dongsheng.yang@easystack.cn> X-CM-TRANSID: PtOowEAZ8UMi2xBc9yE4AA--.169S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJw4ftw18tw1rJF4ftF4rAFb_yoWrGr1UpF 1qk340yrW8JFWIgws3ZF4kuryFyF18JF47Cw1kGr43Can5ta1Sqa4UK3s0qr43ZFWrAFZF vF18trWUGFWUZrDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0J11xpnUUUUU= X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbiEQIbelnxsSBexgAAsT Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce a new option abort_on_full, default to false. Then we can get -ENOSPC when the pool is full, or reaches quota. Signed-off-by: Dongsheng Yang --- fs/ceph/super.c | 2 +- include/linux/ceph/libceph.h | 2 ++ net/ceph/ceph_common.c | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index b5ecd6f..3879b2a 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->abort_on_full = true; 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..96cc054 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h @@ -51,6 +51,7 @@ struct ceph_options { unsigned long osd_idle_ttl; /* jiffies */ unsigned long osd_keepalive_timeout; /* jiffies */ unsigned long osd_request_timeout; /* jiffies */ + bool abort_on_full; /* * any type that can't be simply compared or doesn't need need @@ -72,6 +73,7 @@ struct ceph_options { #define CEPH_OSD_KEEPALIVE_DEFAULT msecs_to_jiffies(5 * 1000) #define CEPH_OSD_IDLE_TTL_DEFAULT msecs_to_jiffies(60 * 1000) #define CEPH_OSD_REQUEST_TIMEOUT_DEFAULT 0 /* no timeout */ +#define CEPH_OSDC_ABORT_ON_FULL_DEFAULT false #define CEPH_MONC_HUNT_INTERVAL msecs_to_jiffies(3 * 1000) #define CEPH_MONC_PING_INTERVAL msecs_to_jiffies(10 * 1000) diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 87afb9e..e86ce76 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} }; @@ -369,6 +371,7 @@ struct ceph_options * opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT; opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT; opt->osd_request_timeout = CEPH_OSD_REQUEST_TIMEOUT_DEFAULT; + opt->abort_on_full = CEPH_OSDC_ABORT_ON_FULL_DEFAULT; /* get mon ip(s) */ /* ip1[:port1][,ip2[:port2]...] */ @@ -535,6 +538,10 @@ struct ceph_options * opt->flags &= ~CEPH_OPT_TCP_NODELAY; break; + case Opt_abort_on_full: + opt->abort_on_full = true; + break; + default: BUG_ON(token); } @@ -587,6 +594,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) if (opt->osd_request_timeout != CEPH_OSD_REQUEST_TIMEOUT_DEFAULT) seq_printf(m, "osd_request_timeout=%d,", jiffies_to_msecs(opt->osd_request_timeout) / 1000); + if (opt->abort_on_full != CEPH_OSDC_ABORT_ON_FULL_DEFAULT) + seq_puts(m, "abort_on_full,"); /* drop redundant comma */ if (m->count != pos) @@ -653,6 +662,7 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) if (err < 0) goto fail_monc; + client->osdc.abort_on_full = opt->abort_on_full; return client; fail_monc: