From patchwork Tue Oct 10 14:49:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9996425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0BAD6601AE for ; Tue, 10 Oct 2017 14:56:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F054328634 for ; Tue, 10 Oct 2017 14:56:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E52E828639; Tue, 10 Oct 2017 14:56:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F0FA28634 for ; Tue, 10 Oct 2017 14:56:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932291AbdJJO4Q (ORCPT ); Tue, 10 Oct 2017 10:56:16 -0400 Received: from mga02.intel.com ([134.134.136.20]:9833 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932245AbdJJO4O (ORCPT ); Tue, 10 Oct 2017 10:56:14 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Oct 2017 07:56:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,505,1500966000"; d="scan'208";a="1204269250" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by fmsmga001.fm.intel.com with ESMTP; 10 Oct 2017 07:56:13 -0700 Subject: [PATCH v8 09/14] xfs: wire up ->lease_direct() From: Dan Williams To: linux-nvdimm@lists.01.org Cc: linux-xfs@vger.kernel.org, Jan Kara , "Darrick J. Wong" , linux-rdma@vger.kernel.org, linux-api@vger.kernel.org, Dave Chinner , iommu@lists.linux-foundation.org, Christoph Hellwig , "J. Bruce Fields" , linux-mm@kvack.org, Jeff Moyer , linux-fsdevel@vger.kernel.org, Jeff Layton , Ross Zwisler Date: Tue, 10 Oct 2017 07:49:48 -0700 Message-ID: <150764698865.16882.6963827339963112876.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <150764693502.16882.15848797003793552156.stgit@dwillia2-desk3.amr.corp.intel.com> References: <150764693502.16882.15848797003793552156.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A 'lease_direct' lease requires that the vma have a valid MAP_DIRECT mapping established. For xfs we use the generic_map_direct_lease() handler for ->lease_direct(). It establishes a new lease and then checks if the MAP_DIRECT mapping has been broken. We want to be sure that the process will receive notification that the MAP_DIRECT mapping is being torn down so it knows why other code paths are throwing failures. For example in the RDMA/ibverbs case we want ibv_reg_mr() to fail if the MAP_DIRECT mapping is invalid or in the process of being invalidated. Cc: Jan Kara Cc: Jeff Moyer Cc: Christoph Hellwig Cc: Dave Chinner Cc: "Darrick J. Wong" Cc: Ross Zwisler Cc: Jeff Layton Cc: "J. Bruce Fields" Signed-off-by: Dan Williams --- fs/xfs/xfs_file.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 4bee027c9366..bc512a9a8df5 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1157,6 +1157,7 @@ static const struct vm_operations_struct xfs_file_vm_direct_ops = { .open = generic_map_direct_open, .close = generic_map_direct_close, + .lease_direct = generic_map_direct_lease, }; static const struct vm_operations_struct xfs_file_vm_ops = { @@ -1209,8 +1210,8 @@ xfs_file_mmap_direct( vma->vm_flags |= VM_MIXEDMAP | VM_HUGEPAGE; /* - * generic_map_direct_{open,close} expect ->vm_private_data is - * set to the result of map_direct_register + * generic_map_direct_{open,close,lease} expect + * ->vm_private_data is set to the result of map_direct_register */ vma->vm_private_data = mds; return 0;