Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp898541ybl; Fri, 9 Aug 2019 15:59:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkObknBZoOmZqRgCgNN23VOE0BbwuY1WwHefXscqZ2LweS5PupCeF0VZlfQvxH10H+SHI1 X-Received: by 2002:a65:60d2:: with SMTP id r18mr19142092pgv.71.1565391592614; Fri, 09 Aug 2019 15:59:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565391592; cv=none; d=google.com; s=arc-20160816; b=hGquZe6t3BhqXMjarA03Y8u56Rh5HLFiphHSAnH7m2yf9gRKnIpdXpn97M9M4nVEyY yoSSktblOA9tbT38bD/US0auly2ZkJuu+oLKlGYPrA5XtzbUVKVTagraj+F07f2uEyvl 0D/eUX0E5PN9rgTCSRcpUzGH0JfwL560RLAuBOPCTeG7/y6a0WYR5RnhqTW24dHAnwyl 4UuLMu3YSDXZDgL68bnt9yupV0e6UQOnFoZUggw+ZgEXJBmY8Pr/YFV8FzFjd2WwGiiv ygN8aFF1LFydxicdKxC+aCzJUkgtbscX9BeHlUo2ANkZOukGvy/dFVJNxrVt/TdZmGgK 2A3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=o3LFNt0eHSKoEB+BEnprqBSe2zk7FW3mS2UHtjP/KF0=; b=erN1FxrBED2LJtM1xdoY+Xk9W19N25FeAJW/BcFrGVkFR8YRaSGPxqWrubguopppNn Hm1TWoeljxLF+/EdeSj9z64sbySYnaZ6B5V0kdpJEUYGtKNTlH6pG7wZCDqw7MQAh1AD rZNe+YBPDd+Jw/W3tt1USgqxGJbm/DBxBUcjgDZVFMPUnRSdtqE4BmfWW5I0kS4nlJ1i zPyikkNFY3zpuT0CDuNmXA6JgmG7e3vx9rTvf3qMgh/Dl/BWqnfwz0mT1SaxCheq9061 fVMGaPqYFfImGbWHadrvcFX79zMZOYPlahPLfcYjZVQxPXZpK5wiYmj4oDVEuNYnVoLQ XgAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r30si10822116pgl.69.2019.08.09.15.59.37; Fri, 09 Aug 2019 15:59:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730115AbfHIW64 (ORCPT + 99 others); Fri, 9 Aug 2019 18:58:56 -0400 Received: from mga14.intel.com ([192.55.52.115]:10748 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729930AbfHIW6y (ORCPT ); Fri, 9 Aug 2019 18:58:54 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2019 15:58:53 -0700 X-IronPort-AV: E=Sophos;i="5.64,367,1559545200"; d="scan'208";a="180270005" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.157]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2019 15:58:52 -0700 From: ira.weiny@intel.com To: Andrew Morton Cc: Jason Gunthorpe , Dan Williams , Matthew Wilcox , Jan Kara , "Theodore Ts'o" , John Hubbard , Michal Hocko , Dave Chinner , linux-xfs@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org, Ira Weiny Subject: [RFC PATCH v2 08/19] fs/xfs: Fail truncate if page lease can't be broken Date: Fri, 9 Aug 2019 15:58:22 -0700 Message-Id: <20190809225833.6657-9-ira.weiny@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190809225833.6657-1-ira.weiny@intel.com> References: <20190809225833.6657-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ira Weiny If pages are under a lease fail the truncate operation. We change the order of lease breaks to directly fail the operation if the lease exists. Select EXPORT_BLOCK_OPS for FS_DAX to ensure that xfs_break_lease_layouts() is defined for FS_DAX as well as pNFS. Signed-off-by: Ira Weiny --- fs/Kconfig | 1 + fs/xfs/xfs_file.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/Kconfig b/fs/Kconfig index 14cd4abdc143..c10b91f92528 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -48,6 +48,7 @@ config FS_DAX select DEV_PAGEMAP_OPS if (ZONE_DEVICE && !FS_DAX_LIMITED) select FS_IOMAP select DAX + select EXPORTFS_BLOCK_OPS help Direct Access (DAX) can be used on memory-backed block devices. If the block device supports DAX and the filesystem supports DAX, diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 447571e3cb02..850d0a0953a2 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -773,10 +773,11 @@ xfs_break_layouts( retry = false; switch (reason) { case BREAK_UNMAP: - error = xfs_break_dax_layouts(inode, &retry, off, len); + error = xfs_break_leased_layouts(inode, iolock, &retry); if (error || retry) break; - /* fall through */ + error = xfs_break_dax_layouts(inode, &retry, off, len); + break; case BREAK_WRITE: error = xfs_break_leased_layouts(inode, iolock, &retry); break; -- 2.20.1