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

Close block devices in a synchronous manner #1481

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

mmichal10
Copy link
Contributor

fput() doesn't wait for all references on the disk to be unclaimed but instead it only schedules a worker that is supposed to cleanup resources once the device is released.

During cache initialization we open device at least twice - to check its properties and then to actually use it as cache. But since we use the async fput() after the probe, the device might still be in use once we try to open it for the second time (the second open returns -EBUSY).

Using synchronous __fput_sync() to close the device fixes the issue

jfckm
jfckm previously approved these changes Jul 23, 2024
configure.d/1_bdev_release.conf Outdated Show resolved Hide resolved
@mmichal10 mmichal10 force-pushed the fput-sync branch 3 times, most recently from 43c5222 to 00e44c1 Compare July 25, 2024 12:58
fput() doesn't wait for all references on the disk to be unclaimed but instead
it only schedules a worker that is supposed to cleanup resources once the device
is released.

During cache initialization we open device at least twice - to check its
properties and then to actually use it as cache. But since we use the async
fput() after the probe, the device might still be in use once we try to open it
for the second time (the second open returns -EBUSY).

Using synchronous __fput_sync() to close the device fixes the issue

__fput_sync() exists in the kernel API longer than bdev_file_open_by_path() and
the presence of the latter is the condition to use the synchronous put so it is
perfectly safe to get rid of fput() from the configure framework

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
@robertbaldyga robertbaldyga merged commit 6c0829d into Open-CAS:master Jul 31, 2024
2 checks passed
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.

3 participants