forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix arc_adapt() spinning in iterate_supers_type()
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
- Loading branch information
1 parent
7635167
commit 8985aac
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,40 @@ AC_DEFUN([ZFS_AC_KERNEL_SHRINK], [ | |
]) | ||
]) | ||
|
||
dnl # | ||
dnl # 3.3 API change | ||
dnl # The super_block structure was changed to use an hlist_node instead | ||
dnl # of a list_head for the .s_instance linkage. | ||
dnl # | ||
dnl # This was done in part to resolve a race in the iterate_supers_type() | ||
dnl # function which was introduced in Linux 3.0 kernel. The iterator | ||
dnl # was supposed to provide a safe way to call an arbitrary function on | ||
dnl # all super blocks of a specific type. Unfortunately, because a | ||
dnl # list_head was used it was possible for iterate_supers_type() to | ||
dnl # get stuck spinning a super block which was just deactivated. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
behlendorf
Author
Owner
|
||
dnl # | ||
dnl # To resolve the issue for existing 3.0 - 3.2 kernels we detect when | ||
dnl # a list_head is used. Then to prevent the spinning from occurring | ||
dnl # the .next pointer is set to the fs_supers list_head which ensures | ||
dnl # the iterate_supers_type() function will always terminate. | ||
dnl # | ||
AC_DEFUN([ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD], [ | ||
AC_MSG_CHECKING([whether super_block has s_instances list_head]) | ||
ZFS_LINUX_TRY_COMPILE([ | ||
#include <linux/fs.h> | ||
],[ | ||
struct super_block sb __attribute__ ((unused)); | ||
INIT_LIST_HEAD(&sb.s_instances); | ||
],[ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_S_INSTANCES_LIST_HEAD, 1, | ||
[struct super_block has s_instances list_head]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
]) | ||
|
||
AC_DEFUN([ZFS_AC_KERNEL_NR_CACHED_OBJECTS], [ | ||
AC_MSG_CHECKING([whether sops->nr_cached_objects() exists]) | ||
ZFS_LINUX_TRY_COMPILE([ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Would you elaborate on the mechanism for this spinning? I am having trouble seeing it from this description.