Whamcloud - gitweb
LU-13683 lfs: return -ENOENT when invoked on non-existing file 53/38953/6
authorSebastien Piechurski <sebastien.piechurski@atos.net>
Tue, 16 Jun 2020 16:14:55 +0000 (18:14 +0200)
committerOleg Drokin <green@whamcloud.com>
Thu, 19 Nov 2020 10:20:03 +0000 (10:20 +0000)
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

Signed-off-by: Sebastien Piechurski <sebastien.piechurski@atos.net>
Change-Id: I910eae78445f6071ff4e741afd43d140f554ab22
Fixes: 8bedfa377fbd ("LU-11510 lfs: migrate a composite layout file correctly")
Reviewed-on: https://review.whamcloud.com/38953
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>

index d2046d7..9076991 100644 (file)
@@ -4041,8 +4041,10 @@ static int lfs_setstripe_internal(int argc, char **argv,
                        layout = llapi_layout_get_by_path(template ?: fname, 0);
                        if (!layout) {
-                                       "%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;