From patchwork Mon Feb 6 13:29:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9557749 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2521F60236 for ; Mon, 6 Feb 2017 13:29:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F8A426E90 for ; Mon, 6 Feb 2017 13:29:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04B0927F9A; Mon, 6 Feb 2017 13:29:37 +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=-6.9 required=2.0 tests=BAYES_00,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 A5E1826E90 for ; Mon, 6 Feb 2017 13:29:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752130AbdBFN3e (ORCPT ); Mon, 6 Feb 2017 08:29:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34322 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751414AbdBFN3c (ORCPT ); Mon, 6 Feb 2017 08:29:32 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49C0961980; Mon, 6 Feb 2017 13:29:33 +0000 (UTC) Received: from tleilax.poochiereds.net (ovpn-120-248.rdu2.redhat.com [10.10.120.248] (may be forged)) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v16DTTo6011646; Mon, 6 Feb 2017 08:29:32 -0500 From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: zyan@redhat.com, sage@redhat.com, idryomov@gmail.com, jspray@redhat.com Subject: [PATCH v2 4/6] ceph: register map callback to handle ENOSPC conditions Date: Mon, 6 Feb 2017 08:29:25 -0500 Message-Id: <20170206132927.9219-5-jlayton@redhat.com> In-Reply-To: <20170206132927.9219-1-jlayton@redhat.com> References: <20170206132927.9219-1-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 06 Feb 2017 13:29:33 +0000 (UTC) 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 Signed-off-by: Jeff Layton --- fs/ceph/mds_client.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 93fc893e1930..43297c6b5a8b 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -433,6 +433,21 @@ static int __verify_registered_session(struct ceph_mds_client *mdsc, return 0; } +static void handle_osd_map(struct ceph_osd_client *osdc, void *p) +{ + u32 cancelled_epoch = 0; + + lockdep_assert_held(&osdc->lock); + + if ((osdc->osdmap->flags & CEPH_OSDMAP_FULL) || + ceph_osdc_have_pool_full(osdc)) + cancelled_epoch = ceph_osdc_complete_writes(osdc, -ENOSPC); + + if (cancelled_epoch) + osdc->epoch_barrier = max(cancelled_epoch + 1, + osdc->epoch_barrier); +} + /* * create+register a new session for given mds. * called under mdsc->mutex. @@ -3486,6 +3501,9 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) ceph_caps_init(mdsc); ceph_adjust_min_caps(mdsc, fsc->min_caps); + ceph_osdc_register_map_cb(&fsc->client->osdc, + handle_osd_map, (void*)mdsc); + init_rwsem(&mdsc->pool_perm_rwsem); mdsc->pool_perm_tree = RB_ROOT;