From 7d197837e0d7eb5f40a928a8f6c57270493b8996 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Fri, 8 Nov 2013 15:18:34 +0800 Subject: [PATCH] LU-4219 mdd: limit os_namelen to the max of NAME_MAX While running pathconf(".", _PC_NAME_MAX) on ldiskfs-based Lustre filesystem, it returns 255 (NAME_MAX). However, on zfs-based Lustre filesystem, it returns 256 (MAXNAMELEN). Since Lustre can not handle the name length large than NAME_MAX, this patch limits the value of os_namelen in mdd_statfs() to the max of NAME_MAX. Test-Parameters: envdefinitions=SLOW=yes \ mdtfilesystemtype=zfs mdsfilesystemtype=zfs ostfilesystemtype=zfs \ ostcount=2 testlist=posix Signed-off-by: Jian Yu Change-Id: I13b5398eff5b15c74b0e08e2a3394b79a3ff6a44 Reviewed-on: http://review.whamcloud.com/8217 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/mdd/mdd_device.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index f4462b7..0153d18 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -1012,16 +1012,18 @@ static int mdd_root_get(const struct lu_env *env, * No permission check is needed. */ static int mdd_statfs(const struct lu_env *env, struct md_device *m, - struct obd_statfs *sfs) + struct obd_statfs *sfs) { - struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev); - int rc; + struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev); + int rc; - ENTRY; + ENTRY; - rc = mdd_child_ops(mdd)->dt_statfs(env, mdd->mdd_child, sfs); + rc = mdd_child_ops(mdd)->dt_statfs(env, mdd->mdd_child, sfs); - RETURN(rc); + sfs->os_namelen = min_t(__u32, sfs->os_namelen, NAME_MAX); + + RETURN(rc); } /* -- 1.8.3.1