Browse Source

lvm2: finally fix memory locking issues on musl

Always use mlockall fixes it, still trying to keep everything else
as untouched as possible.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Daniel Golle 9 years ago
parent
commit
855fdd21d1
2 changed files with 21 additions and 2 deletions
  1. 1
    1
      utils/lvm2/Makefile
  2. 20
    1
      utils/lvm2/patches/003-no-mallinfo.patch

+ 1
- 1
utils/lvm2/Makefile View File

@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
10 10
 
11 11
 PKG_NAME:=LVM2
12 12
 PKG_VERSION:=2.02.119
13
-PKG_RELEASE:=1
13
+PKG_RELEASE:=2
14 14
 PKG_LICENSE:=GPL-2.0 LGPL-2.1
15 15
 
16 16
 PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tgz

+ 20
- 1
utils/lvm2/patches/003-no-mallinfo.patch View File

@@ -18,11 +18,30 @@ Index: LVM2.2.02.119/lib/mm/memlock.c
18 18
  		inf = mallinfo();
19 19
  
20 20
  		if (hblks < inf.hblks) {
21
-@@ -179,6 +182,7 @@ static void _allocate_memory(void)
21
+@@ -176,9 +179,12 @@ static void _allocate_memory(void)
22
+ 			free(areas[area]);
23
+ 			_size_malloc_tmp /= 2;
24
+ 		} else {
25
++#endif
22 26
  			++ area;
23 27
  			missing -= _size_malloc_tmp;
28
++#ifdef __GLIBC__
24 29
  		}
25 30
 +#endif
26 31
  
27 32
  		if (area == max_areas && missing > 0) {
28 33
  			/* Too bad. Warn the user and proceed, as things are
34
+@@ -467,8 +473,13 @@ static void _lock_mem(struct cmd_context
35
+ 	 * will not block memory locked thread
36
+ 	 * Note: assuming _memlock_count_daemon is updated before _memlock_count
37
+ 	 */
38
++#ifdef __GLIBC__
39
+ 	_use_mlockall = _memlock_count_daemon ? 1 :
40
+ 		find_config_tree_bool(cmd, activation_use_mlockall_CFG, NULL);
41
++#else
42
++	/* always use mlockall on musl */
43
++	_use_mlockall = 1;
44
++#endif
45
+ 
46
+ 	if (!_use_mlockall) {
47
+ 		if (!*_procselfmaps &&