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

Fix arc_adapt() spinning in iterate_supers_type() #1595

Closed
wants to merge 1 commit into from

Conversation

behlendorf
Copy link
Contributor

The iterate_supers_type() function which was introduced in the
3.0 kernel was supposed to provide a safe way to call an arbitrary
function on all super blocks of a specific type. Unfortunately,
because a list_head was used a bug was introduced which made it
possible for iterate_supers_type() to get stuck spinning on a
super block which was just deactivated.

The bug was fixed in the 3.3 kernel by converting the list_head
to an hlist_node. However, to resolve the issue for existing
3.0 - 3.2 kernels we detect when a list_head is used. Then to
prevent the spinning from occurring the .next pointer is set to
the fs_supers list_head which ensures the iterate_supers_type()
function will always terminate.

Signed-off-by: Brian Behlendorf behlendorf1@llnl.gov
Issue #1045
Issue #861
Issue #790

The iterate_supers_type() function which was introduced in the
3.0 kernel was supposed to provide a safe way to call an arbitrary
function on all super blocks of a specific type.  Unfortunately,
because a list_head was used a bug was introduced which made it
possible for iterate_supers_type() to get stuck spinning on a
super block which was just deactivated.

The bug was fixed in the 3.3 kernel by converting the list_head
to an hlist_node.  However, to resolve the issue for existing
3.0 - 3.2 kernels we detect when a list_head is used.  Then to
prevent the spinning from occurring the .next pointer is set to
the fs_supers list_head which ensures the iterate_supers_type()
function will always terminate.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue openzfs#1045
Issue openzfs#861
Issue openzfs#790
@behlendorf
Copy link
Contributor Author

@ryao @prakashsurya Can you please review this.

@prakashsurya
Copy link
Member

I'm not trilled by this, but options are limited with kernel defects. Running with a debug kernel might cause issues since we're essentially corruption the sb->s_instances.next field, but that might just fall into the "don't do that" category for 3.0 - 3.2 kernels. Since the impact is minimal, and it targets only a select few kernels, I'm not opposed to fixing this issue this way. The only other solution I can think of, is to use the ugly hack we do for pre-3.0 kernels.

Ack.

@behlendorf
Copy link
Contributor Author

dba1d70 Fix arc_adapt() spinning in iterate_supers_type()

@behlendorf behlendorf closed this Jul 17, 2013
@behlendorf behlendorf deleted the issue-790 branch February 16, 2017 00:29
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