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 A5DCBEE14C3 for ; Thu, 7 Sep 2023 00:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231580AbjIGAZ2 (ORCPT ); Wed, 6 Sep 2023 20:25:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjIGAZ1 (ORCPT ); Wed, 6 Sep 2023 20:25:27 -0400 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 E3B7C10C8 for ; Wed, 6 Sep 2023 17:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694046277; 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=Bpq2/XauSvOXc1x9vnX9iMPsoAfcIX5VSOJwo19uwuM=; b=a5NaZ9ECIOkWFySa43lGd/VDvZV7EqPNW77QehW5Zr7+pmVHB4/nWJP5zLqbm9H627UNNP 1E58QMy5km7SOrvHkBaT4Jd5lLl2YiMWLVxeNNoo4bnqsqZ7GwEvKDF0Bh5GDYfaCPKeHW Gys1n1SiMIyymrTVmEI15waY2pWtgFI= 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-281-COYHzjDvPna5MTRslPcOkQ-1; Wed, 06 Sep 2023 20:24:34 -0400 X-MC-Unique: COYHzjDvPna5MTRslPcOkQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD7FD8001EA; Thu, 7 Sep 2023 00:24:33 +0000 (UTC) Received: from li-a71a4dcc-35d1-11b2-a85c-951838863c8d.ibm.com.com (unknown [10.72.112.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE40F140E968; Thu, 7 Sep 2023 00:24:30 +0000 (UTC) From: xiubli@redhat.com To: idryomov@gmail.com, ceph-devel@vger.kernel.org Cc: jlayton@kernel.org, vshankar@redhat.com, mchangir@redhat.com, Xiubo Li , stable@vger.kernel.org Subject: [PATCH v2] ceph: remove the incorrect caps check in _file_size() Date: Thu, 7 Sep 2023 08:22:11 +0800 Message-ID: <20230907002211.633935-1-xiubli@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Xiubo Li When truncating the inode the MDS will acquire the xlock for the ifile Locker, which will revoke the 'Frwsxl' caps from the clients. But when the client just releases and flushes the 'Fw' caps to MDS, for exmaple, and once the MDS receives the caps flushing msg it just thought the revocation has finished. Then the MDS will continue truncating the inode and then issued the truncate notification to all the clients. While just before the clients receives the cap flushing ack they receive the truncation notification, the clients will detecte that the 'issued | dirty' is still holding the 'Fw' caps. Fixes: b0d7c2231015 ("ceph: introduce i_truncate_mutex") Cc: stable@vger.kernel.org URL: https://tracker.ceph.com/issues/56693 Signed-off-by: Xiubo Li --- V2: - Added the info about which commit it's fixing fs/ceph/inode.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index ea6f966dacd5..8017b9e5864f 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -769,9 +769,7 @@ int ceph_fill_file_size(struct inode *inode, int issued, ci->i_truncate_seq = truncate_seq; /* the MDS should have revoked these caps */ - WARN_ON_ONCE(issued & (CEPH_CAP_FILE_EXCL | - CEPH_CAP_FILE_RD | - CEPH_CAP_FILE_WR | + WARN_ON_ONCE(issued & (CEPH_CAP_FILE_RD | CEPH_CAP_FILE_LAZYIO)); /* * If we hold relevant caps, or in the case where we're -- 2.41.0