Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5039353pxb; Mon, 15 Feb 2021 08:01:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCPcvePcCTwRj7rP/Cpn7haQaW9VvbdaUS7sx00M3DZMSgmLUgCOcICMgl9mEE5CLaTlYz X-Received: by 2002:aa7:cb53:: with SMTP id w19mr12306379edt.324.1613404890283; Mon, 15 Feb 2021 08:01:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613404890; cv=none; d=google.com; s=arc-20160816; b=wE892KbJ4BzP4Ch2Xtf8Tgko59nmBLAbPIp5QMvwOLGB5LMhjWnq88KpSvIunkrhkY brlZnZAu2uSGokGggUXsd7bijTWa1pwWbcPZtKqIGU3uqivEJraMLvYmtxOeoE0EjCyx xDaMJfAFHw6GDTIWRUVKYm9dRjyzHoenfP76JCd4W8CCjhqRx1LH1jmAh6/2+mPRnnXx /468gWcRn4X8P/jmVg0y0iZSk/Z7TXo5/gILltvcDlsEQffsTCOIjv9od03Gq/alZtYg Y7032dInE6n/9BW2DnMQrmumxT5/zytUqk8hfiiOyynaXphGG/5Gom1sbvkrrns5KNns npHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:dkim-signature; bh=fd+YxTNFxPLjvRdig735ZjdA+1tp5z6Rlbi8Krg97XA=; b=yS/34V1zgsxuJFaY9B4DHmBkLWIKnmtZHeWvaU0mx5qOnsKrArM8FOnssDj2dNqUHa ezBTRw4jExeivgQ1Qx2uB3LsmKD2odN0+U9GMXpPQ02lB02vLnTKdIDxmRWSynqO6lJX ZvbjxsgtJDVzM9cDiZvtiYlIFUpC5nWtSSaFWA7G2ft23W+xBmnIPWnIfy3qkGPFEr2C j9aL0Q+M7x1bySRUuooKdBW7Rh6WErvFI4s0JGirJQRS2/TRWzpaySYkp4/fmwQM++qb 2Wn+zNlDvm24c2Mb7os3PVbIJaZ6M6J7wvDXPJQd2uGJpjaBfsz1mc3X8QFcqUVVelY1 GajA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SJeKA79q; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si12744730edw.35.2021.02.15.08.00.43; Mon, 15 Feb 2021 08:01:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SJeKA79q; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232446AbhBOP6Q (ORCPT + 99 others); Mon, 15 Feb 2021 10:58:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:21411 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232122AbhBOPvw (ORCPT ); Mon, 15 Feb 2021 10:51:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613404225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fd+YxTNFxPLjvRdig735ZjdA+1tp5z6Rlbi8Krg97XA=; b=SJeKA79qdJLPcG6CqHYOimxSoMFUxRYRnsRV1xWtM0kVTwIDbr7UOzbEA9jF34Efk8obP/ P/vwXKXMIQoTxF/26p6kS90uZyL1YoC6sgcO1/u/N0wVzaU2b4k3PrNLkw45ZvrIqjhuYU u4eQ9x4Qaku66IfGvJ04IzEQgl/nKck= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-598-QYAkgxXYPBmesFtcJAesFw-1; Mon, 15 Feb 2021 10:50:21 -0500 X-MC-Unique: QYAkgxXYPBmesFtcJAesFw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73AD7107ACFA; Mon, 15 Feb 2021 15:50:19 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-119-68.rdu2.redhat.com [10.10.119.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D85D10023AB; Mon, 15 Feb 2021 15:50:13 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 29/33] ceph: rework PageFsCache handling From: David Howells To: Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet Cc: Jeff Layton , ceph-devel@vger.kernel.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, dhowells@redhat.com, Jeff Layton , David Wysochanski , "Matthew Wilcox (Oracle)" , Alexander Viro , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 15 Feb 2021 15:50:12 +0000 Message-ID: <161340421234.1303470.3419296430861464018.stgit@warthog.procyon.org.uk> In-Reply-To: <161340385320.1303470.2392622971006879777.stgit@warthog.procyon.org.uk> References: <161340385320.1303470.2392622971006879777.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Jeff Layton With the new fscache API, the PageFsCache bit now indicates that the page is being written to the cache and shouldn't be modified or released until it's finished. Change releasepage and invalidatepage to wait on that bit before returning. Also define FSCACHE_USE_NEW_IO_API so that we opt into the new fscache API. Signed-off-by: Jeff Layton Signed-off-by: David Howells cc: ceph-devel@vger.kernel.org cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org --- fs/ceph/addr.c | 9 ++++++++- fs/ceph/super.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 2b17bb36e548..fbfa49db06fd 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -146,6 +146,8 @@ static void ceph_invalidatepage(struct page *page, unsigned int offset, struct ceph_inode_info *ci; struct ceph_snap_context *snapc = page_snap_context(page); + wait_on_page_fscache(page); + inode = page->mapping->host; ci = ceph_inode(inode); @@ -168,11 +170,16 @@ static void ceph_invalidatepage(struct page *page, unsigned int offset, ClearPagePrivate(page); } -static int ceph_releasepage(struct page *page, gfp_t g) +static int ceph_releasepage(struct page *page, gfp_t gfp_flags) { dout("%p releasepage %p idx %lu (%sdirty)\n", page->mapping->host, page, page->index, PageDirty(page) ? "" : "not "); + if (PageFsCache(page)) { + if (!(gfp_flags & __GFP_DIRECT_RECLAIM) || !(gfp_flags & __GFP_FS)) + return 0; + wait_on_page_fscache(page); + } return !PagePrivate(page); } diff --git a/fs/ceph/super.h b/fs/ceph/super.h index b62d8fee3b86..96bd3487d788 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -21,6 +21,7 @@ #include #ifdef CONFIG_CEPH_FSCACHE +#define FSCACHE_USE_NEW_IO_API #include #endif