From patchwork Thu Dec 13 09:48:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10728407 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 157F1112E for ; Thu, 13 Dec 2018 09:54:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 046A528640 for ; Thu, 13 Dec 2018 09:54:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBC8D29E85; Thu, 13 Dec 2018 09:54:20 +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 0925A28640 for ; Thu, 13 Dec 2018 09:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbeLMJyS (ORCPT ); Thu, 13 Dec 2018 04:54:18 -0500 Received: from m97138.mail.qiye.163.com ([220.181.97.138]:53128 "EHLO m97138.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727426AbeLMJyS (ORCPT ); Thu, 13 Dec 2018 04:54:18 -0500 X-Greylist: delayed 358 seconds by postgrey-1.27 at vger.kernel.org; Thu, 13 Dec 2018 04:54:17 EST Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp9 (Coremail) with SMTP id u+CowADX8iDaKhJc88s_AA--.1888S2; Thu, 13 Dec 2018 17:48:10 +0800 (CST) From: Dongsheng Yang To: idryomov@gmail.com, jdurgin@redhat.com, cgxu519@gmx.com Cc: ceph-devel@vger.kernel.org, Dongsheng Yang Subject: [PATCH v3] libceph: introduce new option abort_on_full Date: Thu, 13 Dec 2018 04:48:08 -0500 Message-Id: <1544694488-19310-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: u+CowADX8iDaKhJc88s_AA--.1888S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxGrWrtF4fKr1rCFWUKFykZrb_yoW5Cr13pF 1kua40yFW8JF42g397AF4kur4xCw48JFsrCw1kWr13CFWFyan7ta4jk3s0qry3XFWfAF1v 9r18trW5GFWUZrUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0J1bmhwUUUUU= X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbiAxocelillgvnmQAAsh 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. --- 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; 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: