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

A collection of bug fixes designed to make zvol minor functionality more robust #4346

Closed
wants to merge 1 commit into from

Conversation

bprotopopov
Copy link
Contributor

Close the race window in zvol_open() to prevent removal of
zvol_state in the 'first open' code path. Move the call to
check_disk_change() under zvol_state_lock to make sure the
zvol_media_changed() and zvol_revalidate_disk() called by
check_disk_change() are invoked with positive zv_open_count.

Skip opened zvols when removing minors and set private_data
to NULL for zvols that are not in use whose minors are being
removed, to indicate to zvol_open() that the state is gone.
Skip opened zvols when renaming minors to avoid modifying
zv_name that might be in use, e.g. in zvol_ioctl().

Drop zvol_state_lock before calling add_disk() when creating
minors to avoid deadlocks with zvol_open().

Wrap dmu_objset_find() with spl_fstran_mark()/unmark().

@bprotopopov bprotopopov changed the title Close the race window in zvol_open() to prevent removal of A collection of bug fixes designed to make zvol minor functionality more robust Feb 18, 2016
@bprotopopov
Copy link
Contributor Author

This pull request addresses bug #4344.

@behlendorf
Copy link
Contributor

Nice, it's great to see all these edge cases fixed. This LGTM and passed the manual testing I did. It would be ideal if we could add your test script to zconfig.sh, but that could wait for a follow up patch.

@ryao
Copy link
Contributor

ryao commented Feb 19, 2016

This looks good to me too.

@behlendorf
Copy link
Contributor

@bprotopopov if you're happy with this as a final version I'll merge it to master.

@bprotopopov
Copy link
Contributor Author

Hi, @behlendorf,
I can look into adding the test in to zconfig.sh as well in a follow up patch.
Can you please give me a moment to confirm with my employer if they wanted to include the Copyright message.

zvol_state in the 'first open' code path. Move the call to
check_disk_change() under zvol_state_lock to make sure the
zvol_media_changed() and zvol_revalidate_disk() called by
check_disk_change() are invoked with positive zv_open_count.

Skip opened zvols when removing minors and set private_data
to NULL for zvols that are not in use whose minors are being
removed, to indicate to zvol_open() that the state is gone.
Skip opened zvols when renaming minors to avoid modifying
zv_name that might be in use, e.g. in zvol_ioctl().

Drop zvol_state_lock before calling add_disk() when creating
minors to avoid deadlocks with zvol_open().

Wrap dmu_objset_find() with spl_fstran_mark()/unmark().
@bprotopopov
Copy link
Contributor Author

Added Copyright lines in the comments.
@behlendorf, I am all set with this commit.

@ryao
Copy link
Contributor

ryao commented Feb 24, 2016

@bprotopopov This needs to be rebased against HEAD.

@behlendorf
Copy link
Contributor

@bprotopopov great, I can take care of the rebase when I apply it to master. I should be able to get it merged today.

@bprotopopov
Copy link
Contributor Author

@behlendorf appreciate it

@behlendorf
Copy link
Contributor

Merged as:

5428dc5 Make zvol minor functionality more robust

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