Details

    • 9223372036854775807

    Description

      It would be useful to allow names to be mapped to projid numbers using the /etc/projid file (projid.5), as is used by the XFS quota utility (xfs_quota.8):

      usera:1
      userc:3
      

      There should be a new function struct ll_project *llapi_getprjname(const char *name) function that is called by lfs and lctl to read the /etc/projid file and lookup the name and return the projid, while struct ll_project *llapi_getprjid(__u32 prjid) would lookup the numeric project ID and return the name:

      struct ll_project {
              __u32 lp_projid;
              char *lp_name;
      };
      

      Returning the struct instead of a single value (name or prjid) allows expanding this interface in the future (e.g. to list which users are allowed to use/change the group, passwords for the group, etc. as with getgrnam(), getgrgid(), getpwnam(), getpwuid()).

      It isn't very clear what benefit the /etc/projects file (projects.5) provides, so I'm not yet sure whether we need to implement support for this or not.

      This should be available for use by lfs project -p, lfs find -projid, lfs quota -p, lfs setquota -p.

      Attachments

        Issue Links

          Activity

            [LU-13335] add name lookup for project IDs
            adilger Andreas Dilger made changes -
            Labels Original: lug23dd lug24dd medium utils New: lug23dd lug24dd medium patch utils

            I've filed LU-18661 to track the enable/disable implicit fallback to username/groupname.

            adilger Andreas Dilger added a comment - I've filed LU-18661 to track the enable/disable implicit fallback to username/groupname.
            adilger Andreas Dilger made changes -
            Link New: This issue is related to LU-18661 [ LU-18661 ]
            fdilger Fred Dilger made changes -
            Link New: This issue has to be done before LU-18659 [ LU-18659 ]

            "Frederick Dilger <fdilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/57836
            Subject: LU-13335 utils: allow using uid and gid for prjid
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: dfca145f5da870d205b8a855e3f893625e442820

            gerrit Gerrit Updater added a comment - "Frederick Dilger <fdilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/57836 Subject: LU-13335 utils: allow using uid and gid for prjid Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: dfca145f5da870d205b8a855e3f893625e442820
            fdilger Fred Dilger made changes -
            Link New: This issue has to be done before LU-18640 [ LU-18640 ]
            fdilger Fred Dilger made changes -
            Link New: This issue has to be done before LU-18638 [ LU-18638 ]

            Attached prototype man page projid.5 to describe the base functionality and limitations.

            adilger Andreas Dilger added a comment - Attached prototype man page projid.5 to describe the base functionality and limitations.
            adilger Andreas Dilger made changes -
            Attachment New: projid.5 [ 57349 ]

            For the "/etc/passwd" fallback, we've been discussing a few approaches:

            • store some directive as a comment in the file, like "# config: projname=passwd" or "# config: projname=group" that would redirect all future projname or projid lookups to use getpwnam()/getpwuid() or getgrnam()/getgrgid() as appropriate to look up the supplied name/ID. This has the advantage that it maintains compatibility with XFS, but means that all of the comment lines need to be parsed.
            • store some directive as a "special" entry, like "*:passwd:use passwd entry for projid mapping" or "*:group:use group entry for projid mapping", which simplifies the parsing to some extent, but would likely break compatibility with XFS entries.

            Alternately, this could be opt-in on the command-line by specifying a "project name" like "-p u:adilger" or "-p g:adilger" to do a user or group database lookup,

            Reviewing the Solaris projects(5) man page I see that it is using project names of the form user.USERNAME and group.GROUPNAME" to identify project names to match the username, but which could also be used in addition to or instead of "u:USERNAME". I'm a bit reluctant to allow '.' in the argument. According to this Serverfault page the use of '.' is normally forbidden in user/group names, but I'd prefer to avoid any unnecessary restrictions if possible.

            adilger Andreas Dilger added a comment - For the " /etc/passwd " fallback, we've been discussing a few approaches: store some directive as a comment in the file, like " # config: projname=passwd " or " # config: projname=group " that would redirect all future projname or projid lookups to use getpwnam()/getpwuid() or getgrnam()/getgrgid() as appropriate to look up the supplied name/ID. This has the advantage that it maintains compatibility with XFS, but means that all of the comment lines need to be parsed. store some directive as a "special" entry, like " *:passwd:use passwd entry for projid mapping " or " *:group:use group entry for projid mapping ", which simplifies the parsing to some extent, but would likely break compatibility with XFS entries. Alternately, this could be opt-in on the command-line by specifying a "project name" like "-p u:adilger" or "-p g:adilger" to do a user or group database lookup, Reviewing the Solaris projects(5) man page I see that it is using project names of the form user. USERNAME and group. GROUPNAME " to identify project names to match the username, but which could also be used in addition to or instead of " u: USERNAME ". I'm a bit reluctant to allow ' . ' in the argument. According to this Serverfault page the use of ' . ' is normally forbidden in user/group names, but I'd prefer to avoid any unnecessary restrictions if possible.

            People

              fdilger Fred Dilger
              adilger Andreas Dilger
              Votes:
              1 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated: