From patchwork Tue Nov 4 14:34:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Spray X-Patchwork-Id: 5228121 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D843D9F3EE for ; Tue, 4 Nov 2014 14:35:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 09D9D20166 for ; Tue, 4 Nov 2014 14:35:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D8137200F0 for ; Tue, 4 Nov 2014 14:35:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754166AbaKDOfS (ORCPT ); Tue, 4 Nov 2014 09:35:18 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:64713 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753312AbaKDOfP (ORCPT ); Tue, 4 Nov 2014 09:35:15 -0500 Received: by mail-wg0-f44.google.com with SMTP id x12so13207484wgg.31 for ; Tue, 04 Nov 2014 06:35:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=bWeFFZit4vGyKqj0xpbPJOiSLqipMmQtH5mXcKPZtKY=; b=evvNP/Kdi9KcuZDMLNBFnn1xYA0rk7y0HtEFR3BOzPesk8VtCZNuHNmmPdZn0jN6uj /dPO5uTDpn6NuOVKfjAUaKCAnAzbiyG7O2fxHly5bnYEJ3Bi4A/BckCL+6BedYJzet1v TcDRagLGws4INa1NmIpitlxy9WW9J8uhqk+JBob/K/wI1XIgBcCudwPXO6y0aQF2nAwS lKrgck5Wq4u4B+E/jMaKMoI9b/ltLD+meEQtjjHy04f9rP9pVdT/jzvPmgN+j5WLo3ph 2ziKH7/Nq6CfI+o3Z3EX5h3/raynJgKXoXTSekiBBAa0pRQWtIq8YeB/2BW/9id3FkOT Z0yA== X-Gm-Message-State: ALoCoQlbzV47AcI1KEg25pLa27ghilwflS6Kcu6X05C/00jnOkcFNIZQQMM6a+/s903KrdPOPcFO X-Received: by 10.194.157.65 with SMTP id wk1mr41425396wjb.9.1415111713975; Tue, 04 Nov 2014 06:35:13 -0800 (PST) Received: from anthracite.localdomain (82-71-55-202.dsl.in-addr.zen.co.uk. [82.71.55.202]) by mx.google.com with ESMTPSA id w5sm1229004wif.18.2014.11.04.06.35.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Nov 2014 06:35:13 -0800 (PST) From: John Spray To: ceph-devel@vger.kernel.org Cc: John Spray Subject: [PATCH 4/7] ceph: handle full condition by cancelling ops Date: Tue, 4 Nov 2014 14:34:26 +0000 Message-Id: <1415111669-26246-5-git-send-email-john.spray@redhat.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1415111669-26246-1-git-send-email-john.spray@redhat.com> References: <1415111669-26246-1-git-send-email-john.spray@redhat.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While cancelling, we store the OSD epoch at time of cancellation, this will be used later in CAPRELEASE messages. Signed-off-by: John Spray --- fs/ceph/mds_client.c | 21 +++++++++++++++++++++ fs/ceph/mds_client.h | 1 + 2 files changed, 22 insertions(+) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 9f00853..dce7977 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -3265,6 +3265,23 @@ static void delayed_work(struct work_struct *work) schedule_delayed(mdsc); } +/** + * Call this with map_sem held for read + */ +static void handle_osd_map(struct ceph_osd_client *osdc, void *p) +{ + struct ceph_mds_client *mdsc = (struct ceph_mds_client*)p; + u32 cancelled_epoch = 0; + + if (osdc->osdmap->flags & CEPH_OSDMAP_FULL) { + cancelled_epoch = ceph_osdc_cancel_writes(osdc, -ENOSPC); + if (cancelled_epoch) { + mdsc->cap_epoch_barrier = max(cancelled_epoch + 1, + mdsc->cap_epoch_barrier); + } + } +} + int ceph_mdsc_init(struct ceph_fs_client *fsc) { @@ -3311,6 +3328,10 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) ceph_caps_init(mdsc); ceph_adjust_min_caps(mdsc, fsc->min_caps); + mdsc->cap_epoch_barrier = 0; + + ceph_osdc_register_map_cb(&fsc->client->osdc, + handle_osd_map, (void*)mdsc); return 0; } diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index 230bda7..7b40568 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h @@ -298,6 +298,7 @@ struct ceph_mds_client { int num_cap_flushing; /* # caps we are flushing */ spinlock_t cap_dirty_lock; /* protects above items */ wait_queue_head_t cap_flushing_wq; + u32 cap_epoch_barrier; /* * Cap reservations