Received: by 10.192.165.148 with SMTP id m20csp3065417imm; Sun, 22 Apr 2018 23:14:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx49g+4AyxY/3umX0+/4BJie2g3DMamrMZ4WgLzTUMQH0PLN2eW6msJJ2Agx0N2wXNffXiTeZ X-Received: by 10.99.116.67 with SMTP id e3mr15785907pgn.369.1524464057632; Sun, 22 Apr 2018 23:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524464057; cv=none; d=google.com; s=arc-20160816; b=zrbctXw1a8lLQpbxH3TSC6jdjjAbZYfY5mYhk2zIvDYPn+OijEf5oDGJhNIyWnr38F skVOsjqTYmaana6u/tiNZqAY52hvdt63yX9pDOonKKC4xk1mGAI07gC/gtZmrvR/36Qe cQK1q/qDUbHS0mSlDqdWkIjaQ8rbYDy6Yd9TmyMRotCa5nhfMsS/XR3RcsZdBr9NBFPO OL0Z45Eqp/R2N4jpcC2GkpLkFJSxEByb9BhwI4S/ybDqGo+xQr0AiOBsrq/Q6UP3KrQU Qm10r291pXWvivdwKZrCSEwAit9YcaUICOwzGc/jEGwpFV/lc03g7aRkD9ubQAIrFf+w Iniw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=uOTeiSHuWZFS2kJjN3mq6pkmtYu2qut864pKUVLedzY=; b=RnTSXHUHi00NAJpyug8GwT844/1XWvqb/bzb17J70i8Rv4D0K54vjR9cFiEdbMNcKT VEv01gDh7aNVWLGW+PzqXAkH/x/AEliY2XH3+PU6m8PWXjG3nwM3TpQIFlrxtBVKkjFg LUDWNYRhVIB7n6ut/RImpUJz69mL0cV+sw05o0kyZczcVAozF24IKqsi5mFIVdBoHM2Q BX7eoXrpTC0w8L8o5H7uy9gI2gWDws1tqbbYnzhp/xXkDiqtxkTFxY/kEWHR4yKxMaDH T4ZAtofBddylA5a3++oPZmvOffOF4QMq+hmfVqM01utHHDVrezwPg9y3kdX55jGvk2z/ 5KPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=mN6vlfe5; dkim=pass header.i=@codeaurora.org header.s=default header.b=iplQzmBj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si9232195pgw.613.2018.04.22.23.14.03; Sun, 22 Apr 2018 23:14:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=mN6vlfe5; dkim=pass header.i=@codeaurora.org header.s=default header.b=iplQzmBj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751867AbeDWGLb (ORCPT + 99 others); Mon, 23 Apr 2018 02:11:31 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:34566 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751216AbeDWGL0 (ORCPT ); Mon, 23 Apr 2018 02:11:26 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2F17C606DC; Mon, 23 Apr 2018 06:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524463886; bh=qh4uAr7Kbtr437snPyeDn0PyXvwdxYxGBXo3E41fr2o=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=mN6vlfe5DkWLjAtRf7d0CG7d6/I+JMZnhxnyo+lAz5T20FRncnASK3y2GSEJWnbc/ P/u206XAaHy41e0YOndKK2bI/AAa/H5GFNVXnVsmFEemKRwMfZ/hpCWiI+O9VCYxag wD/Wj2VdaOJfX9VoiC/ZIhPQtAU62ZEbLqFO146g= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.206.24.27] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: riteshh@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 41A35606DC; Mon, 23 Apr 2018 06:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524463885; bh=qh4uAr7Kbtr437snPyeDn0PyXvwdxYxGBXo3E41fr2o=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=iplQzmBjosyfb8C/Z5ZllS/Q80vxJOdwBI3CHzSme6vP9N7QLCUMe6FUJYevVoUmE 3aWI08ftJbjb8/yrZ2YC9JIVjdRk5oKd4mCgqliuiJMfw6+RH9obBAr48a78wDRkKk 07yT9IitNCmqK++AYZDmeAqJ4JqrPcj4E5NOnjeg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 41A35606DC Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=riteshh@codeaurora.org Subject: Re: [RFC PATCH 16/35] ovl: readd lsattr/chattr support To: Miklos Szeredi , linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180412150826.20988-1-mszeredi@redhat.com> <20180412150826.20988-17-mszeredi@redhat.com> From: Ritesh Harjani Message-ID: <5b3e2c0d-5dc5-a98b-1eb9-1c123b0508dd@codeaurora.org> Date: Mon, 23 Apr 2018 11:41:19 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180412150826.20988-17-mszeredi@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/12/2018 8:38 PM, Miklos Szeredi wrote: > Implement FS_IOC_GETFLAGS and FS_IOC_SETFLAGS. > > Needs vfs_ioctl() exported to modules. Do you think if it is better to separate out ovl implementation and export of vfs_ioctl method ? Probably there are other users which should be using vfs_ioctl method as well (like ecryptfs) ? > > Signed-off-by: Miklos Szeredi > --- > fs/internal.h | 1 - > fs/ioctl.c | 1 + > fs/overlayfs/file.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > include/linux/fs.h | 2 ++ > 4 files changed, 62 insertions(+), 1 deletion(-) > > diff --git a/fs/internal.h b/fs/internal.h > index 3319bf39e339..d5108d9c6a2f 100644 > --- a/fs/internal.h > +++ b/fs/internal.h > @@ -176,7 +176,6 @@ extern const struct dentry_operations ns_dentry_operations; > */ > extern int do_vfs_ioctl(struct file *file, unsigned int fd, unsigned int cmd, > unsigned long arg); > -extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); > > /* > * iomap support: > diff --git a/fs/ioctl.c b/fs/ioctl.c > index 5ace7efb0d04..696f4c46a868 100644 > --- a/fs/ioctl.c > +++ b/fs/ioctl.c > @@ -49,6 +49,7 @@ long vfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) > out: > return error; > } > +EXPORT_SYMBOL(vfs_ioctl); > > static int ioctl_fibmap(struct file *filp, int __user *p) > { > diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c > index 05e3e2f80b89..cc004ff1b05b 100644 > --- a/fs/overlayfs/file.c > +++ b/fs/overlayfs/file.c > @@ -8,6 +8,7 @@ > > #include > #include > +#include > #include > #include > #include "overlayfs.h" > @@ -291,6 +292,63 @@ long ovl_fallocate(struct file *file, int mode, loff_t offset, loff_t len) > return ret; > } > > +static long ovl_real_ioctl(struct file *file, unsigned int cmd, > + unsigned long arg) > +{ > + struct fd real; > + const struct cred *old_cred; > + long ret; > + > + ret = ovl_real_file(file, &real); > + if (ret) > + return ret; > + > + old_cred = ovl_override_creds(file_inode(file)->i_sb); > + ret = vfs_ioctl(real.file, cmd, arg); > + revert_creds(old_cred); > + > + fdput(real); > + > + return ret; > +} > + > +long ovl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > +{ > + long ret; > + struct inode *inode = file_inode(file); > + > + switch (cmd) { > + case FS_IOC_GETFLAGS: > + ret = ovl_real_ioctl(file, cmd, arg); > + break; > + > + case FS_IOC_SETFLAGS: > + if (!inode_owner_or_capable(inode)) > + return -EACCES; > + > + ret = mnt_want_write_file(file); > + if (ret) > + return ret; > + > + ret = ovl_copy_up(file_dentry(file)); > + if (!ret) { > + ret = ovl_real_ioctl(file, cmd, arg); > + > + inode_lock(inode); > + ovl_copyflags(ovl_inode_real(inode), inode); > + inode_unlock(inode); > + } > + > + mnt_drop_write_file(file); > + break; > + > + default: > + ret = -ENOTTY; > + } > + > + return ret; > +} > + > const struct file_operations ovl_file_operations = { > .open = ovl_open, > .release = ovl_release, > @@ -300,4 +358,5 @@ const struct file_operations ovl_file_operations = { > .fsync = ovl_fsync, > .mmap = ovl_mmap, > .fallocate = ovl_fallocate, > + .unlocked_ioctl = ovl_ioctl, What about compat_ioctl ? should that implementation also go in the same patch ? > }; > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 0b215faa30ae..1add10f04b56 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -1621,6 +1621,8 @@ int vfs_mkobj(struct dentry *, umode_t, > int (*f)(struct dentry *, umode_t, void *), > void *); > > +extern long vfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); > + > /* > * VFS file helper functions. > */ > -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.