Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp53309img; Wed, 27 Mar 2019 16:46:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlUGOIIodfts3yShmyifpgFKikqw9tqsl1PBvL+33sej5H+k3TOxT/hR/YTbUtEceLgKR7 X-Received: by 2002:a63:c548:: with SMTP id g8mr33882416pgd.451.1553730368939; Wed, 27 Mar 2019 16:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553730368; cv=none; d=google.com; s=arc-20160816; b=FjuAVyX8r7IUwm9pCLE65MR3yzRiX8j2LhMHoAt7cc6RjIUzEFATBMV8hX5V1wvyFs haziEjn5SsO89gR28WdAPysIkKEGI4ajhVF8GSCnVvy3eZ38WkTG7JTP58efgiiEBJtJ xkH6oLhUdR0kJK5qDv35zgS/NlOk5Y48klJC+2whnDXlE1seWCAAGJmrwc46eDOelpPN PzBCaXqhf5QOPOR6xG/NK+B00STNU6D6YqqVBHMyJYQ5Lopo2S4Jrsxb9vESgBp0B94H mfC9/Nv5t5gjT8il1UHBIDCeUvbyRvwQr+RSWD8uHwt5kKA5S4SbpRc1lXS7aQ1aOoLu YgMQ== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization; bh=nQkhh/1w6hweYzjiloG3KauwaoHxt0RkhJ/D0GU3lwI=; b=XooiACocXyyH6QaSYi8rI+/hQtMK3xT+VsSTs4pd6rgom+2SRaC2TWmv3PBytYWve5 VwsuS+NfqqtyQrfKn/vUHgfY5PrwhEd6GW4gemfaIh3Om51Bl5rhgZx1MZQQhIO7/pGL SveBxA6XrNNM5xe22ZMcI/nha/0oeIcqXGK9XbAiuoMvkp/uX7ibt1jjvAgQH81jZOsd aKTzo4mv5k3FqKXWwAg+/95sRp5dTzWL7ojKNKDOYTx2E0MqUQlCwDPHTrg+6Yax6DKE bjMfU499vkE3Kq1AR9P5+y+Vbqfwbxte1xl87x+b2nJuQdHFD3eVdtFJvbaGGK+re25v 0itw== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4si19904814pgk.353.2019.03.27.16.45.47; Wed, 27 Mar 2019 16:46:08 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387471AbfC0Xob (ORCPT + 99 others); Wed, 27 Mar 2019 19:44:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55631 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbfC0Xoa (ORCPT ); Wed, 27 Mar 2019 19:44:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C6BB30B24F6; Wed, 27 Mar 2019 23:44:29 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-121-98.rdu2.redhat.com [10.10.121.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58F555D9C4; Wed, 27 Mar 2019 23:44:28 +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: [RFC PATCH 31/68] vfs: Convert qib_fs/ipathfs to use the new mount API From: David Howells To: viro@zeniv.linux.org.uk Cc: Dennis Dalessandro , Mike Marciniszyn , linux-rdma@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com Date: Wed, 27 Mar 2019 23:44:27 +0000 Message-ID: <155373026764.7602.420612273283807556.stgit@warthog.procyon.org.uk> In-Reply-To: <155372999953.7602.13784796495137723805.stgit@warthog.procyon.org.uk> References: <155372999953.7602.13784796495137723805.stgit@warthog.procyon.org.uk> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 27 Mar 2019 23:44:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the qib_fs/ipathfs filesystem to the new internal mount API as the old one will be obsoleted and removed. This allows greater flexibility in communication of mount parameters between userspace, the VFS and the filesystem. See Documentation/filesystems/mount_api.txt for more information. [Q] Can qib_remove() race with qibfs_kill_super()? Should qib_super accesses be serialised with some sort of lock? Signed-off-by: David Howells cc: Dennis Dalessandro cc: Mike Marciniszyn cc: linux-rdma@vger.kernel.org --- drivers/infiniband/hw/qib/qib_fs.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c index 1d940a2885c9..fc4f62a248a1 100644 --- a/drivers/infiniband/hw/qib/qib_fs.c +++ b/drivers/infiniband/hw/qib/qib_fs.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -506,7 +507,7 @@ static int remove_device_files(struct super_block *sb, * after device init. The direct add_cntr_files() call handles adding * them from the init code, when the fs is already mounted. */ -static int qibfs_fill_super(struct super_block *sb, void *data, int silent) +static int qibfs_fill_super(struct super_block *sb, struct fs_context *fc) { struct qib_devdata *dd, *tmp; unsigned long flags; @@ -540,17 +541,26 @@ static int qibfs_fill_super(struct super_block *sb, void *data, int silent) return ret; } -static struct dentry *qibfs_mount(struct file_system_type *fs_type, int flags, - const char *dev_name, void *data) +static int qibfs_get_tree(struct fs_context *fc) { - struct dentry *ret; + int ret; - ret = mount_single(fs_type, flags, data, qibfs_fill_super); - if (!IS_ERR(ret)) - qib_super = ret->d_sb; + ret = vfs_get_super(fc, vfs_get_single_super, qibfs_fill_super); + if (ret == 0) + qib_super = fc->root->d_sb; return ret; } +static const struct fs_context_operations qibfs_context_ops = { + .get_tree = qibfs_get_tree, +}; + +static int qibfs_init_fs_context(struct fs_context *fc) +{ + fc->ops = &qibfs_context_ops; + return 0; +} + static void qibfs_kill_super(struct super_block *s) { kill_litter_super(s); @@ -589,7 +599,7 @@ int qibfs_remove(struct qib_devdata *dd) static struct file_system_type qibfs_fs_type = { .owner = THIS_MODULE, .name = "ipathfs", - .mount = qibfs_mount, + .init_fs_context = qibfs_init_fs_context, .kill_sb = qibfs_kill_super, }; MODULE_ALIAS_FS("ipathfs");