[Devel] [PATCH 1/8] sysvshm: check for hugetlb before assuming shmem

Nathan Lynch ntl at pobox.com
Tue Sep 14 13:02:03 PDT 2010


fill_ipc_shm_hdr should ensure that the region isn't hugetlbfs-backed
before backcasting the inode to shmem_inode_info, not after.

Signed-off-by: Nathan Lynch <ntl at pobox.com>
---
 ipc/checkpoint_shm.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ipc/checkpoint_shm.c b/ipc/checkpoint_shm.c
index c8247ce..a929e33 100644
--- a/ipc/checkpoint_shm.c
+++ b/ipc/checkpoint_shm.c
@@ -58,13 +58,17 @@ static int fill_ipc_shm_hdr(struct ckpt_ctx *ctx,
 		h->mlock_uid = (unsigned int) -1;
 
 	h->flags = 0;
-	/* check if shm was setup with SHM_NORESERVE */
-	if (SHMEM_I(shp->shm_file->f_dentry->d_inode)->flags & VM_NORESERVE)
-		h->flags |= SHM_NORESERVE;
+
 	/* check if shm was setup with SHM_HUGETLB (unsupported yet) */
 	if (is_file_hugepages(shp->shm_file)) {
 		pr_warning("c/r: unsupported SHM_HUGETLB\n");
 		ret = -ENOSYS;
+	} else {
+		struct shmem_inode_info *info;
+
+		info = SHMEM_I(shp->shm_file->f_dentry->d_inode);
+		if (info->flags & VM_NORESERVE)
+			h->flags |= SHM_NORESERVE;
 	}
 
 	ipc_unlock(&shp->shm_perm);
-- 
1.7.2.2

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list