Skip to content

Commit

Permalink
tarfs: use GPF_NOFS when allocating memory on a mounted fs
Browse files Browse the repository at this point in the history
When a mounted filesystem needs memory that isn't available, this flag
instructs the kernel allocator to not request (and wait for) file
systems to shrink caches because it may lead to deadlocks.

Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
  • Loading branch information
wedsonaf authored and sprt committed Feb 10, 2025
1 parent 3da1a71 commit e0b5ab3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tarfs/tarfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static int tarfs_readdir(struct file *file, struct dir_context *ctx)
break;
}

name_buffer = kmalloc(disk_len, GFP_KERNEL);
name_buffer = kmalloc(disk_len, GFP_NOFS);
if (!name_buffer) {
ret = -ENOMEM;
break;
Expand Down Expand Up @@ -457,7 +457,7 @@ static struct inode *tarfs_alloc_inode(struct super_block *sb)
{
struct tarfs_inode_info *info;

info = alloc_inode_sb(sb, tarfs_inode_cachep, GFP_KERNEL);
info = alloc_inode_sb(sb, tarfs_inode_cachep, GFP_NOFS);
if (!info)
return NULL;

Expand Down

0 comments on commit e0b5ab3

Please sign in to comment.