[pve-devel] [PATCH container 2/2] enable quotas for passed through /dev devices

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Mar 24 08:47:50 CET 2016


---
 src/PVE/LXC.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 0365996..238d9f2 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1111,8 +1111,11 @@ sub mountpoint_mount {
 	}
     } elsif ($type eq 'device') {
 	push @extra_opts, '-o', 'ro' if $readonly;
+	push @extra_opts, '-o', 'usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0' if $quota;
+	# See the NOTE above about devicemapper canonicalization
+	my ($devpath) = (Cwd::realpath($volid) =~ /^(.*)$/s); # realpath() taints
 	PVE::Tools::run_command(['mount', @extra_opts, $volid, $mount_path]) if $mount_path;
-	return wantarray ? ($volid, 0, $volid) : $volid;
+	return wantarray ? ($volid, 0, $devpath) : $volid;
     } elsif ($type eq 'bind') {
 	die "directory '$volid' does not exist\n" if ! -d $volid;
 	&$check_mount_path($volid);
-- 
2.1.4





More information about the pve-devel mailing list