[PATCH v3 2/5] usertools: add option to change mount point owner
Bruce Richardson
bruce.richardson at intel.com
Fri Jun 24 11:04:38 CEST 2022
On Fri, Jun 24, 2022 at 11:48:14AM +0300, Dmitry Kozlyuk wrote:
> Per mount(8), the previous owner and mode of the mount point
> become invisible as long as this filesystem remains mounted.
> Because dpdk-hugepages.py must be run as root,
> the new owner would be root.
> This is undesirable if the hugepage directory is being set up
> by the administrator for an unprivileged user.
> HugeTLB filesystem has options to set the mount point owner.
> Add --owner/-o option to apply this option when mounting.
> The benefit of performing this in dpdk-hugepages.py
> is that the user does not need to care about this detail
> of mount command operation.
>
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk at nvidia.com>
> ---
> usertools/dpdk-hugepages.py | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py
> index 8bab086a2f..5120518bcb 100755
> --- a/usertools/dpdk-hugepages.py
> +++ b/usertools/dpdk-hugepages.py
> @@ -170,7 +170,7 @@ def get_mountpoints():
> return mounted
>
>
> -def mount_huge(pagesize, mountpoint):
> +def mount_huge(pagesize, mountpoint, owner):
> '''Mount the huge TLB file system'''
> if mountpoint in get_mountpoints():
> print(mountpoint, "already mounted")
> @@ -178,6 +178,9 @@ def mount_huge(pagesize, mountpoint):
> cmd = "mount -t hugetlbfs"
> if pagesize:
> cmd += ' -o pagesize={}'.format(pagesize * 1024)
> + if owner:
> + uid, gid = owner.split(':', maxsplit=1)
> + cmd += ' -o uid={},gid={}'.format(uid, gid)
Still don't like this syntax and always setting both together. Can we
change the "owner" flag to separate "uid" and "gid" flags so they can be
set independently (and explicitly).
/Bruce
More information about the dev
mailing list