From patchwork Tue Feb 7 05:04:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiubo Li X-Patchwork-Id: 651305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36B6FC636D4 for ; Tue, 7 Feb 2023 05:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230519AbjBGFJH (ORCPT ); Tue, 7 Feb 2023 00:09:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbjBGFIa (ORCPT ); Tue, 7 Feb 2023 00:08:30 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39F35392A8 for ; Mon, 6 Feb 2023 21:05:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675746302; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=gqsEr22cvLw7EF88apzE67NpQLwfGJ1s/hOB2OqShuA=; b=gsPmqMv1N4hidwWY6HjkuHlyYs9ulAS9KLGQrwhAgZf5d8kVkJBXMByy2apgjDqoQJL5nf fUoLqXdAhmljgcAW39IQZ4LJ5KvSMDc/r1IrkwdfcWIEbjBewKqFKUqqUyK2VxJDSTagf0 MIC29lyihycfppo0eeoJl+OZ5yE87HU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-141-BLMpkHK2NAitcpaf3CjP1g-1; Tue, 07 Feb 2023 00:04:58 -0500 X-MC-Unique: BLMpkHK2NAitcpaf3CjP1g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63B5C830F4E; Tue, 7 Feb 2023 05:04:58 +0000 (UTC) Received: from lxbceph1.gsslab.pek2.redhat.com (unknown [10.72.47.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3304492C3C; Tue, 7 Feb 2023 05:04:54 +0000 (UTC) From: xiubli@redhat.com To: idryomov@gmail.com, ceph-devel@vger.kernel.org Cc: jlayton@kernel.org, mchangir@redhat.com, vshankar@redhat.com, lhenriques@suse.de, Xiubo Li , stable@kernel.org, Patrick Donnelly Subject: [PATCH] ceph: flush cap release on session flush Date: Tue, 7 Feb 2023 13:04:52 +0800 Message-Id: <20230207050452.403436-1-xiubli@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: Xiubo Li MDS expects the completed cap release prior to responding to the session flush for cache drop. Cc: URL: http://tracker.ceph.com/issues/38009 Cc: Patrick Donnelly Signed-off-by: Xiubo Li Reviewed-by: Venky Shankar Reviewed-by: Jeff Layton --- fs/ceph/mds_client.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 3c9d3f609e7f..51366bd053de 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -4039,6 +4039,12 @@ static void handle_session(struct ceph_mds_session *session, break; case CEPH_SESSION_FLUSHMSG: + /* flush cap release */ + spin_lock(&session->s_cap_lock); + if (session->s_num_cap_releases) + ceph_flush_cap_releases(mdsc, session); + spin_unlock(&session->s_cap_lock); + send_flushmsg_ack(mdsc, session, seq); break;