From 6b4ac8000afc1565f14ea2894cbfc73c5d424a5c Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Wed, 3 Apr 2013 16:46:49 +0800 Subject: [PATCH] LU-2008 utils: make label method work with mmp enabled target Commit cfef795 introduced label methods for ldiskfs and zfs to make mount utility update the label after the first successful mount. However, if the MMP feature was enabled on an ldiskfs target before mounting, running mount utility on the target will fail at ldiskfs_label_lustre() because MMP will prevent e2label from setting the label. This patch fixes the above issue by using "tune2fs -f -L" to force setting the label instead of using e2label in ldiskfs_label_lustre(). Test-Parameters: envdefinitions=SLOW=yes \ clientcount=4 osscount=2 mdscount=2 \ austeroptions=-R failover=true useiscsi=true \ testlist=mmp Signed-off-by: Jian Yu Change-Id: I6af753d1d841da6493402c153a695eb07ee7ce5b Reviewed-on: http://review.whamcloud.com/5867 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/utils/mount_utils_ldiskfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lustre/utils/mount_utils_ldiskfs.c b/lustre/utils/mount_utils_ldiskfs.c index b8efddc..a157a2a 100644 --- a/lustre/utils/mount_utils_ldiskfs.c +++ b/lustre/utils/mount_utils_ldiskfs.c @@ -1016,8 +1016,9 @@ int ldiskfs_label_lustre(struct mount_opts *mop) char label_cmd[PATH_MAX]; int rc; - snprintf(label_cmd, sizeof(label_cmd), E2LABEL" %s %s", - mop->mo_source, mop->mo_ldd.ldd_svname); + snprintf(label_cmd, sizeof(label_cmd), + TUNE2FS" -f -L %s %s >/dev/null 2>&1", + mop->mo_ldd.ldd_svname, mop->mo_source); rc = run_command(label_cmd, sizeof(label_cmd)); return rc; -- 1.8.3.1