Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753514AbZIWQQm (ORCPT ); Wed, 23 Sep 2009 12:16:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753459AbZIWQQm (ORCPT ); Wed, 23 Sep 2009 12:16:42 -0400 Received: from qw-out-2122.google.com ([74.125.92.24]:37851 "EHLO qw-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753439AbZIWQQj (ORCPT ); Wed, 23 Sep 2009 12:16:39 -0400 From: Eric B Munson To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, mel@csn.ul.ie, Eric B Munson Subject: [RESEND] [PATCH] hugetlbfs: Do not call user_shm_lock() for MAP_HUGETLB fix Date: Wed, 23 Sep 2009 10:08:22 -0600 Message-Id: <1253722102-22858-1-git-send-email-ebmunson@us.ibm.com> X-Mailer: git-send-email 1.6.3.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2356 Lines: 66 It seems I may have been having relay problems, I am resending this using my personal account to make sure everyone that needs a copy gets one. Andrew, This patch seems to have slipped through the cracks during the discussion on the MAP_HUGETLB flag, I am sorry for letting it slip. Please fold this into the indicated patch in -mm. --- Cut here --- The patch hugetlbfs-allow-the-creation-of-files-suitable-for-map_private-on-the-vfs-internal-mount.patch alters can_do_hugetlb_shm() to check if a file is being created for shared memory or mmap(). If this returns false, we then unconditionally call user_shm_lock() triggering a warning. This block should never be entered for MAP_HUGETLB. This patch partially reverts the problem and fixes the check. This patch should be considered a fix to hugetlbfs-allow-the-creation-of-files-suitable-for-map_private-on-the-vfs-internal-mount.patch. From: Mel Gorman Signed-off-by: Eric B Munson --- fs/hugetlbfs/inode.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index e1a4ac4..0bf9d02 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -931,15 +931,9 @@ static struct file_system_type hugetlbfs_fs_type = { static struct vfsmount *hugetlbfs_vfsmount; -static int can_do_hugetlb_shm(int creat_flags) +static int can_do_hugetlb_shm(void) { - if (creat_flags != HUGETLBFS_SHMFS_INODE) - return 0; - if (capable(CAP_IPC_LOCK)) - return 1; - if (in_group_p(sysctl_hugetlb_shm_group)) - return 1; - return 0; + return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group); } struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag, @@ -955,7 +949,7 @@ struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag, if (!hugetlbfs_vfsmount) return ERR_PTR(-ENOENT); - if (!can_do_hugetlb_shm(creat_flags)) { + if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm()) { *user = current_user(); if (user_shm_lock(size, *user)) { WARN_ONCE(1, -- 1.6.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/