Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
[linux-block.git] / ipc / shm.c
index 1bc4701ef4f0d2b214e57f73a1b1096d2f5346e1..9eb1488b543bc9e8ae419035a86e489e9bf4c8c6 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -370,7 +370,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
                if (shmflg & SHM_NORESERVE)
                        acctflag = VM_NORESERVE;
                file = hugetlb_file_setup(name, size, acctflag,
-                                                       &shp->mlock_user);
+                                       &shp->mlock_user, HUGETLB_SHMFS_INODE);
        } else {
                /*
                 * Do not allow no accounting for OVERCOMMIT_NEVER, even
@@ -410,7 +410,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
        return error;
 
 no_id:
-       if (shp->mlock_user)    /* shmflg & SHM_HUGETLB case */
+       if (is_file_hugepages(file) && shp->mlock_user)
                user_shm_unlock(size, shp->mlock_user);
        fput(file);
 no_file: