From patchwork Fri Jul 1 02:29:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiubo Li X-Patchwork-Id: 586531 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 3EC2DC43334 for ; Fri, 1 Jul 2022 02:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233342AbiGACaP (ORCPT ); Thu, 30 Jun 2022 22:30:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233336AbiGACaK (ORCPT ); Thu, 30 Jun 2022 22:30:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9D8006052F for ; Thu, 30 Jun 2022 19:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656642608; 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: in-reply-to:in-reply-to:references:references; bh=FQz5T2SvnREyVd422FUfN9wuhrBc8hz6OFIwBIgy+C4=; b=OqLk9mfhx8LzU79yL8IsrCf9siFKlHg01La3/EkXZfUTd5hmzjYvCPEQ+pAouuGzUC6qie qGgnab58vnSY7TfsGo/Ca76F0s09GzrU5/BFvE9PFWmQ5tJiDXG84btKJEiUGBOJelFrzC +DqHvnlPs6GvcnbOu6lsIMKsJSI5VOY= 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-292-NEJFAeYDO4uDDcgj9LEyvw-1; Thu, 30 Jun 2022 22:30:04 -0400 X-MC-Unique: NEJFAeYDO4uDDcgj9LEyvw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 702CF101A588; Fri, 1 Jul 2022 02:30:04 +0000 (UTC) Received: from lxbceph1.gsslab.pek2.redhat.com (unknown [10.72.47.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CBBC2026D64; Fri, 1 Jul 2022 02:30:00 +0000 (UTC) From: xiubli@redhat.com To: jlayton@kernel.org, idryomov@gmail.com, dhowells@redhat.com Cc: vshankar@redhat.com, linux-kernel@vger.kernel.org, ceph-devel@vger.kernel.org, willy@infradead.org, keescook@chromium.org, linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com, Xiubo Li Subject: [PATCH 2/2] ceph: do not release the folio lock in kceph Date: Fri, 1 Jul 2022 10:29:47 +0800 Message-Id: <20220701022947.10716-3-xiubli@redhat.com> In-Reply-To: <20220701022947.10716-1-xiubli@redhat.com> References: <20220701022947.10716-1-xiubli@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: Xiubo Li The netfs layer should be responsible to unlock and put the folio, and we will always return 0 when succeeds. URL: https://tracker.ceph.com/issues/56423 Signed-off-by: Xiubo Li --- fs/ceph/addr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index fe6147f20dee..3ef5200e2005 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1310,16 +1310,16 @@ static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, unsigned if (snapc) { int r; - folio_unlock(folio); - folio_put(folio); if (IS_ERR(snapc)) return PTR_ERR(snapc); + folio_unlock(folio); ceph_queue_writeback(inode); r = wait_event_killable(ci->i_cap_wq, context_is_writeable_or_written(inode, snapc)); ceph_put_snap_context(snapc); - return r == 0 ? -EAGAIN : r; + folio_lock(folio); + return r == 0 ? -EAGAIN : 0; } return 0; }