From patchwork Mon Dec 20 11:54:36 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: 420451 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 oBKBvwUa006919 for ; Mon, 20 Dec 2010 11:58:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757364Ab0LTL5l (ORCPT ); Mon, 20 Dec 2010 06:57:41 -0500 Received: from shutemov.name ([188.40.19.243]:38474 "EHLO shutemov.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757366Ab0LTLyn (ORCPT ); Mon, 20 Dec 2010 06:54:43 -0500 Received: by shutemov.name (Postfix, from userid 500) id 39E72D421B; Mon, 20 Dec 2010 13:54:41 +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 10/12] sunrpc: introduce get_rpc_pipefs() Date: Mon, 20 Dec 2010 13:54:36 +0200 Message-Id: <1292846078-31793-11-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:58:00 +0000 (UTC) diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h index b09bfa5..922057c 100644 --- a/include/linux/sunrpc/rpc_pipe_fs.h +++ b/include/linux/sunrpc/rpc_pipe_fs.h @@ -46,6 +46,8 @@ RPC_I(struct inode *inode) extern struct vfsmount *init_rpc_pipefs; +struct vfsmount *get_rpc_pipefs(const char *path); + extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); struct rpc_clnt; diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index b1e299b..c48f7a5 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -931,6 +931,30 @@ static const struct super_operations s_ops = { #define RPCAUTH_GSSMAGIC 0x67596969 +struct vfsmount *get_rpc_pipefs(const char *p) +{ + int error; + struct vfsmount *rpcmount; + struct path path; + + if (!p) + return mntget(init_rpc_pipefs); + + error = kern_path(p, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path); + if (error) + return ERR_PTR(error); + + if (path.mnt->mnt_sb->s_magic != RPCAUTH_GSSMAGIC) { + path_put(&path); + return ERR_PTR(-EINVAL); + } + + rpcmount = mntget(path.mnt); + path_put(&path); + + return rpcmount; +} + /* * We have a single directory with 1 node in it. */