From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21346C433E0 for ; Thu, 11 Jun 2020 01:36:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B3F992072F for ; Thu, 11 Jun 2020 01:36:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Zof5Ro+z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3F992072F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 153E08D0054; Wed, 10 Jun 2020 21:36:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1046F8D004C; Wed, 10 Jun 2020 21:36:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01A2A8D0054; Wed, 10 Jun 2020 21:36:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DBAAE8D004C for ; Wed, 10 Jun 2020 21:36:39 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 94B758019DE1 for ; Thu, 11 Jun 2020 01:36:39 +0000 (UTC) X-FDA: 76915216518.25.care49_1e04d7726dcf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 5BFFE1804E3E0 for ; Thu, 11 Jun 2020 01:36:39 +0000 (UTC) X-HE-Tag: care49_1e04d7726dcf X-Filterd-Recvd-Size: 3532 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Thu, 11 Jun 2020 01:36:38 +0000 (UTC) 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> X-Rspamd-Queue-Id: 5BFFE1804E3E0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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?