From 510aea4a37ea26769be5946ca93a4576a1dd4095 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Wed, 24 Jul 2019 13:36:52 -0600 Subject: [PATCH] LU-12514 utils: add "lustre_tgt" filesystem type Add a "lustre_tgt" filesystem type separate from the "lustre" filesystem type for forward compatibility to allow the client and server mount code to be disentangled. This does not actually make any changes to the mount code itself, but allows testing interop and fallback after an upgrade if the new filesystem type is used. Remove the check for the "lustre_lite" filesystem type from llapi_is_lustre_mnttype() since that was unused since Lustre 1.4, and replace it with a check for filesystem type "lustre_tgt". Test-Parameters: trivial testlist=conf-sanity Change-Id: If635834dfff502e6ecf8a85a2665de09efd52372 Signed-off-by: Andreas Dilger Signed-off-by: Oleg Drokin Reviewed-on: https://review.whamcloud.com/36165 Tested-by: jenkins Reviewed-by: James Simmons Reviewed-by: Neil Brown Tested-by: Maloo --- lustre.spec.in | 1 + lustre/doc/Makefile.am | 1 + lustre/doc/mount.lustre.8 | 36 +++++++++++++----------- lustre/doc/mount.lustre_tgt.8 | 1 + lustre/llite/llite_lib.c | 3 +- lustre/obdclass/obd_mount.c | 64 +++++++++++++++++++++++++++++++++++++------ lustre/utils/.gitignore | 1 + lustre/utils/Makefile.am | 6 +++- lustre/utils/liblustreapi.c | 2 +- 9 files changed, 87 insertions(+), 28 deletions(-) create mode 100644 lustre/doc/mount.lustre_tgt.8 diff --git a/lustre.spec.in b/lustre.spec.in index 64fdb9b..41fdf71 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -521,6 +521,7 @@ fi %{_bindir}/lfs %{_bindir}/lfs_migrate /sbin/mount.lustre +/sbin/mount.lustre_tgt %if %{with static} %{_libdir}/liblustreapi.a %endif diff --git a/lustre/doc/Makefile.am b/lustre/doc/Makefile.am index cedb602..6c65c76 100644 --- a/lustre/doc/Makefile.am +++ b/lustre/doc/Makefile.am @@ -132,6 +132,7 @@ MANFILES = \ lustre_routes_conversion.8 \ lustre_rsync.8 \ mount.lustre.8 \ + mount.lustre_tgt.8 \ nids.5 \ plot-llstat.8 \ routerstat.8 diff --git a/lustre/doc/mount.lustre.8 b/lustre/doc/mount.lustre.8 index e4a68f0..479f826 100644 --- a/lustre/doc/mount.lustre.8 +++ b/lustre/doc/mount.lustre.8 @@ -5,21 +5,26 @@ .\" .\" This file may be copied under the terms of the GNU Public License v2. .\" -.TH mount.lustre 8 "2008 Mar 15" Lustre "configuration utilities" +.TH mount.lustre 8 "2019 Jul 30" Lustre "configuration utilities" .SH NAME -mount.lustre \- start a Lustre client or target service +mount.lustre \- mount helper for Lustre client +mount.lustre_tgt \- mount helper for Lustre target service .SH SYNOPSIS .br -.BI "mount \-t lustre [\-o " options "] " " " +.BI "mount -t lustre [-o " options "] " ":/ " .br -.BI "mount \-t lustre [\-o " options "] " ":/ " +.BI "mount -t lustre_tgt [-o " options "] " " " .SH DESCRIPTION .B mount.lustre -is used to start a Lustre client or target service. This program should not -be called directly; rather it is a helper program invoked through +and +.B mount.lustre_tgt +are used to start a Lustre client or target service, respectively. They +should not be called directly; rather they are helper programs invoked through .BR mount (8) as above when the .B lustre +or +.B lustre_tgt filesystem type is used. Lustre clients and targets are stopped by using the .BR umount (8) command. @@ -30,7 +35,7 @@ There are two forms for the device option passed to the command, depending on whether a client or a target service is started: .TP .IR :/ [/] -mounts the Lustre filesystem named +mounts the Lustre client filesystem named .I fsname (optionally starting at subdirectory .I subdir @@ -46,11 +51,10 @@ for automatic mount at boot time, is usable like any local filesystem, and provides a full POSIX-compilant interface. .TP .I block_device -starts the target service defined by the +specifies the phyisical disk or ZFS dataset uses to start the target service +formatted by the .IR mkfs.lustre (8) -command on the physical disk or ZFS dataset given by -.IR block_device . -The +command. The .I block_device may be specified using .BI -L label @@ -66,7 +70,7 @@ or similar. The mounted target service filesystem at .I mountpoint is only useful for .BR df (1) -operations and appears in +operations to show the current space usage, and appears in .BR /proc/mounts to show the device is in use. .SH OPTIONS @@ -297,17 +301,17 @@ tries the second one. On each service node, the comma-separated NIDs refer to different interfaces on the same host, and the Lustre client chooses the best one for communication based on which network interfaces are available locally. .TP -.B mount -t lustre /dev/sda1 /mnt/test/mdt +.B mount -t lustre_tgt /dev/sda1 /mnt/test/mdt Start the Lustre metadata target service from .B /dev/sda1 on mountpoint .BR /mnt/test/mdt . .TP -.B mount -t lustre -L testfs-MDT0000 -o abort_recov /mnt/test/mdt +.B mount -t lustre_tgt -L testfs-MDT0000 -o abort_recov /mnt/test/mdt Start the .B testfs-MDT0000 -service (by using the disk label), but aborts the recovery process if -all of the clients are known to be unavailable. +service (by using the disk label), but aborts the Lustre client recovery +process for the case that clients are known to be unavailable. .SH BUGS Not very many mount options can be changed with .BR "-o remount" . diff --git a/lustre/doc/mount.lustre_tgt.8 b/lustre/doc/mount.lustre_tgt.8 new file mode 100644 index 0000000..e427cfd --- /dev/null +++ b/lustre/doc/mount.lustre_tgt.8 @@ -0,0 +1 @@ +.so man8/mount.lustre.8 diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index cda72aa..49b9d4c 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -606,7 +606,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, #endif err = IS_ERR(root) ? PTR_ERR(root) : -EBADF; root = NULL; - CERROR("lustre_lite: bad iget4 for root\n"); + CERROR("%s: bad ll_iget() for root: rc = %d\n", + sbi->ll_fsname, err); GOTO(out_root, err); } diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 9da690b..8c2fde7 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -1295,7 +1295,7 @@ static int lmd_parse_nidlist(char *buf, char **endh) /** * Parse mount line options * e.g. mount -v -t lustre -o abort_recov uml1:uml2:/lustre-client /mnt/lustre - * dev is passed as device=uml1:/lustre by mount.lustre + * dev is passed as device=uml1:/lustre by mount.lustre_tgt */ static int lmd_parse(char *options, struct lustre_mount_data *lmd) { @@ -1308,14 +1308,14 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) LASSERT(lmd); if (!options) { LCONSOLE_ERROR_MSG(0x162, - "Missing mount data: check /sbin/mount.lustre is installed.\n"); + "Missing mount data: check /sbin/mount.lustre_tgt is installed.\n"); RETURN(-EINVAL); } /* Options should be a string - try to detect old lmd data */ if ((raw->lmd_magic & 0xffffff00) == (LMD_MAGIC & 0xffffff00)) { LCONSOLE_ERROR_MSG(0x163, - "Using an old version of /sbin/mount lustre. Please install version %s\n", + "Using an old version of /sbin/mount.lustre. Please install version %s\n", LUSTRE_VERSION_STRING); RETURN(-EINVAL); } @@ -1727,26 +1727,72 @@ static void lustre_kill_super(struct super_block *sb) kill_anon_super(sb); } +#ifdef HAVE_SERVER_SUPPORT +/* Register the "lustre_tgt" fs type. + * + * Right now this isn't any different than the normal "lustre" filesystem + * type, but it is added so that there is some compatibility to allow + * changing documentation and scripts to start using the "lustre_tgt" type + * at mount time. That will simplify test interop, and in case of upgrades + * that change to the new type and then need to roll back for some reason. + * + * The long-term goal is to disentangle the client and server mount code. + */ +static struct file_system_type lustre_fs_type_tgt = { + .owner = THIS_MODULE, + .name = "lustre_tgt", +#ifdef HAVE_FSTYPE_MOUNT + .mount = lustre_mount, +#else + .get_sb = lustre_get_sb, +#endif + .kill_sb = lustre_kill_super, + .fs_flags = FS_REQUIRES_DEV | FS_RENAME_DOES_D_MOVE, +}; +MODULE_ALIAS_FS("lustre_tgt"); + +#define register_filesystem_tgt(fstype) \ +do { \ + int _rc; \ + \ + _rc = register_filesystem(fstype); \ + if (_rc && _rc != -EBUSY) { \ + /* Don't fail if server code also registers "lustre_tgt" */ \ + CERROR("obdclass: register fstype '%s' failed: rc = %d\n", \ + (fstype)->name, _rc); \ + return _rc; \ + } \ +} while (0) +#define unregister_filesystem_tgt(fstype) unregister_filesystem(fstype) +#else +#define register_filesystem_tgt(fstype) do {} while (0) +#define unregister_filesystem_tgt(fstype) do {} while (0) +#endif + /* Register the "lustre" fs type */ static struct file_system_type lustre_fs_type = { - .owner = THIS_MODULE, - .name = "lustre", + .owner = THIS_MODULE, + .name = "lustre", #ifdef HAVE_FSTYPE_MOUNT - .mount = lustre_mount, + .mount = lustre_mount, #else - .get_sb = lustre_get_sb, + .get_sb = lustre_get_sb, #endif - .kill_sb = lustre_kill_super, - .fs_flags = FS_REQUIRES_DEV | FS_RENAME_DOES_D_MOVE, + .kill_sb = lustre_kill_super, + .fs_flags = FS_REQUIRES_DEV | FS_RENAME_DOES_D_MOVE, }; MODULE_ALIAS_FS("lustre"); int lustre_register_fs(void) { + register_filesystem_tgt(&lustre_fs_type_tgt); + return register_filesystem(&lustre_fs_type); } int lustre_unregister_fs(void) { + unregister_filesystem_tgt(&lustre_fs_type_tgt); + return unregister_filesystem(&lustre_fs_type); } diff --git a/lustre/utils/.gitignore b/lustre/utils/.gitignore index c98fff3..c6cbe5e 100644 --- a/lustre/utils/.gitignore +++ b/lustre/utils/.gitignore @@ -1,6 +1,7 @@ /Makefile.in /mkfs.lustre /mount.lustre +/mount.lustre_tgt /tunefs.lustre /lctl /lfs diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index 11e2392..8704f5b 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -23,7 +23,7 @@ GSSLIB = endif # mount only finds helpers in /sbin -rootsbin_PROGRAMS = mount.lustre +rootsbin_PROGRAMS = mount.lustre mount.lustre_tgt bin_SCRIPTS = llstat llobdstat plot-llstat bin_PROGRAMS = lfs sbin_SCRIPTS = ldlm_debug_upcall @@ -185,6 +185,10 @@ mount_lustre_CPPFLAGS := ${MNTMODCFLAGS} mount_lustre_LDFLAGS := ${MNTMODLDFLAGS} mount_lustre_LDADD := $(SELINUX) $(LDLIBMOUNT) $(PLUGIN_LIB) $(GSSLIB) \ $(top_builddir)/libcfs/libcfs/libcfs.la $(MNTMODLIBS) +mount_lustre_tgt_SOURCES = ${mount_lustre_SOURCES} +mount_lustre_tgt_CPPFLAGS = ${mount_lustre_CPPFLAGS} +mount_lustre_tgt_LDFLAGS = ${mount_lustre_LDFLAGS} +mount_lustre_tgt_LDADD = ${mount_lustre_LDADD} mkfs_lustre_SOURCES = mkfs_lustre.c mount_utils.c mount_utils.h $(GSSSRC) mkfs_lustre_CPPFLAGS := -UTUNEFS ${MNTMODCFLAGS} diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index d9962aa..9a29475 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -5342,7 +5342,7 @@ int llapi_target_check(int type_num, char **obd_type, char *dir) /* Is this a lustre fs? */ int llapi_is_lustre_mnttype(const char *type) { - return (strcmp(type, "lustre") == 0 || strcmp(type,"lustre_lite") == 0); + return strcmp(type, "lustre") == 0 || strcmp(type, "lustre_tgt") == 0; } /* Is this a lustre client fs? */ -- 1.8.3.1