<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:55:59 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-12826] Project quotas: users can change project IDs</title>
                <link>https://jira.whamcloud.com/browse/LU-12826</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;We&apos;re considering using project quotas in the future but we noticed that users can change or clear the project id of their own files/directories. How can we restrict access to project IDs only to admins (like ext4 does I guess?). We looked at the manual but couldn&apos;t find how permissions are handled. Sorry if we missed something obvious.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;[root@fir-io7-s2 users]# ls -ld /firhdr/users/sthiell
drwxr-x--- 4 sthiell root 4096 Sep 30 20:30 /firhdr/users/sthiell
[root@fir-io7-s2 users]# lfs project -d /firhdr/users/sthiell
   10 P /firhdr/users/sthiell

[root@fir-io7-s2 users]# su -m sthiell

bash-4.2$ cd  /firhdr/users/sthiell
bash-4.2$ lfs project -C .
bash-4.2$ lfs project -d .
    0 - .
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>CentOS 7.6, ldiskfs, 2.12.2_116+3</environment>
        <key id="57080">LU-12826</key>
            <summary>Project quotas: users can change project IDs</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.whamcloud.com/images/icons/priorities/major.svg">Major</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="wshilong">Wang Shilong</assignee>
                                    <reporter username="sthiell">Stephane Thiell</reporter>
                        <labels>
                    </labels>
                <created>Tue, 1 Oct 2019 04:25:48 +0000</created>
                <updated>Fri, 3 Jan 2020 23:58:23 +0000</updated>
                            <resolved>Sat, 14 Dec 2019 13:39:13 +0000</resolved>
                                    <version>Lustre 2.12.2</version>
                                    <fixVersion>Lustre 2.14.0</fixVersion>
                    <fixVersion>Lustre 2.12.4</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>11</watches>
                                                                            <comments>
                            <comment id="255709" author="pjones" created="Tue, 1 Oct 2019 13:41:53 +0000"  >&lt;p&gt;Shilong&lt;/p&gt;

&lt;p&gt;Could you please advise?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                            <comment id="256026" author="wshilong" created="Tue, 8 Oct 2019 02:28:50 +0000"  >&lt;p&gt;This could be a little tricky, currently Lustre did what ext4/xfs does:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;int ll_ioctl_check_project(struct inode *inode, struct fsxattr *fa) 
{
        /*   
         * Project Quota ID state is only allowed to change from within the init
         * namespace. Enforce that restriction only if we are trying to change
         * the quota ID state. Everything else is allowed in user namespaces.
         */
        if (current_user_ns() == &amp;amp;init_user_ns)
                return 0;

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Since you are switching to sthiell from root, it is in still in same namespace, i guess you could&lt;br/&gt;
try ssh sthiell@fir-io7-s2 and then do same operations which it will return no permissions errors.&lt;/p&gt;</comment>
                            <comment id="256076" author="sthiell" created="Tue, 8 Oct 2019 17:13:17 +0000"  >&lt;p&gt;Hi Shilong,&lt;/p&gt;

&lt;p&gt;Thanks for your reply! This sounded a good point at first, so I tried without su, with ssh sthiell@fir-io7-s2 but same thing: I was able to modify and even clear the project ID as a user. You said it will return &quot;no permissions errors&quot;, actually we want that it returns an error in that case (something like permission denied). Did we miss anything else?&lt;/p&gt;</comment>
                            <comment id="256114" author="wshilong" created="Wed, 9 Oct 2019 12:38:40 +0000"  >&lt;p&gt;Yup, you are right.&lt;/p&gt;

&lt;p&gt;The point is it looks current check is broken somehow.&lt;/p&gt;

&lt;p&gt;Following check always return true in Centos7 client:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;current_user_ns() == &amp;amp;init_user_ns
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Will check more with this.&lt;/p&gt;</comment>
                            <comment id="256116" author="wshilong" created="Wed, 9 Oct 2019 13:08:50 +0000"  >&lt;p&gt;This is a bit interesting, currently XFS/ext4 did same thing for this, that owner could change project ID of files, following is testing results of XFS:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;[wangsl@server wangsl]$ chattr -p 1 foo
[wangsl@server wangsl]$ lsattr -p foo
    1 ------------------- foo
[wangsl@server wangsl]$ chattr -p 2 foo
[wangsl@server wangsl]$ lsattr -p foo
    2 ------------------- foo
[wangsl@server wangsl]$ df . -Th
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sda4      xfs    48G   82M   48G   1% /mnt
[wangsl@server wangsl]$ uname -r
5.1.17-300.fc30.x86_64
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is a bit different behavior than originally we think for lustre project quota use case, we could&lt;br/&gt;
add ROOT CAP check for lustre for surely.&lt;/p&gt;</comment>
                            <comment id="256241" author="srcc" created="Fri, 11 Oct 2019 15:03:09 +0000"  >&lt;p&gt;Hi Shilong,&#160;&lt;/p&gt;

&lt;p&gt;Thanks for checking! It&apos;s a bit of a disappointment,, as projects quotas don&apos;t seem to be usable as-is in a shared environment context. If users can easily circumvent project quotas by simply changing the project id on their files, there&apos;s not much point in enforcing project quotas in the first place.&lt;/p&gt;

&lt;p&gt;Now, for accounting purposes, there probably are valid use cases to allow users to set project ids on specific directories, and avoid having to rely on `du` to get the total volume/inode usage of a given file hierarchy for instance, project quotas would give that information right away.&lt;/p&gt;

&lt;p&gt;So maybe there&apos;s a need for a more flexible tunable? To make changing project ids on files and directory either user-accessible, or a root-only action, depending on the use case?&lt;/p&gt;


&lt;p&gt;To be honest, I&apos;m a bit stumped by all of this: how are people using project quotas in practice (not only with Lustre, but with XFS or ext4 as well) if regular users can switch project ids as they wish?&lt;/p&gt;

&lt;p&gt;In any case, thanks a lot for looking into it!&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br/&gt;
--&#160;&lt;br/&gt;
Kilian&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="256264" author="adilger" created="Fri, 11 Oct 2019 21:42:10 +0000"  >&lt;p&gt;It probably makes sense to raise this as a question on the linux-fsdevel and/or linux-ext4 mailing lists. It is probably best to not mention Lustre and instead focus on the behavior of ext4 and/or xfs on the lists. &lt;/p&gt;</comment>
                            <comment id="256273" author="wshilong" created="Sat, 12 Oct 2019 01:11:52 +0000"  >&lt;p&gt;Yup, let me send an email to upstream to raise this problem.&lt;/p&gt;</comment>
                            <comment id="256288" author="wshilong" created="Sat, 12 Oct 2019 06:37:49 +0000"  >&lt;p&gt;I just raised this problem in the upstream linux mail list:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://marc.info/?l=linux-xfs&amp;amp;m=157086204800850&amp;amp;w=2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://marc.info/?l=linux-xfs&amp;amp;m=157086204800850&amp;amp;w=2&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="256311" author="lixi_wc" created="Sun, 13 Oct 2019 11:17:19 +0000"  >&lt;p&gt;After understanding the reasons of the project ID behavior in the mail list, I still think the current behavior (not allowing the file owner to change the project ID of its file) is still useful in a lot of use cases. It would be a lose to change the current Lustre behavior to the same with Ext4/XFS, especially considering that most likely Lustre are used in the circumstances with more users than local file systems. Another factor is Lustre usually have much larger size than local file systems. That means if any user walks around the project quota limitations, it could troubles to the administrators. Thus, I don&apos;t think it is proper to change the current bahvior of Lustre project quota .&lt;/p&gt;

&lt;p&gt;Nevertheless, it is still valuable to enable some use cases of project quota similar to Ext4/XFS, especailly when containers are being used. Thus, I think it might be a good idea to add a new mount option to Lustre client like &quot;prjid_owner_changable&quot;. If that option is enabled whem mounting, then it will have the same behavior like Ext4/XFS.&lt;/p&gt;

&lt;p&gt;In this way, I think we are enabling all kinds of use cases depending on the requirement. It is a question whether &quot;prjid_owner_changable&quot; should be enabled by default or not. I feel the answer is &quot;no&quot; at least for now.&lt;/p&gt;</comment>
                            <comment id="256312" author="wshilong" created="Sun, 13 Oct 2019 12:06:42 +0000"  >&lt;p&gt;Let me push a patch to limit root for project change in default, and with prjid_owner_changeable option, users could change their project ID and inherit flags.&lt;/p&gt;</comment>
                            <comment id="256313" author="adilger" created="Sun, 13 Oct 2019 14:33:56 +0000"  >&lt;p&gt;I think rather than a mount option, it would be better to have a tunable on the MDS to control this, maybe along with a nodemap option as S&#233;bastien has done in patch &lt;a href=&quot;https://review.whamcloud.com/36433&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/36433&lt;/a&gt; so that it can be controlled by the server instead of the client, which may be a VM under the control of an unfriendly user. &lt;/p&gt;</comment>
                            <comment id="256314" author="adilger" created="Sun, 13 Oct 2019 14:35:23 +0000"  >&lt;p&gt;PS: I agree that regular users should not be able to change the projid by default. &lt;/p&gt;</comment>
                            <comment id="256315" author="sthiell" created="Sun, 13 Oct 2019 16:54:09 +0000"  >&lt;p&gt;and I agree with Andreas &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.whamcloud.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="256316" author="lixi_wc" created="Sun, 13 Oct 2019 22:48:44 +0000"  >&lt;p&gt;&amp;gt; rather than a mount option, it would be better to have a tunable on the MDS to control this&lt;/p&gt;

&lt;p&gt;Agreed on that.&lt;/p&gt;</comment>
                            <comment id="256363" author="sthiell" created="Mon, 14 Oct 2019 19:17:17 +0000"  >&lt;p&gt;Hi Li Xi,&lt;/p&gt;

&lt;p&gt;Just to clarify, when you say:&lt;/p&gt;

&lt;p&gt;&amp;gt; I still think the current behavior (not allowing the file owner to change the project ID of its file) is still useful in a lot of use cases.&#160;&lt;/p&gt;

&lt;p&gt;It is actually the opposite: currently in Lustre the file owner can change the project ID of its file. That means on filesystems where project quotas are enforced, users can likely bypass their project quota if they use &lt;tt&gt;lfs project&lt;/tt&gt; or &lt;tt&gt;chattr -p&lt;/tt&gt; (if available on the cluster) on their own files. We need a fix to only allow admins to set/change/remove project IDs and this should be the default, as in my understanding, the most common use case with Lustre is to use project quotas to enforce some kind of directory quotas (with inheritance), managed by system administrators, not users.&lt;/p&gt;

&lt;p&gt;But a tunable on the server should solve that. &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.whamcloud.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="256724" author="adilger" created="Mon, 21 Oct 2019 08:04:31 +0000"  >&lt;p&gt;I think it makes sense to add a tunable on the MDS similar to &quot;&lt;tt&gt;mdt.&amp;#42;.enable&amp;#95;remote&amp;#95;dir&amp;#95;gid&lt;/tt&gt;&quot; that allows users in specific groups to also change the projid.  By default, I think it makes sense to default to only allow root (&lt;tt&gt;CAP&amp;#95;SYS&amp;#95;RESOURCE&lt;/tt&gt;) to change the projid directly, and set &quot;&lt;tt&gt;mdt.&amp;#42;.change&amp;#95;projid&amp;#95;gid=0&lt;/tt&gt;&quot;.  Any users in that group (e.g. &lt;tt&gt;wheel&lt;/tt&gt; or &lt;tt&gt;admin&lt;/tt&gt;) can also change projid directly, if it is &quot;&lt;tt&gt;-1&lt;/tt&gt;&quot; then any user can change it.&lt;/p&gt;</comment>
                            <comment id="256802" author="gerrit" created="Tue, 22 Oct 2019 07:23:18 +0000"  >&lt;p&gt;Wang Shilong (wshilong@ddn.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/36544&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/36544&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12826&quot; title=&quot;Project quotas: users can change project IDs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12826&quot;&gt;&lt;del&gt;LU-12826&lt;/del&gt;&lt;/a&gt; mdt: limit root to change project state&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 3d38465be14aa28b89f75384980c4e96e15a1f04&lt;/p&gt;</comment>
                            <comment id="259533" author="sthiell" created="Tue, 10 Dec 2019 18:02:06 +0000"  >&lt;p&gt;It would be nice to have a backport of this important patch to b2_12 when it has landed (I tried to apply it but it doesn&apos;t work as is). Thanks much!&lt;/p&gt;</comment>
                            <comment id="259841" author="gerrit" created="Sat, 14 Dec 2019 05:57:02 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/36544/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/36544/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12826&quot; title=&quot;Project quotas: users can change project IDs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12826&quot;&gt;&lt;del&gt;LU-12826&lt;/del&gt;&lt;/a&gt; mdt: limit root to change project state by default&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 8fad70c0872ba13133024e4abf53a0bbee7ba1e9&lt;/p&gt;</comment>
                            <comment id="259878" author="pjones" created="Sat, 14 Dec 2019 13:39:13 +0000"  >&lt;p&gt;Landed for 2.14. &lt;a href=&quot;https://jira.whamcloud.com/secure/ViewProfile.jspa?name=sthiell&quot; class=&quot;user-hover&quot; rel=&quot;sthiell&quot;&gt;sthiell&lt;/a&gt; yes it&apos;s flagged to be back ported!&lt;/p&gt;</comment>
                            <comment id="260082" author="gerrit" created="Wed, 18 Dec 2019 02:37:51 +0000"  >&lt;p&gt;Wang Shilong (wshilong@ddn.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/37056&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37056&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12826&quot; title=&quot;Project quotas: users can change project IDs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12826&quot;&gt;&lt;del&gt;LU-12826&lt;/del&gt;&lt;/a&gt; mdt: limit root to change project state by default&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: b2_12&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 993b9274805056998282eaac28523841ceaa26ff&lt;/p&gt;</comment>
                            <comment id="260591" author="gerrit" created="Fri, 3 Jan 2020 23:43:41 +0000"  >&lt;p&gt;Oleg Drokin (green@whamcloud.com) merged in patch &lt;a href=&quot;https://review.whamcloud.com/37056/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37056/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12826&quot; title=&quot;Project quotas: users can change project IDs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12826&quot;&gt;&lt;del&gt;LU-12826&lt;/del&gt;&lt;/a&gt; mdt: limit root to change project state by default&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: b2_12&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 11c9ec6384070c0627b45b17e16e1a1c9aea7249&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="53159">LU-11303</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i00nkv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>