From: Qian Yingjin Date: Wed, 14 Jul 2021 08:41:02 +0000 (+0800) Subject: EX-3480 pcc: set return code with errno X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=414928cf6b8c785a2da7a7473cc9f2cf223fc83b;p=fs%2Flustre-release.git EX-3480 pcc: set return code with errno In liblustreapi_pcc.c, it should set errno on error return. Signed-off-by: Qian Yingjin Change-Id: Ibc80ea7a593f153744f10483720db9cb79ef060a Reviewed-on: https://review.whamcloud.com/44302 Reviewed-by: John L. Hammond Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo --- diff --git a/lustre/utils/liblustreapi_pcc.c b/lustre/utils/liblustreapi_pcc.c index e7a4ced..35aca6a 100644 --- a/lustre/utils/liblustreapi_pcc.c +++ b/lustre/utils/liblustreapi_pcc.c @@ -260,7 +260,7 @@ int llapi_pcc_detach_fd(int fd, __u32 flags) detach.pccd_flags = flags; rc = ioctl(fd, LL_IOC_PCC_DETACH, &detach); - return rc; + return rc ? -errno : 0; } /** @@ -282,7 +282,7 @@ int llapi_pcc_detach_at(int dirfd, const struct lu_fid *fid, }; rc = ioctl(dirfd, LL_IOC_PCC_DETACH_BY_FID, &detach); - return rc; + return rc ? -errno : 0; } /** @@ -318,6 +318,9 @@ int llapi_pcc_detach_fid(const char *mntpath, const struct lu_fid *fid, detach.pccd_fid = *fid; detach.pccd_flags = flags; rc = ioctl(fd, LL_IOC_PCC_DETACH_BY_FID, &detach); + if (rc < 0) + rc = -errno; + close(fd); return rc; } @@ -602,7 +605,8 @@ static int llapi_pcc_scan_detach(const char *pname, const char *fname, rc = ioctl(hsc->hsc_mntfd, LL_IOC_PCC_DETACH_BY_FID, &detach); if (rc) { - llapi_printf(LLAPI_MSG_DEBUG, + rc = -errno; + llapi_error(LLAPI_MSG_ERROR, rc, "failed to detach file: %s\n", fidname); return rc; }