Whamcloud - gitweb
LU-9767 utils: validate filesystem name for mkfs.lustre 70/28070/7
authorJames Simmons <uja.ornl@yahoo.com>
Mon, 21 Aug 2017 03:24:20 +0000 (23:24 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 28 Aug 2017 06:24:54 +0000 (06:24 +0000)
commit28216a73f4c0b19ef45e3ec2d6949801f6b9f828
treeada35036c0f17aa3272866e77bc33a2fbc40f0bd
parent1c45d9051764e0637ba90b3db06ba8fa37722916
LU-9767 utils: validate filesystem name for mkfs.lustre

The patch "LU-6401 uapi: turn lustre_param.h into a proper
UAPI header" removed various user land functions used to
validate poolnames and file system names were removed. The
checks instead were enforced on the kernel side to ensure
any possible user land software directly interfacing to the
kernel wouldn't be able to break things badly. For the case
of formating the backend file system no kernel interaction
doesn't happen until it tries to mount the MDT/OST/MGT which
is very late in the process. So for this case lets add back
the file system name verification to mkfs.lustre to warn
users long before they try to mount anything.

Secondly we remove the verify_poolname() in lfs.c since
it duplicates extract_fsname_poolname() in obd.c. Their
is no need to do the same test twice. The function
pool_cmd() calls the ioctl for pool handling which in
turn returns an error code. Use this error code to notify
the user what mistake they did for their pool command.
For the MGS kernel code mgs_extract_fs_pool() was checking
MTI_NAME_MAXLEN instead of LUSTRE_MAXFSNAME. Also use
LUSTRE_MAXFSNAME instead of the raw number in the function
server_name2fsname() located in obd_mount.c.

Change-Id: If094644e56a70b6dd8e6b0378adc8736911aeef1
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/28070
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/mgs/mgs_handler.c
lustre/obdclass/obd_mount.c
lustre/utils/lfs.c
lustre/utils/mkfs_lustre.c
lustre/utils/obd.c