Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp940640ybg; Wed, 10 Jun 2020 18:38:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy3PYhnCBXnZtTZprFmq6MOPuTQ9sKz/DAFy6lpaP2San4JwhFlHe6V92entmONgOmkAPw X-Received: by 2002:a17:906:8488:: with SMTP id m8mr6422870ejx.236.1591839532725; Wed, 10 Jun 2020 18:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591839532; cv=none; d=google.com; s=arc-20160816; b=BcJxdH0ifdkbu1Zu4JgRXh4Q9UZgK4WEGTruPInhCiQvGmAWJ8w2Z4wzhDZmPJLbxn h5KnGQG6+KhfphnpP0FQ91S+7wFXg11VpKS15AFLII+OxKFbZOrCKHTERH782ZukSI7I NLuanR+FJ1srWt2OMywBCMUHowVStrsh1CsCiTPLepr7y7pL2v/M3mSX6RSeJisJKP36 DqB5bf/avZNZBfr+eSte1UtzoRo58opCLrRKgegVSz+yP71fgJh/yV/6/Rob5twdN3G8 GuI5I3Zs8DxXeCpBCqsTUSsTD59Oc+SRQGT6aIH2yGOzHAt/EezRkDLBWT/0CKJduT7C nF6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=OhtuvvlzzHFfDg+PC4aa+VAtbxaJoSFkoyziN0s35WQ=; b=H+dXf3GYYRVwQiKTXc9yvUTOqlKze4YTEqF71giK62BkuXp2KLxsEO28ClWBBlmZiz 1a314RLqS1mnMgYllm9rr/9H4KbUftPdwExIY5lErZWiNUfq8Moq2CpmuUF4XAdsSRK1 pI3vAQpTxwxffwkJxRuIOmOwA9aJLVl0uaoW1wgXYuo577C+m/VZCJ9L+792cfMqsqTY xRH0ccIF5eoACtnIee+6fU22Od6R62jKX/znUkVz3KGkd7lwGe7C0GlrKJCRHfaVF8EF SONjpmNZyI4JDKKvTDAZ9Cb47+3/AEcphi+jNi/RhtjfVb9ERADLZPWtkMwjhCYFgx+w DtrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Zof5Ro+z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j93si876448edb.331.2020.06.10.18.38.30; Wed, 10 Jun 2020 18:38:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Zof5Ro+z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726379AbgFKBgn (ORCPT + 99 others); Wed, 10 Jun 2020 21:36:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbgFKBgm (ORCPT ); Wed, 10 Jun 2020 21:36:42 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CF0EC08C5C1; Wed, 10 Jun 2020 18:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=OhtuvvlzzHFfDg+PC4aa+VAtbxaJoSFkoyziN0s35WQ=; b=Zof5Ro+zSJ0JDzuH+aN8Xz1rcs /jYX6M5fhwAoI2LAWxewVrWIUvdGS2YPZDwwSXAOqx2aotpCL8ERbAkRZEIMBkZBRMY5EM8eLHrVz FCPHFLUlooImb9VfHjsGDsoQ2C5PkmkmHsjvUO9rfWIm+6fZFR9y24k8GJYJAVuKogGJ8AHKn3itn RQKWsYF8z/7AbzuarxYTQ6lKRSvi/Yg/qp7gO7lnhNG1V/y5/u7ZBwYfw2KmltZcJThWsyXcp49dO 5ruOY5jiLmf53/pjvyv+38HS3LQX/FoFCot4ryAgrnG75aSWq5qnfmqvYqkM8ijSWo/QgmISB5SyD epRrrSFA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjC8e-0000EW-DB; Thu, 11 Jun 2020 01:36:16 +0000 Date: Wed, 10 Jun 2020 18:36:16 -0700 From: Matthew Wilcox To: Al Viro Cc: Mike Kravetz , Miklos Szeredi , kbuild test robot , kbuild-all@lists.01.org, Colin Walters , syzbot , Andrew Morton , Linux Memory Management List , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs , overlayfs Subject: Re: [PATCH v2] ovl: provide real_file() and overlayfs get_unmapped_area() Message-ID: <20200611013616.GM19604@bombadil.infradead.org> References: <4ebd0429-f715-d523-4c09-43fa2c3bc338@oracle.com> <202005281652.QNakLkW3%lkp@intel.com> <365d83b8-3af7-2113-3a20-2aed51d9de91@oracle.com> <20200611003726.GY23230@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200611003726.GY23230@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 11, 2020 at 01:37:26AM +0100, Al Viro wrote: > On Wed, Jun 10, 2020 at 05:13:52PM -0700, Mike Kravetz wrote: > > > To address this issue, > > - Add a new file operation f_real while will return the underlying file. > > Only overlayfs provides a function for this operation. > > - Add a new routine real_file() which can be used by core code get an > > underlying file. > > - Update is_file_hugepages to get the real file. > > Egads... So to find out whether it's a hugetlb you would > * check if a method is NULL > * if not, call it > * ... and check if the method table of the result is hugetlbfs one? > > Here's a radical suggestion: FMODE_HUGEPAGES. Just have it set by > ->open() and let is_file_hugepages() check it. In ->f_mode. And > make the bloody hugetlbfs_file_operations static, while we are at it. ITYM FMODE_OVL_UPPER. To quote Mike: > while (file->f_op == &ovl_file_operations) > file = file->private_data; > return file; which would be transformed into: while (file->f_mode & FMODE_OVL_UPPER) file = file->private_data; return file; Or are you proposing that overlayfs copy FMODE_HUGEPAGES from the underlying fs to the overlaying fs?