Whamcloud - gitweb
EX-3480 pcc: set return code with errno
authorQian Yingjin <qian@ddn.com>
Wed, 14 Jul 2021 08:41:02 +0000 (16:41 +0800)
committerLi Xi <lixi@ddn.com>
Thu, 15 Jul 2021 13:28:20 +0000 (13:28 +0000)
In liblustreapi_pcc.c, it should set errno on error return.

Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: Ibc80ea7a593f153744f10483720db9cb79ef060a
Reviewed-on: https://review.whamcloud.com/44302
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/utils/liblustreapi_pcc.c

index e7a4ced..35aca6a 100644 (file)
@@ -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;
        }