From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A5FDCA0032; Fri, 24 Jun 2022 11:04:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5476140A87; Fri, 24 Jun 2022 11:04:45 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 9116D4069D for ; Fri, 24 Jun 2022 11:04:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656061483; x=1687597483; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=E1NGoOtZlbHnBl/dcWnxtMqQN8l5XnrO2vQk82HJpAo=; b=SLo8ErO4wPL3H6gWcaxjmNQypIJGdyEHT8DhMiHIxtrC2+jd87JH8TaD UMdKVPx1P6qjKqkdA5apkxySY7dV0/Xb1PTr48iiRjoUSwMueu/HFHot/ zY4Mc5lZ0+TeVPqxBITbeMCuWPoLVxSeHPNBy/fV4CvnGR7MzwSbw2hN7 7OpMQ1/517drggETEZSYvsjOZKgfWXKaSxSNwdKUUCEOQv9+lfDIfDd4V tPf3XjidiRfCR/g5w+bDgBJ+d/md0RQRc5tf0FaHdqyQbj47uMkJn8u9F 2gNOiIM5co5/MGqbcKNWHsnlXalfF2BXgPCHG/zbb4qNxFeToAFtXD02k g==; X-IronPort-AV: E=McAfee;i="6400,9594,10387"; a="279726208" X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="279726208" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2022 02:04:42 -0700 X-IronPort-AV: E=Sophos;i="5.92,218,1650956400"; d="scan'208";a="593141575" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.25.171]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 24 Jun 2022 02:04:41 -0700 Date: Fri, 24 Jun 2022 10:04:38 +0100 From: Bruce Richardson To: Dmitry Kozlyuk Cc: dev@dpdk.org Subject: Re: [PATCH v3 2/5] usertools: add option to change mount point owner Message-ID: References: <20220617112508.3823291-1-dkozlyuk@nvidia.com> <20220624084817.63145-1-dkozlyuk@nvidia.com> <20220624084817.63145-3-dkozlyuk@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220624084817.63145-3-dkozlyuk@nvidia.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 > --- > 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