Thread (8 messages) 8 messages, 3 authors, 2016-06-06

Re: [PATCH 1/4] inotify: Add infrastructure to account inotify limits per-namespace

From: Cyrill Gorcunov <hidden>
Date: 2016-06-06 08:06:07
Also in: lkml

On Wed, Jun 01, 2016 at 10:52:57AM +0300, Nikolay Borisov wrote:
This patch adds the necessary members to user_struct. The idea behind
the solution is really simple - user the userns pointers as keys into
a hash table which holds the inotify instances/watches counts. This
allows to account the limits per userns rather than per real user,
which makes certain scenarios such as a single mapped user in a
container deplete the inotify resources for all other users, which
map to the exact same real user.

Signed-off-by: Nikolay Borisov <redacted>
...
+static inline unsigned long inotify_dec_return_dev(struct user_struct *user,
+						   void *key)
+{
+	struct inotify_state *state;
+	unsigned long ret;
+
+	spin_lock(&user->inotify_lock);
+	state = __find_inotify_state(user, key);
+	ret = --state->inotify_devs;
+	spin_unlock(&user->inotify_lock);
+
+	return ret;
+}
Hi Nikolay! Could you please explain why this new function is not used anywhere
in other patches or I miss something obvious?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help