Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1591672pxb; Thu, 4 Feb 2021 17:53:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWoajkw7o+YdWQ/VRbuloIQOx6aFgs9P2xs+G89BmkKWCNxbUb3wAJ/uvfqrG2qYwkU4jy X-Received: by 2002:a05:6402:5207:: with SMTP id s7mr1271277edd.311.1612490030090; Thu, 04 Feb 2021 17:53:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612490030; cv=none; d=google.com; s=arc-20160816; b=rb6usrmhalN2DrUkZFONZR004hcSy75vmpsgLyzbFtZKr3fkJsb07yuUBSziJ3KfiZ cla0XLkZmeREpfNqsu6pqwAFHz8+Anc8MIivWevLROXKZbfeDI1ELPIxjb/1lAPEPSFh Va5t41z+JLSjJtcZMUNwbEPyn1IGqOdeeCSOj3mvxJVK4jwjHKRXThSclnMCBqlRHV8U ySPvvBL5P2K4MLO6+2U1vKXe05Loif1vSVqsz53mRXaViBsoWSYaojyS2CpGZeDeWsxf E0mldLQrs7zCySyJ0a4kA9iw0EtCeJaHCGh47dA/uoqW9RIfIb9cjvYG2XkA0PMS2Wqp vh/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zIZh/QpswrY1424WeFxeb3hgosOJTtKrRZoe/Rxx33w=; b=UEWdihdDojsIW1edWwJSbRRCgctbqpkiJWVzuw4ySw40D7otVM8OCC7SfvecPXmX3u BApEXqPvmedTQRwV2/bZNRTxMZbdonHMcDW1ztUlgoe7W/gegP+k9OgaXyUVBwL24qvF 5o4SuYFpbbq9oYtTAWluxo0CKc5/pyVCNMsqAP9Bd5JGdNUKEY/FygYUsTsCfTEzZTEA bFqPMY0Ef4PVHeDJqabNNFck1+/DG5mfr4Y6SjuVVCtSLJFCvndQGWdlx33I1kBNFfJG 8WF+QI3uhnhdKe/5bf1CFLstOVSkv5k6TSa2lckXFbQIfu/Lye9ppQcsQY7VVkTXYu5M hzIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="aQ/X/pKG"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx17si4062129edb.578.2021.02.04.17.53.26; Thu, 04 Feb 2021 17:53:50 -0800 (PST) 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=pass header.i=@redhat.com header.s=mimecast20190719 header.b="aQ/X/pKG"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231277AbhBDXot (ORCPT + 99 others); Thu, 4 Feb 2021 18:44:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:45721 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231243AbhBDXoc (ORCPT ); Thu, 4 Feb 2021 18:44:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612482134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zIZh/QpswrY1424WeFxeb3hgosOJTtKrRZoe/Rxx33w=; b=aQ/X/pKGNXGOJuD5EAGLJcivMRWexegddzEP40V+uDkA1kSOMI2IFw8tqbFbEpVACXfQd2 FR7hPgpAgyXS4JGvAM3AZeQkBy2RvBXXhpUh+JOUHrhZN/Opfifz9M8fGQYDDAteq7YTLE Mz1A+2ZsSQ4vkuQN8wh7mxHZlbg9X8Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-7kq0YhApPA6W7_QuzixxYQ-1; Thu, 04 Feb 2021 18:42:13 -0500 X-MC-Unique: 7kq0YhApPA6W7_QuzixxYQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B3FC107ACC7; Thu, 4 Feb 2021 23:42:12 +0000 (UTC) Received: from horse.redhat.com (ovpn-113-87.rdu2.redhat.com [10.10.113.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id E56165C3DF; Thu, 4 Feb 2021 23:42:11 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 83E5A22054F; Thu, 4 Feb 2021 18:42:11 -0500 (EST) Date: Thu, 4 Feb 2021 18:42:11 -0500 From: Vivek Goyal To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/18] ovl: stack miscattr Message-ID: <20210204234211.GB52056@redhat.com> References: <20210203124112.1182614-1-mszeredi@redhat.com> <20210203124112.1182614-4-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210203124112.1182614-4-mszeredi@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 03, 2021 at 01:40:57PM +0100, Miklos Szeredi wrote: > Add stacking for the miscattr operations. > > Signed-off-by: Miklos Szeredi > --- > fs/overlayfs/dir.c | 2 ++ > fs/overlayfs/inode.c | 43 ++++++++++++++++++++++++++++++++++++++++ > fs/overlayfs/overlayfs.h | 2 ++ > 3 files changed, 47 insertions(+) > > diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c > index 28a075b5f5b2..77c6b44f8d83 100644 > --- a/fs/overlayfs/dir.c > +++ b/fs/overlayfs/dir.c > @@ -1300,4 +1300,6 @@ const struct inode_operations ovl_dir_inode_operations = { > .listxattr = ovl_listxattr, > .get_acl = ovl_get_acl, > .update_time = ovl_update_time, > + .miscattr_get = ovl_miscattr_get, > + .miscattr_set = ovl_miscattr_set, > }; > diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c > index d739e14c6814..97d36d1f28c3 100644 > --- a/fs/overlayfs/inode.c > +++ b/fs/overlayfs/inode.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include "overlayfs.h" > > > @@ -495,6 +496,46 @@ static int ovl_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, > return err; > } > > +int ovl_miscattr_set(struct dentry *dentry, struct miscattr *ma) > +{ > + struct inode *inode = d_inode(dentry); > + struct dentry *upperdentry; > + const struct cred *old_cred; > + int err; > + > + err = ovl_want_write(dentry); > + if (err) > + goto out; > + > + err = ovl_copy_up(dentry); > + if (!err) { > + upperdentry = ovl_dentry_upper(dentry); > + > + old_cred = ovl_override_creds(inode->i_sb); > + /* err = security_file_ioctl(real.file, cmd, arg); */ Is this an comment intended? Vivek > + err = vfs_miscattr_set(upperdentry, ma); > + revert_creds(old_cred); > + ovl_copyflags(ovl_inode_real(inode), inode); > + } > + ovl_drop_write(dentry); > +out: > + return err; > +} > + > +int ovl_miscattr_get(struct dentry *dentry, struct miscattr *ma) > +{ > + struct inode *inode = d_inode(dentry); > + struct dentry *realdentry = ovl_dentry_real(dentry); > + const struct cred *old_cred; > + int err; > + > + old_cred = ovl_override_creds(inode->i_sb); > + err = vfs_miscattr_get(realdentry, ma); > + revert_creds(old_cred); > + > + return err; > +} > + > static const struct inode_operations ovl_file_inode_operations = { > .setattr = ovl_setattr, > .permission = ovl_permission, > @@ -503,6 +544,8 @@ static const struct inode_operations ovl_file_inode_operations = { > .get_acl = ovl_get_acl, > .update_time = ovl_update_time, > .fiemap = ovl_fiemap, > + .miscattr_get = ovl_miscattr_get, > + .miscattr_set = ovl_miscattr_set, > }; > > static const struct inode_operations ovl_symlink_inode_operations = { > diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h > index b487e48c7fd4..d3ad02c34cca 100644 > --- a/fs/overlayfs/overlayfs.h > +++ b/fs/overlayfs/overlayfs.h > @@ -509,6 +509,8 @@ int __init ovl_aio_request_cache_init(void); > void ovl_aio_request_cache_destroy(void); > long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg); > long ovl_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg); > +int ovl_miscattr_get(struct dentry *dentry, struct miscattr *ma); > +int ovl_miscattr_set(struct dentry *dentry, struct miscattr *ma); > > /* copy_up.c */ > int ovl_copy_up(struct dentry *dentry); > -- > 2.26.2 >