From: Sebastien Piechurski Date: Tue, 16 Jun 2020 16:14:55 +0000 (+0200) Subject: LU-13683 lfs: return -ENOENT when invoked on non-existing file X-Git-Tag: 2.13.57~67 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F53%2F38953%2F6;p=fs%2Flustre-release.git LU-13683 lfs: return -ENOENT when invoked on non-existing file Since merge of LU-11510, lfs migrate on a non-existing file will give the following error "lfs migrate: can't create composite layout from file /some/path/to/file" and will exit with code 0, potentially leaving a calling script unaware of the error. This patch fixes it by using errno which is set in the call to llapi_layout_get_by_path() Signed-off-by: Sebastien Piechurski Change-Id: I910eae78445f6071ff4e741afd43d140f554ab22 Fixes: 8bedfa377fbd ("LU-11510 lfs: migrate a composite layout file correctly") Reviewed-on: https://review.whamcloud.com/38953 Tested-by: jenkins Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index d2046d7..9076991 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -4041,8 +4041,10 @@ static int lfs_setstripe_internal(int argc, char **argv, layout = llapi_layout_get_by_path(template ?: fname, 0); if (!layout) { fprintf(stderr, - "%s: can't create composite layout from file %s.\n", - progname, template ?: fname); + "%s: can't create composite layout from file %s: %s\n", + progname, template ?: fname, + strerror(errno)); + result = -errno; goto error; } }