lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 30 May 2012 22:59:06 +0800
From:	jeff.liu@...cle.com
To:	containers@...ts.linux-foundation.org
Cc:	cgroups@...r.kernel.org, jack@...e.cz, glommer@...allels.com,
	daniel.lezcano@...e.fr, tytso@....edu, bpm@....com,
	chris.mason@...cle.com, hch@...radead.org,
	christopher.jones@...cle.com, david@...morbit.com,
	tinguely@....com, tm@....ma, linux-ext4@...r.kernel.org,
	linux-fsdevel@...r.kernel.org, Jie Liu <jeff.liu@...cle.com>
Subject: [PATCH 12/12] container quota: init/destroy container dqinfo on mount namespace.

Initialize and destroy quota info when cloning a mount namespace or
free it up when the namespace was destroyed separately.

Signed-off-by: Jie Liu <jeff.liu@...cle.com>
---
 fs/namespace.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 8823ba8..b12a054 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -23,6 +23,11 @@
 #include "pnode.h"
 #include "internal.h"
 
+#ifdef CONFIG_NS_QUOTA
+#include "ns_quota.h"
+#include "ns_quotaops.h"
+#endif
+
 #define HASH_SHIFT ilog2(PAGE_SIZE / sizeof(struct list_head))
 #define HASH_SIZE (1UL << HASH_SHIFT)
 
@@ -2204,6 +2209,17 @@ static struct mnt_namespace *alloc_mnt_ns(void)
 	INIT_LIST_HEAD(&new_ns->list);
 	init_waitqueue_head(&new_ns->poll);
 	new_ns->event = 0;
+#ifdef CONFIG_NS_QUOTA
+	/*
+	 * Don't trying to enable the corresponding disk quota stuff
+	 * at the this stage for now.  We need to come up with a
+	 * reasonable definition for mount namespace or container disk
+	 * quotas.
+	 */
+	new_ns->ns_qcop = NULL;
+	new_ns->ns_dqop = NULL;
+	new_ns->ns_dqinfo = NULL;
+#endif
 	return new_ns;
 }
 
@@ -2250,6 +2266,15 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
 		return ERR_PTR(-ENOMEM);
 	}
 	new_ns->root = new;
+#ifdef CONFIG_NS_QUOTA
+	/*
+	 * Initialize disk quota stuff if the current mount namespace is
+	 * cloned for containers.
+	 */
+	new_ns->ns_qcop = &ns_quotactl_operations;
+	new_ns->ns_dqop = &ns_dquot_operations;
+	ns_dqinfo_init(new_ns);
+#endif
 	br_write_lock(vfsmount_lock);
 	list_add_tail(&new_ns->list, &new->mnt_list);
 	br_write_unlock(vfsmount_lock);
@@ -2598,6 +2623,9 @@ void put_mnt_ns(struct mnt_namespace *ns)
 	down_write(&namespace_sem);
 	br_write_lock(vfsmount_lock);
 	umount_tree(ns->root, 0, &umount_list);
+#ifdef CONFIG_NS_QUOTA
+	ns_dqinfo_destroy(ns);
+#endif
 	br_write_unlock(vfsmount_lock);
 	up_write(&namespace_sem);
 	release_mounts(&umount_list);
-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ