linux-stable/fs/ntfs3
Ism Hong 1c005ce993 fs/ntfs3: use non-movable memory for ntfs3 MFT buffer cache
[ Upstream commit d6d33f03ba ]

Since the buffer cache for ntfs3 metadata is not released until the file
system is unmounted, allocating from the movable zone may result in cma
allocation failures. This is due to the page still being used by ntfs3,
leading to migration failures.

To address this, this commit use sb_bread_umovable() instead of
sb_bread(). This change prevents allocation from the movable zone,
ensuring compatibility with scenarios where the buffer head is not
released until unmount. This patch is inspired by commit
a8ac900b8163("ext4: use non-movable memory for the ext4 superblock").

The issue is found when playing video files stored in NTFS on the
Android TV platform. During this process, the media parser reads the
video file, causing ntfs3 to allocate buffer cache from the CMA area.
Subsequently, the hardware decoder attempts to allocate memory from the
same CMA area. However, the page is still in use by ntfs3, resulting in
a migrate failure in alloc_contig_range().

The pinned page and allocating stacktrace reported by page owner shows
below:

page:ffffffff00b68880 refcount:3 mapcount:0 mapping:ffffff80046aa828
        index:0xc0040 pfn:0x20fa4
    aops:def_blk_aops ino:0
    flags: 0x2020(active|private)
    page dumped because: migration failure
    page last allocated via order 0, migratetype Movable,
        gfp_mask 0x108c48
        (GFP_NOFS|__GFP_NOFAIL|__GFP_HARDWALL|__GFP_MOVABLE),
    page_owner tracks the page as allocated
     prep_new_page
     get_page_from_freelist
     __alloc_pages_nodemask
     pagecache_get_page
     __getblk_gfp
     __bread_gfp
     ntfs_read_run_nb
     ntfs_read_bh
     mi_read
     ntfs_iget5
     dir_search_u
     ntfs_lookup
     __lookup_slow
     lookup_slow
     walk_component
     path_lookupat

Signed-off-by: Ism Hong <ism.hong@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-01 13:26:29 +01:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
attrib.c fs/ntfs3: Add NULL ptr dereference checking at the end of attr_allocate_frame() 2024-03-01 13:26:29 +01:00
attrlist.c fs/ntfs3: Disable ATTR_LIST_ENTRY size check 2024-03-01 13:26:29 +01:00
bitfunc.c fs/ntfs3: Remove a useless shadowing variable 2021-09-23 19:05:46 +03:00
bitmap.c fs/ntfs3: Use kvmalloc instead of kmalloc(... __GFP_NOWARN) 2023-11-08 14:10:58 +01:00
debug.h fs/ntfs3. Add forward declarations for structs to debug.h 2021-09-13 19:41:43 +03:00
dir.c fs/ntfs3: Improve ntfs_dir_count 2024-03-01 13:26:28 +01:00
file.c fs/ntfs3: don't hold ni_lock when calling truncate_setsize() 2023-01-12 12:02:28 +01:00
frecord.c fs/ntfs3: Fix possible NULL-ptr-deref in ni_readpage_cmpr() 2023-11-08 14:10:58 +01:00
fslog.c fs/ntfs3: Avoid possible memory leak 2023-11-08 14:10:59 +01:00
fsntfs.c fs/ntfs3: Add null pointer checks 2024-02-23 09:12:52 +01:00
index.c fs/ntfs3: Add null pointer checks 2024-02-23 09:12:52 +01:00
inode.c fs/ntfs3: Print warning while fixing hard links count 2024-03-01 13:26:28 +01:00
Kconfig
lznt.c fs/ntfs3: Remove tabs before spaces from comment 2021-09-16 17:01:36 +03:00
Makefile
namei.c fs/ntfs3: Refactoring of various minor issues 2023-05-17 11:53:51 +02:00
ntfs.h fs/ntfs3: Disable ATTR_LIST_ENTRY size check 2024-03-01 13:26:29 +01:00
ntfs_fs.h fs/ntfs3: use non-movable memory for ntfs3 MFT buffer cache 2024-03-01 13:26:29 +01:00
record.c fs/ntfs3: Correct hard links updating when dealing with DOS names 2024-03-01 13:26:28 +01:00
run.c fs/ntfs3: Check fields while reading 2023-07-23 13:49:27 +02:00
super.c fs/ntfs3: Use kvmalloc instead of kmalloc(... __GFP_NOWARN) 2023-11-08 14:10:58 +01:00
upcase.c fs/ntfs3: Change right headers to upcase.c 2021-09-13 19:41:45 +03:00
xattr.c fs/ntfs3: fix panic about slab-out-of-bounds caused by ntfs_list_ea() 2023-10-25 12:03:05 +02:00