[Devel] [PATCH RHEL7 COMMIT] ploop: kthread_create() errors processing
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Sep 26 17:43:48 MSK 2018
The commit is pushed to "branch-rh7-3.10.0-862.11.6.vz7.71.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.11.6.vz7.71.14
------>
commit d699ffb298410ffcc2f1c7fd0239da22a888cb27
Author: Vasily Averin <vvs at virtuozzo.com>
Date: Wed Sep 26 17:43:48 2018 +0300
ploop: kthread_create() errors processing
kthread_create() returns not NULL but ERR_PTR in case of internal failures.
https://jira.sw.ru/browse/PSBM-88561
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
Reviewed-by: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
v2: extra netfilter hunks was removed.
---
drivers/block/ploop/io_direct.c | 10 +++++++---
drivers/block/ploop/io_kaio.c | 11 +++++++----
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 6ea98901b7d4..56c3559b179e 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -1004,7 +1004,9 @@ static int dio_open(struct ploop_io * io)
io->fsync_thread = kthread_create(dio_fsync_thread,
io, "ploop_fsync%d",
delta->plo->index);
- if (io->fsync_thread == NULL) {
+ if (IS_ERR(io->fsync_thread)) {
+ err = PTR_ERR(io->fsync_thread);
+ io->fsync_thread = NULL;
io->files.em_tree = NULL;
ploop_dio_close(io, 0);
goto out;
@@ -1731,9 +1733,11 @@ static int dio_prepare_merge(struct ploop_io * io, struct ploop_snapdata *sd)
io->fsync_thread = kthread_create(dio_fsync_thread,
io, "ploop_fsync%d",
io->plo->index);
- if (io->fsync_thread == NULL) {
+ if (IS_ERR(io->fsync_thread)) {
+ err = PTR_ERR(io->fsync_thread);
+ io->fsync_thread = NULL;
fput(file);
- return -ENOMEM;
+ return err;
}
wake_up_process(io->fsync_thread);
}
diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
index 48baa447ef91..1ea63de3030b 100644
--- a/drivers/block/ploop/io_kaio.c
+++ b/drivers/block/ploop/io_kaio.c
@@ -887,9 +887,11 @@ static int kaio_open(struct ploop_io * io)
io->fsync_thread = kthread_create(kaio_fsync_thread,
io, "ploop_fsync%d",
delta->plo->index);
- if (io->fsync_thread == NULL) {
+ if (IS_ERR(io->fsync_thread)) {
+ err = PTR_ERR(io->fsync_thread);
+ io->fsync_thread = NULL;
ploop_kaio_close(io->files.mapping, 0);
- return -ENOMEM;
+ return err;
}
wake_up_process(io->fsync_thread);
@@ -985,8 +987,9 @@ static int kaio_prepare_merge(struct ploop_io * io, struct ploop_snapdata *sd)
io->fsync_thread = kthread_create(kaio_fsync_thread,
io, "ploop_fsync%d",
io->plo->index);
- if (io->fsync_thread == NULL) {
- err = -ENOMEM;
+ if (IS_ERR(io->fsync_thread)) {
+ err = PTR_ERR(io->fsync_thread);
+ io->fsync_thread = NULL;
goto prep_merge_done;
}
More information about the Devel
mailing list