lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1260086343-8406-5-git-send-email-hooanon05@yahoo.co.jp>
Date:	Sun,  6 Dec 2009 16:59:02 +0900
From:	"J. R. Okajima" <hooanon05@...oo.co.jp>
To:	linux-kernel@...r.kernel.org
Cc:	stewb@...ux-foundation.org, "J. R. Okajima" <hooanon05@...oo.co.jp>
Subject: [RFC 4/5] nfs, support pathconf(3) with _PC_LINK_MAX

Return the value via struct statfs.f_spare[0], based upon PATHCONF
procedure. As namemax, it is set to a new member in struct nfs_server,
named linkmax.
Since NFSv2 (v4 too?) doesn't have PATHCONF procedure, it will be set to
LINK_MAX_DEFAULT which is a default value of GLibc implementation.

Signed-off-by: J. R. Okajima <hooanon05@...oo.co.jp>
---
 fs/nfs/client.c           |   10 +++++++---
 fs/nfs/super.c            |    1 +
 include/linux/nfs_fs_sb.h |    1 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 99ea196..ed3fddd 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -851,6 +851,7 @@ static int nfs_init_server(struct nfs_server *server,
 	server->mountd_protocol = data->mount_server.protocol;
 
 	server->namelen  = data->namlen;
+	server->linkmax  = LINK_MAX_DEFAULT;
 	/* Create a client RPC handle for the NFSv3 ACL management interface */
 	nfs_init_server_aclclient(server);
 	dprintk("<-- nfs_init_server() = 0 [new %p]\n", clp);
@@ -941,14 +942,17 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str
 	nfs_server_set_fsinfo(server, &fsinfo);
 
 	/* Get some general file system info */
-	if (server->namelen == 0) {
+	{
 		struct nfs_pathconf pathinfo;
 
 		pathinfo.fattr = fattr;
 		nfs_fattr_init(fattr);
 
-		if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0)
-			server->namelen = pathinfo.max_namelen;
+		if (clp->rpc_ops->pathconf(server, mntfh, &pathinfo) >= 0) {
+			if (server->namelen == 0)
+				server->namelen = pathinfo.max_namelen;
+			server->linkmax = pathinfo.max_link;
+		}
 	}
 
 	dprintk("<-- nfs_probe_fsinfo() = 0\n");
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 90be551..ae0599c 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -453,6 +453,7 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	buf->f_ffree = res.afiles;
 
 	buf->f_namelen = server->namelen;
+	buf->f_linkmax = server->linkmax;
 
 	return 0;
 
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 320569e..d66ab43 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -123,6 +123,7 @@ struct nfs_server {
 	unsigned int		acdirmin;
 	unsigned int		acdirmax;
 	unsigned int		namelen;
+ 	unsigned int		linkmax;
 	unsigned int		options;	/* extra options enabled by mount */
 #define NFS_OPTION_FSCACHE	0x00000001	/* - local caching enabled */
 
-- 
1.6.1.284.g5dc13

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ