From patchwork Fri Jan 20 15:17:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9528737 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 5961660113 for ; Fri, 20 Jan 2017 15:17:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B63C286A0 for ; Fri, 20 Jan 2017 15:17:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 406B5286A2; Fri, 20 Jan 2017 15:17:52 +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 EFED9286A0 for ; Fri, 20 Jan 2017 15:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752391AbdATPRt (ORCPT ); Fri, 20 Jan 2017 10:17:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44894 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752293AbdATPRn (ORCPT ); Fri, 20 Jan 2017 10:17:43 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 0E73A64369; Fri, 20 Jan 2017 15:17:44 +0000 (UTC) Received: from tleilax.poochiereds.net (ovpn-116-147.rdu2.redhat.com [10.10.116.147]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0KFHd8j003021; Fri, 20 Jan 2017 10:17:43 -0500 From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: jspray@redhat.com, idryomov@gmail.com, zyan@redhat.com, sage@redhat.com Subject: [PATCH v1 6/7] ceph: clean out delayed caps when destroying session Date: Fri, 20 Jan 2017 10:17:37 -0500 Message-Id: <20170120151738.9584-7-jlayton@redhat.com> In-Reply-To: <20170120151738.9584-1-jlayton@redhat.com> References: <20170120151738.9584-1-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 20 Jan 2017 15:17:44 +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 On last session put, drop any delayed cap messages that haven't run yet without processing them. 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 28c83454e9f6..05ab69763308 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -361,6 +361,23 @@ static void destroy_reply_info(struct ceph_mds_reply_info_parsed *info) /* * sessions */ +static void +drop_delayed_caps(struct ceph_mds_session *session) +{ + LIST_HEAD(delayed); + + spin_lock(&session->s_cap_lock); + list_splice_init(&session->s_delayed_caps, &delayed); + spin_unlock(&session->s_cap_lock); + + while (!list_empty(&delayed)) { + struct ceph_msg *msg = list_first_entry(&delayed, + struct ceph_msg, list_head); + list_del_init(&msg->list_head); + ceph_msg_put(msg); + } +} + const char *ceph_session_state_name(int s) { switch (s) { @@ -394,6 +411,7 @@ void ceph_put_mds_session(struct ceph_mds_session *s) atomic_read(&s->s_ref), atomic_read(&s->s_ref)-1); if (atomic_dec_and_test(&s->s_ref)) { WARN_ON_ONCE(cancel_work_sync(&s->s_delayed_caps_work)); + drop_delayed_caps(s); if (s->s_auth.authorizer) ceph_auth_destroy_authorizer(s->s_auth.authorizer); kfree(s);