Message ID | 20210112220124.837960-26-christian.brauner@ubuntu.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Paul Moore |
Headers | show |
Series | idmapped mounts | expand |
On Tue, Jan 12, 2021 at 11:01:07PM +0100, Christian Brauner wrote: > Enable the vfs_utimes() helper to handle idmapped mounts by passing down > the mount's user namespace. If the initial user namespace is passed > nothing changes so non-idmapped mounts will see identical behavior as > before. No real need for the local variable here. Same applies to a bunch of other patches as well. Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/fs/utimes.c b/fs/utimes.c index 1a4130bee157..33fa753bab3a 100644 --- a/fs/utimes.c +++ b/fs/utimes.c @@ -22,6 +22,7 @@ int vfs_utimes(const struct path *path, struct timespec64 *times) struct iattr newattrs; struct inode *inode = path->dentry->d_inode; struct inode *delegated_inode = NULL; + struct user_namespace *mnt_userns; if (times) { if (!nsec_valid(times[0].tv_nsec) || @@ -61,8 +62,9 @@ int vfs_utimes(const struct path *path, struct timespec64 *times) newattrs.ia_valid |= ATTR_TOUCH; } retry_deleg: + mnt_userns = mnt_user_ns(path->mnt); inode_lock(inode); - error = notify_change(&init_user_ns, path->dentry, &newattrs, &delegated_inode); + error = notify_change(mnt_userns, path->dentry, &newattrs, &delegated_inode); inode_unlock(inode); if (delegated_inode) { error = break_deleg_wait(&delegated_inode);
Enable the vfs_utimes() helper to handle idmapped mounts by passing down the mount's user namespace. If the initial user namespace is passed nothing changes so non-idmapped mounts will see identical behavior as before. Cc: Christoph Hellwig <hch@lst.de> Cc: David Howells <dhowells@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> --- /* v2 */ unchanged /* v3 */ unchanged /* v4 */ - Serge Hallyn <serge@hallyn.com>: - Use "mnt_userns" to refer to a vfsmount's userns everywhere to make terminology consistent. /* v5 */ base-commit: 7c53f6b671f4aba70ff15e1b05148b10d58c2837 --- fs/utimes.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)