From patchwork Wed Feb 24 20:00:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12102439 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 7607DC433DB for ; Wed, 24 Feb 2021 20:00:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1821364F22 for ; Wed, 24 Feb 2021 20:00:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1821364F22 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B08046B007E; Wed, 24 Feb 2021 15:00:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AB55F6B0080; Wed, 24 Feb 2021 15:00:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CC3E6B0081; Wed, 24 Feb 2021 15:00:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 8753A6B007E for ; Wed, 24 Feb 2021 15:00:55 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 53C692497 for ; Wed, 24 Feb 2021 20:00:55 +0000 (UTC) X-FDA: 77854229670.07.3CD827F Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf20.hostedemail.com (Postfix) with ESMTP id 8B03BA07C for ; Wed, 24 Feb 2021 20:00:53 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 56CC264F20; Wed, 24 Feb 2021 20:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1614196852; bh=BG36qJtyKsDqyW3kruv9FcwEBVvj/yyLc2TZ80f2/7Q=; h=Date:From:To:Subject:In-Reply-To:From; b=xYNu2gUAXGavgLOrj7KZ/TWpJyWBlmjMjlm/5rTor+aa7QD9C2QrozZBZN1EFSy2X 2+SMttSq5sYX9BBG/Kw0u+/+2Y0FVKuJoQAUlR/KnBbC5P8A/haSDaamIKO2coTAu+ FBS0QHohgY9mgFatyg5MDWX2vCuBmpln//fhD5LA= Date: Wed, 24 Feb 2021 12:00:51 -0800 From: Andrew Morton To: adobriyan@gmail.com, akpm@linux-foundation.org, christian.brauner@ubuntu.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, viro@zeniv.linux.org.uk Subject: [patch 013/173] ramfs: support O_TMPFILE Message-ID: <20210224200051.MRGrUqyzj%akpm@linux-foundation.org> In-Reply-To: <20210224115824.1e289a6895087f10c41dd8d6@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8B03BA07C X-Stat-Signature: 3ypce5ebnuw8w4h5ocyu99ox8ucsfqo6 Received-SPF: none (linux-foundation.org>: No applicable sender policy available) receiver=imf20; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1614196853-968303 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: From: Alexey Dobriyan Subject: ramfs: support O_TMPFILE [akpm@linux-foundation.org: update inode_operations.tmpfile] Link: http://lkml.kernel.org/r/20190206073349.GA15311@avx2 Signed-off-by: Alexey Dobriyan Cc: Christian Brauner Cc: Al Viro Signed-off-by: Andrew Morton Acked-by: Christian Brauner --- fs/ramfs/inode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/fs/ramfs/inode.c~ramfs-support-o_tmpfile +++ a/fs/ramfs/inode.c @@ -151,6 +151,18 @@ static int ramfs_symlink(struct user_nam return error; } +static int ramfs_tmpfile(struct user_namespace *mnt_userns, + struct inode *dir, struct dentry *dentry, umode_t mode) +{ + struct inode *inode; + + inode = ramfs_get_inode(dir->i_sb, dir, mode, 0); + if (!inode) + return -ENOSPC; + d_tmpfile(dentry, inode); + return 0; +} + static const struct inode_operations ramfs_dir_inode_operations = { .create = ramfs_create, .lookup = simple_lookup, @@ -161,6 +173,7 @@ static const struct inode_operations ram .rmdir = simple_rmdir, .mknod = ramfs_mknod, .rename = simple_rename, + .tmpfile = ramfs_tmpfile, }; /*