From 18fa5cc885539b7beb79fed5061b0fffbb8fa090 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Wed, 16 May 2018 16:18:33 -0600 Subject: [PATCH] LU-10921 utils: improve lfs setstripe error message Improve the error messages when "lfs setstripe" or "lfs setdirstripe" is run on an existing file/directory. Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: I3b21fb65847822c73713e9a26d6dea978b3cab07 Reviewed-on: https://review.whamcloud.com/32442 Reviewed-by: Mike Pershin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Ben Evans Reviewed-by: Oleg Drokin --- lustre/utils/liblustreapi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 351990d..40c6c65 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -762,9 +762,7 @@ retry_open: errmsg = strerror(errno); llapi_err_noerrno(LLAPI_MSG_ERROR, - "error on ioctl %#jx for '%s' (%d): %s", - (uintmax_t)LL_IOC_LOV_SETSTRIPE, name, fd, - errmsg); + "setstripe error for '%s': %s", name, errmsg); close(fd); fd = rc; @@ -969,8 +967,8 @@ int llapi_dir_set_default_lmv(const char *name, errmsg = strerror(errno); llapi_err_noerrno(LLAPI_MSG_ERROR, - "error on LL_IOC_LMV_SETSTRIPE '%s' (%d): %s", - name, fd, errmsg); + "default dirstripe error on '%s': %s", + name, errmsg); } close(fd); return rc; @@ -1066,13 +1064,13 @@ int llapi_dir_create(const char *name, mode_t mode, if (ioctl(fd, LL_IOC_LMV_SETSTRIPE, buf)) { char *errmsg = "stripe already set"; + rc = -errno; if (errno != EEXIST && errno != EALREADY) errmsg = strerror(errno); llapi_err_noerrno(LLAPI_MSG_ERROR, - "error on LL_IOC_LMV_SETSTRIPE '%s' (%d): %s", - name, fd, errmsg); + "dirstripe error on '%s': %s", name, errmsg); } close(fd); out: -- 1.8.3.1