[Devel] [PATCH RHEL7 COMMIT] ploop: push_backup: copy stop status back to userspace
Konstantin Khorenko
khorenko at virtuozzo.com
Tue May 31 02:04:32 PDT 2016
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.9
------>
commit 430d4430f36cc0d540e608fb0b98d04a80f6f4ef
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date: Tue May 31 13:04:32 2016 +0400
ploop: push_backup: copy stop status back to userspace
ploop_push_backup_stop() calls ploop_pb_destroy(). The latter saves the
return code of ploop_pb_stop() in ctl.status. But we have to do copy_to_user()
afterwards to make it visible in userspace.
Overall, if in userspace ioctl(PLOOP_IOC_PUSH_BACKUP_STOP) succeeded, the user
can check ctl.status to see how it went. Possible values are:
0 -- OK
>0 -- number of suspended requests "in flight"
<0 -- a reason (like -ENOMEM or -EBADF) why CBT merge failed.
https://jira.sw.ru/browse/PSBM-47429
Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
drivers/block/ploop/dev.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 880907f..96f7850 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4683,6 +4683,7 @@ static int ploop_push_backup_stop(struct ploop_device *plo, unsigned long arg)
{
struct ploop_pushbackup_desc *pbd = plo->pbd;
struct ploop_push_backup_stop_ctl ctl;
+ int ret;
if (plo->maintenance_type != PLOOP_MNTN_PUSH_BACKUP)
return -EINVAL;
@@ -4696,7 +4697,11 @@ static int ploop_push_backup_stop(struct ploop_device *plo, unsigned long arg)
return -EINVAL;
}
- return ploop_pb_destroy(plo, &ctl.status);
+ ret = ploop_pb_destroy(plo, &ctl.status);
+ if (ret)
+ return ret;
+
+ return copy_to_user((void*)arg, &ctl, sizeof(ctl));
}
static int ploop_ioctl(struct block_device *bdev, fmode_t fmode, unsigned int cmd,
More information about the Devel
mailing list