From patchwork Mon Dec 20 11:54:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 420301 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBKBt1io005358 for ; Mon, 20 Dec 2010 11:55:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757288Ab0LTLym (ORCPT ); Mon, 20 Dec 2010 06:54:42 -0500 Received: from shutemov.name ([188.40.19.243]:38432 "EHLO shutemov.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755489Ab0LTLyl (ORCPT ); Mon, 20 Dec 2010 06:54:41 -0500 Received: by shutemov.name (Postfix, from userid 500) id EB494D40C1; Mon, 20 Dec 2010 13:54:40 +0200 (EET) From: "Kirill A. Shutsemov" To: Trond Myklebust , "J. Bruce Fields" , Neil Brown Cc: Pavel Emelyanov , linux-nfs@vger.kernel.org, "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH 01/12] sunrpc: mount rpc_pipefs on initialization Date: Mon, 20 Dec 2010 13:54:27 +0200 Message-Id: <1292846078-31793-2-git-send-email-kirill@shutemov.name> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1292846078-31793-1-git-send-email-kirill@shutemov.name> References: <1292846078-31793-1-git-send-email-kirill@shutemov.name> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 20 Dec 2010 11:55:03 +0000 (UTC) diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 10a17a3..7f3fbdd 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -29,7 +29,6 @@ #include static struct vfsmount *rpc_mnt __read_mostly; -static int rpc_mount_count; static struct file_system_type rpc_pipe_fs_type; @@ -415,18 +414,13 @@ struct rpc_filelist { struct vfsmount *rpc_get_mount(void) { - int err; - - err = simple_pin_fs(&rpc_pipe_fs_type, &rpc_mnt, &rpc_mount_count); - if (err != 0) - return ERR_PTR(err); - return rpc_mnt; + return mntget(rpc_mnt); } EXPORT_SYMBOL_GPL(rpc_get_mount); void rpc_put_mount(void) { - simple_release_fs(&rpc_mnt, &rpc_mount_count); + mntput(rpc_mnt); } EXPORT_SYMBOL_GPL(rpc_put_mount); @@ -1063,16 +1057,27 @@ int register_rpc_pipefs(void) if (!rpc_inode_cachep) return -ENOMEM; err = register_filesystem(&rpc_pipe_fs_type); - if (err) { - kmem_cache_destroy(rpc_inode_cachep); - return err; + if (err) + goto destroy_cache; + + rpc_mnt = kern_mount(&rpc_pipe_fs_type); + if (IS_ERR(rpc_mnt)) { + err = PTR_ERR(rpc_mnt); + goto unregister_fs; } return 0; + +unregister_fs: + unregister_filesystem(&rpc_pipe_fs_type); +destroy_cache: + kmem_cache_destroy(rpc_inode_cachep); + return err; } void unregister_rpc_pipefs(void) { + mntput(rpc_mnt); kmem_cache_destroy(rpc_inode_cachep); unregister_filesystem(&rpc_pipe_fs_type); }