Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ioctl interrupt #231

Merged
merged 13 commits into from
Jan 4, 2020
Merged

Ioctl interrupt #231

merged 13 commits into from
Jan 4, 2020

Conversation

mmichal10
Copy link
Contributor

No description provided.

@micrakow micrakow added the RFC Request For Comments label Dec 18, 2019
@mmichal10 mmichal10 force-pushed the ioclt-interrupt branch 5 times, most recently from 8dd1833 to f14d78f Compare December 19, 2019 11:24
@mmichal10 mmichal10 changed the title [RFC]Ioclt interrupt ]Ioclt interrupt Dec 19, 2019
@mmichal10 mmichal10 removed the RFC Request For Comments label Dec 19, 2019
@mmichal10 mmichal10 changed the title ]Ioclt interrupt Ioclt interrupt Dec 19, 2019
@mmichal10 mmichal10 force-pushed the ioclt-interrupt branch 6 times, most recently from b5c15ce to 2156544 Compare December 20, 2019 12:08
@arutk arutk changed the title Ioclt interrupt Ioctl interrupt Dec 20, 2019
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Outdated Show resolved Hide resolved
modules/cas_cache/layer_cache_management.c Show resolved Hide resolved
@mmichal10 mmichal10 force-pushed the ioclt-interrupt branch 4 times, most recently from 37a4be6 to 546f90b Compare January 2, 2020 14:19
Michal Mielewczyk added 3 commits January 2, 2020 09:22
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
After marking thread as ready to stop, CAS was waiting this for thread to exit
out of main execution loop (in _cas_io_queue_thread()). In case of management
queue it lead to deadlock because both stoping queue and main execution loop was
performed in the same execution context.

Since freeing memory is the only operation after stopping thread, it can be
moved just after the main thread loop. After this little reordering,
synchronising between _cas_stop_thread() and _cas_io_queue_thread() in no longer
needed, and no deadlock will occur.

This change is needed to put management qeueue from completion context. Without
this cachnge, there will be no possiblitiy to stop cache from completion context
and to make rollback.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
@mmichal10 mmichal10 force-pushed the ioclt-interrupt branch 2 times, most recently from 6f9802c to 585ae01 Compare January 2, 2020 15:36
Michal Mielewczyk added 10 commits January 2, 2020 18:34
Usually metadata probe is non time consuming. To avoid dealing with
synchronization problems, noninterruptible wait is performed.

This commit is part of patch that will handle interrupt of waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
They are usually not time comsuming operations, so risk of hung task is low.
So it's easier to temporarily disable interrupts instead of properly handle
async completion.

This commit is part of patch that will handle interrupt of waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is part of patch that will allow to interrupt waiting for OCF
operation.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When context was allocated on the stack and waiting for completion was
interrupted, completion function would attempt to save lock/unlock result in
memory which might in use by other process. This would cause a system crash.

To prevent such scenario, context is allocated dynamiclly and extended with
reference counter. In case of interrupt, completion function doesn't have to
save result in context, it can simply free it's memory.

This commit is part of patch that will allow to interrupt waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When context was allocated on the stack and waiting for completion was
interrupted, completion function would attempt to save flush result in
memory which might in use by other process. This would cause a system crash.

To prevent such scenario, context is allocated dynamiclly and extended with
reference counter. In case of interrupt, completion function doesn't have to
save result in context, it can simply free it's memory.

This commit is part of patch that will allow to interrupt waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When context was allocated on the stack and waiting for completion was
interrupted, completion function would attempt to save flush result in
memory which might in use by other process. This would cause a system crash.

To prevent such scenario, context is allocated dynamiclly and extended with
reference counter. In case of interrupt, completion function doesn't have to
save result in context, it can simply free it's memory.

This commit also enables possibility to interrupt regular flush properly, by
seding SIGING to casadm.

This commit is part of patch that will allow to interrupt waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
When device used as cache had a big size, it took a lot of time to initialize.
If user would interrupt waiting, asyc OCF init procedure would continue, but
after finish, there was nobody to perfrom kernel part of start nor error
handling.

Now error handling and kernel part of start procedure are moved to completion.
If user will interrupt waiting at any point, newly started cache instance will
be stopped.

Since cache init and load vary only with check for old metadata and initializing
exported objects, they are now merged into one function.

Async cache stop is part of this commit because it was needed for rollback path.

Load, init and stop have common context, because in case of non interrupted
attach CAS needs to wait for rollback to be completed. Common context makes
passing `struct completion` easier between load, init and stop.

This commit is part of patch that will allow to interrupt waiting for OCF
operations.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
In current OCF cache stop implemetation no error should occur, so there is no
need to handle it in adapter.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
If waiting for the operation to finish was interrupted, casadm should print
informative error message.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
@mmichal10 mmichal10 force-pushed the ioclt-interrupt branch 4 times, most recently from c9aa8e7 to 9a42ad7 Compare January 3, 2020 15:38
@robertbaldyga robertbaldyga merged commit d53c7ba into Open-CAS:master Jan 4, 2020
vzhereb9 pushed a commit to vzhereb9/open-cas-linux that referenced this pull request Jun 14, 2021
…policy

Initialize promotion policy before cleaning policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants