Skip to content

Commit eee2808

Browse files
committed
Merge tag 'mm-hotfixes-stable-2024-09-27-09-45' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "19 hotfixes. 13 are cc:stable. There's a focus on fixes for the memfd_pin_folios() work which was added into 6.11. Apart from that, the usual shower of singleton fixes" * tag 'mm-hotfixes-stable-2024-09-27-09-45' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: ocfs2: fix uninit-value in ocfs2_get_block() zram: don't free statically defined names memory tiers: use default_dram_perf_ref_source in log message Revert "list: test: fix tests for list_cut_position()" kselftests: mm: fix wrong __NR_userfaultfd value compiler.h: specify correct attribute for .rodata..c_jump_table mm/damon/Kconfig: update DAMON doc URL mm: kfence: fix elapsed time for allocated/freed track ocfs2: fix deadlock in ocfs2_get_system_file_inode ocfs2: reserve space for inline xattr before attaching reflink tree mm: migrate: annotate data-race in migrate_folio_unmap() mm/hugetlb: simplify refs in memfd_alloc_folio mm/gup: fix memfd_pin_folios alloc race panic mm/gup: fix memfd_pin_folios hugetlb page allocation mm/hugetlb: fix memfd_pin_folios resv_huge_pages leak mm/hugetlb: fix memfd_pin_folios free_huge_pages leak mm/filemap: fix filemap_get_folios_contig THP panic mm: make SPLIT_PTE_PTLOCKS depend on SMP tools: fix shared radix-tree build
2 parents 3630400 + 2af148e commit eee2808

File tree

22 files changed

+104
-41
lines changed

22 files changed

+104
-41
lines changed

drivers/block/zram/zram_drv.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,8 +2115,10 @@ static void zram_destroy_comps(struct zram *zram)
21152115
zram->num_active_comps--;
21162116
}
21172117

2118-
for (prio = ZRAM_SECONDARY_COMP; prio < ZRAM_MAX_COMPS; prio++) {
2119-
kfree(zram->comp_algs[prio]);
2118+
for (prio = ZRAM_PRIMARY_COMP; prio < ZRAM_MAX_COMPS; prio++) {
2119+
/* Do not free statically defined compression algorithms */
2120+
if (zram->comp_algs[prio] != default_compressor)
2121+
kfree(zram->comp_algs[prio]);
21202122
zram->comp_algs[prio] = NULL;
21212123
}
21222124

fs/ocfs2/aops.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
156156
err = ocfs2_extent_map_get_blocks(inode, iblock, &p_blkno, &count,
157157
&ext_flags);
158158
if (err) {
159-
mlog(ML_ERROR, "Error %d from get_blocks(0x%p, %llu, 1, "
160-
"%llu, NULL)\n", err, inode, (unsigned long long)iblock,
161-
(unsigned long long)p_blkno);
159+
mlog(ML_ERROR, "get_blocks() failed, inode: 0x%p, "
160+
"block: %llu\n", inode, (unsigned long long)iblock);
162161
goto bail;
163162
}
164163

fs/ocfs2/extent_map.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,13 @@ int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,
973973
}
974974

975975
while (done < nr) {
976-
down_read(&OCFS2_I(inode)->ip_alloc_sem);
976+
if (!down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem)) {
977+
rc = -EAGAIN;
978+
mlog(ML_ERROR,
979+
"Inode #%llu ip_alloc_sem is temporarily unavailable\n",
980+
(unsigned long long)OCFS2_I(inode)->ip_blkno);
981+
break;
982+
}
977983
rc = ocfs2_extent_map_get_blocks(inode, v_block + done,
978984
&p_block, &p_count, NULL);
979985
up_read(&OCFS2_I(inode)->ip_alloc_sem);

fs/ocfs2/refcounttree.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "namei.h"
2626
#include "ocfs2_trace.h"
2727
#include "file.h"
28+
#include "symlink.h"
2829

2930
#include <linux/bio.h>
3031
#include <linux/blkdev.h>
@@ -4148,8 +4149,9 @@ static int __ocfs2_reflink(struct dentry *old_dentry,
41484149
int ret;
41494150
struct inode *inode = d_inode(old_dentry);
41504151
struct buffer_head *new_bh = NULL;
4152+
struct ocfs2_inode_info *oi = OCFS2_I(inode);
41514153

4152-
if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) {
4154+
if (oi->ip_flags & OCFS2_INODE_SYSTEM_FILE) {
41534155
ret = -EINVAL;
41544156
mlog_errno(ret);
41554157
goto out;
@@ -4175,14 +4177,34 @@ static int __ocfs2_reflink(struct dentry *old_dentry,
41754177
goto out_unlock;
41764178
}
41774179

4180+
if ((oi->ip_dyn_features & OCFS2_HAS_XATTR_FL) &&
4181+
(oi->ip_dyn_features & OCFS2_INLINE_XATTR_FL)) {
4182+
/*
4183+
* Adjust extent record count to reserve space for extended attribute.
4184+
* Inline data count had been adjusted in ocfs2_duplicate_inline_data().
4185+
*/
4186+
struct ocfs2_inode_info *new_oi = OCFS2_I(new_inode);
4187+
4188+
if (!(new_oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) &&
4189+
!(ocfs2_inode_is_fast_symlink(new_inode))) {
4190+
struct ocfs2_dinode *new_di = (struct ocfs2_dinode *)new_bh->b_data;
4191+
struct ocfs2_dinode *old_di = (struct ocfs2_dinode *)old_bh->b_data;
4192+
struct ocfs2_extent_list *el = &new_di->id2.i_list;
4193+
int inline_size = le16_to_cpu(old_di->i_xattr_inline_size);
4194+
4195+
le16_add_cpu(&el->l_count, -(inline_size /
4196+
sizeof(struct ocfs2_extent_rec)));
4197+
}
4198+
}
4199+
41784200
ret = ocfs2_create_reflink_node(inode, old_bh,
41794201
new_inode, new_bh, preserve);
41804202
if (ret) {
41814203
mlog_errno(ret);
41824204
goto inode_unlock;
41834205
}
41844206

4185-
if (OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_XATTR_FL) {
4207+
if (oi->ip_dyn_features & OCFS2_HAS_XATTR_FL) {
41864208
ret = ocfs2_reflink_xattrs(inode, old_bh,
41874209
new_inode, new_bh,
41884210
preserve);

fs/ocfs2/xattr.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6511,16 +6511,7 @@ static int ocfs2_reflink_xattr_inline(struct ocfs2_xattr_reflink *args)
65116511
}
65126512

65136513
new_oi = OCFS2_I(args->new_inode);
6514-
/*
6515-
* Adjust extent record count to reserve space for extended attribute.
6516-
* Inline data count had been adjusted in ocfs2_duplicate_inline_data().
6517-
*/
6518-
if (!(new_oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) &&
6519-
!(ocfs2_inode_is_fast_symlink(args->new_inode))) {
6520-
struct ocfs2_extent_list *el = &new_di->id2.i_list;
6521-
le16_add_cpu(&el->l_count, -(inline_size /
6522-
sizeof(struct ocfs2_extent_rec)));
6523-
}
6514+
65246515
spin_lock(&new_oi->ip_lock);
65256516
new_oi->ip_dyn_features |= OCFS2_HAS_XATTR_FL | OCFS2_INLINE_XATTR_FL;
65266517
new_di->i_dyn_features = cpu_to_le16(new_oi->ip_dyn_features);

include/linux/compiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
133133
#define annotate_unreachable() __annotate_unreachable(__COUNTER__)
134134

135135
/* Annotate a C jump table to allow objtool to follow the code flow */
136-
#define __annotate_jump_table __section(".rodata..c_jump_table")
136+
#define __annotate_jump_table __section(".rodata..c_jump_table,\"a\",@progbits #")
137137

138138
#else /* !CONFIG_OBJTOOL */
139139
#define annotate_reachable()

include/linux/hugetlb.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,9 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,
692692
struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid,
693693
nodemask_t *nmask, gfp_t gfp_mask,
694694
bool allow_alloc_fallback);
695+
struct folio *alloc_hugetlb_folio_reserve(struct hstate *h, int preferred_nid,
696+
nodemask_t *nmask, gfp_t gfp_mask);
697+
695698
int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping,
696699
pgoff_t idx);
697700
void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma,
@@ -1059,6 +1062,13 @@ static inline struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,
10591062
return NULL;
10601063
}
10611064

1065+
static inline struct folio *
1066+
alloc_hugetlb_folio_reserve(struct hstate *h, int preferred_nid,
1067+
nodemask_t *nmask, gfp_t gfp_mask)
1068+
{
1069+
return NULL;
1070+
}
1071+
10621072
static inline struct folio *
10631073
alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid,
10641074
nodemask_t *nmask, gfp_t gfp_mask,

lib/list-test.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,10 @@ static void list_test_list_cut_position(struct kunit *test)
408408

409409
KUNIT_EXPECT_EQ(test, i, 2);
410410

411-
i = 0;
412411
list_for_each(cur, &list1) {
413412
KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
414413
i++;
415414
}
416-
417-
KUNIT_EXPECT_EQ(test, i, 1);
418415
}
419416

420417
static void list_test_list_cut_before(struct kunit *test)
@@ -439,13 +436,10 @@ static void list_test_list_cut_before(struct kunit *test)
439436

440437
KUNIT_EXPECT_EQ(test, i, 1);
441438

442-
i = 0;
443439
list_for_each(cur, &list1) {
444440
KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
445441
i++;
446442
}
447-
448-
KUNIT_EXPECT_EQ(test, i, 2);
449443
}
450444

451445
static void list_test_list_splice(struct kunit *test)

mm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
595595
config SPLIT_PTE_PTLOCKS
596596
def_bool y
597597
depends on MMU
598+
depends on SMP
598599
depends on NR_CPUS >= 4
599600
depends on !ARM || CPU_CACHE_VIPT
600601
depends on !PARISC || PA20

mm/damon/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ config DAMON
99
access frequency of each memory region. The information can be useful
1010
for performance-centric DRAM level memory management.
1111

12-
See https://damonitor.github.io/doc/html/latest-damon/index.html for
12+
See https://www.kernel.org/doc/html/latest/mm/damon/index.html for
1313
more information.
1414

1515
config DAMON_KUNIT_TEST

0 commit comments

Comments
 (0)