[Devel] [PATCH rh7] ploop: push_backup: copy stop status back to userspace
Maxim Patlasov
mpatlasov at virtuozzo.com
Fri May 27 11:24:52 PDT 2016
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