diff options
Diffstat (limited to 'fs/open.c')
| -rw-r--r-- | fs/open.c | 18 | 
1 files changed, 16 insertions, 2 deletions
| diff --git a/fs/open.c b/fs/open.c index daa324606a41..f732fb94600c 100644 --- a/fs/open.c +++ b/fs/open.c @@ -856,8 +856,20 @@ static int do_dentry_open(struct file *f,  		 * of THPs into the page cache will fail.  		 */  		smp_mb(); -		if (filemap_nr_thps(inode->i_mapping)) -			truncate_pagecache(inode, 0); +		if (filemap_nr_thps(inode->i_mapping)) { +			struct address_space *mapping = inode->i_mapping; + +			filemap_invalidate_lock(inode->i_mapping); +			/* +			 * unmap_mapping_range just need to be called once +			 * here, because the private pages is not need to be +			 * unmapped mapping (e.g. data segment of dynamic +			 * shared libraries here). +			 */ +			unmap_mapping_range(mapping, 0, 0, 0); +			truncate_inode_pages(mapping, 0); +			filemap_invalidate_unlock(inode->i_mapping); +		}  	}  	return 0; @@ -1248,6 +1260,8 @@ SYSCALL_DEFINE4(openat2, int, dfd, const char __user *, filename,  	if (err)  		return err; +	audit_openat2_how(&tmp); +  	/* O_LARGEFILE is only allowed for non-O_PATH. */  	if (!(tmp.flags & O_PATH) && force_o_largefile())  		tmp.flags |= O_LARGEFILE; |