From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:52688 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbeJOBDQ (ORCPT ); Sun, 14 Oct 2018 21:03:16 -0400 Date: Sun, 14 Oct 2018 10:21:31 -0700 From: Christoph Hellwig Subject: Re: [PATCH 10/25] vfs: create generic_remap_file_range_touch to update inode metadata Message-ID: <20181014172131.GE30673@infradead.org> References: <153938912912.8361.13446310416406388958.stgit@magnolia> <153938921180.8361.13556945128095535605.stgit@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <153938921180.8361.13556945128095535605.stgit@magnolia> Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: "Darrick J. Wong" Cc: david@fromorbit.com, sandeen@redhat.com, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, Amir Goldstein , linux-unionfs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, ocfs2-devel@oss.oracle.com > +/* Update inode timestamps and remove security privileges when remapping. */ > +int generic_remap_file_range_touch(struct file *file, bool is_dedupe) > +{ > + int ret; > + > + /* If can't alter the file contents, we're done. */ > + if (is_dedupe) > + return 0; > + > + /* Update the timestamps, since we can alter file contents. */ > + if (!(file->f_mode & FMODE_NOCMTIME)) { > + ret = file_update_time(file); > + if (ret) > + return ret; > + } > + > + /* > + * Clear the security bits if the process is not being run by root. > + * This keeps people from modifying setuid and setgid binaries. > + */ > + return file_remove_privs(file); > +} > +EXPORT_SYMBOL(generic_remap_file_range_touch); The name seems a little out of touch with what it actually does. Also why a bool argument instead of the more descriptive flags which introduced a few patches ago?