Skip to contentSkip to conversation

tmpfs: change shmem_mapping() to test shmem_aops

PATCH New [email protected] 1 participant 1 message Feb 22, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 39/142 tmpfs: change shmem_mapping() to test shmem_aops

From: Hugh Dickins <[email protected]>
Subject: tmpfs: change shmem_mapping() to test shmem_aops

Callers of shmem_mapping() are interested in whether the mapping is swap backed - except for uprobes, which is interested in whether it should use shmem_read_mapping_page(). All these callers are better served by a shmem_mapping() which checks for shmem_aops, than the current version which goes through several indirections to find where the inode lives - and has the surprising effect that a private mmap of /dev/zero satisfies both vma_is_anonymous() and shmem_mapping(), when that device node is on devtmpfs. I don't think anything in the tree suffers from that surprise, but it caught me out, and is better fixed.

---

 mm/shmem.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
mm/shmem.c renamed from mm/shmem.c~tmpfs-change-shmem_mapping-to-test-shmem_aops +0 -2
diff -puN mm/shmem.c~tmpfs-change-shmem_mapping-to-test-shmem_aops mm/shmem.c
@@ -2175,10 +2175,7 @@ static struct inode *shmem_get_inode(str
 
 bool shmem_mapping(struct address_space *mapping)
 {
-	if (!mapping->host)
-		return false;