From: Andreas Dilger Date: Wed, 9 Oct 2019 17:26:24 +0000 (-0600) Subject: LU-12842 utils: llog_print with snapshot name X-Git-Tag: 2.12.90~19 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=refs%2Fchanges%2F14%2F36414%2F2 LU-12842 utils: llog_print with snapshot name The lsnapshot utility creates filesystems named with generated hexadecimal strings. In some cases the filesystem name may start with a number instead of a character, which causes "lctl llog_print" (via llog_ioctl()) to consider the filesystem name invalid. Allow filesystem names in llog_ioctl() to start with a digit. Signed-off-by: Andreas Dilger Change-Id: Ib2054d5afbeaa3f661148fff834c29f83f5d98ad Reviewed-on: https://review.whamcloud.com/36414 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Ben Evans Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/llog_ioctl.c b/lustre/obdclass/llog_ioctl.c index 6c88632..1ee49ad 100644 --- a/lustre/obdclass/llog_ioctl.c +++ b/lustre/obdclass/llog_ioctl.c @@ -318,12 +318,13 @@ int llog_ioctl(const struct lu_env *env, struct llog_ctxt *ctxt, int cmd, struct llog_logid logid; int rc = 0; struct llog_handle *handle = NULL; - char *logname; + char *logname, start; ENTRY; logname = data->ioc_inlbuf1; - if (logname[0] == '#' || logname[0] == '[') { + start = logname[0]; + if (start == '#' || start == '[') { rc = str2logid(&logid, logname, data->ioc_inllen1); if (rc) RETURN(rc); @@ -331,8 +332,8 @@ int llog_ioctl(const struct lu_env *env, struct llog_ctxt *ctxt, int cmd, LLOG_OPEN_EXISTS); if (rc) RETURN(rc); - } else if (logname[0] == '$' || isalpha(logname[0])) { - if (logname[0] == '$') + } else if (start == '$' || isalpha(start) || isdigit(start)) { + if (start == '$') logname++; rc = llog_open(env, ctxt, &handle, NULL, logname, @@ -340,7 +341,10 @@ int llog_ioctl(const struct lu_env *env, struct llog_ctxt *ctxt, int cmd, if (rc) RETURN(rc); } else { - RETURN(-EINVAL); + rc = -EINVAL; + CDEBUG(D_INFO, "%s: invalid log name '%s': rc = %d\n", + ctxt->loc_obd->obd_name, logname, rc); + RETURN(rc); } rc = llog_init_handle(env, handle, 0, NULL);