diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-09 20:40:02 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-25 23:16:28 -0500 |
commit | 9e251d02041432487d89cb340e72490c4bbc198a (patch) | |
tree | 2b8381a585758a1281f8121cc96aebfbb7d23e02 | |
parent | 92fc41c3a612d27521241e2a550d938520fce0d6 (diff) |
kill pin_put()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/fs_pin.c | 11 | ||||
-rw-r--r-- | include/linux/fs_pin.h | 1 | ||||
-rw-r--r-- | kernel/acct.c | 14 |
3 files changed, 10 insertions, 16 deletions
diff --git a/fs/fs_pin.c b/fs/fs_pin.c index 9368236ca100..f173313760b8 100644 --- a/fs/fs_pin.c +++ b/fs/fs_pin.c | |||
@@ -4,19 +4,8 @@ | |||
4 | #include "internal.h" | 4 | #include "internal.h" |
5 | #include "mount.h" | 5 | #include "mount.h" |
6 | 6 | ||
7 | static void pin_free_rcu(struct rcu_head *head) | ||
8 | { | ||
9 | kfree(container_of(head, struct fs_pin, rcu)); | ||
10 | } | ||
11 | |||
12 | static DEFINE_SPINLOCK(pin_lock); | 7 | static DEFINE_SPINLOCK(pin_lock); |
13 | 8 | ||
14 | void pin_put(struct fs_pin *p) | ||
15 | { | ||
16 | if (atomic_long_dec_and_test(&p->count)) | ||
17 | call_rcu(&p->rcu, pin_free_rcu); | ||
18 | } | ||
19 | |||
20 | void pin_remove(struct fs_pin *pin) | 9 | void pin_remove(struct fs_pin *pin) |
21 | { | 10 | { |
22 | spin_lock(&pin_lock); | 11 | spin_lock(&pin_lock); |
diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h index f66525e72ccf..68a54b7741aa 100644 --- a/include/linux/fs_pin.h +++ b/include/linux/fs_pin.h | |||
@@ -12,6 +12,5 @@ struct fs_pin { | |||
12 | void (*kill)(struct fs_pin *); | 12 | void (*kill)(struct fs_pin *); |
13 | }; | 13 | }; |
14 | 14 | ||
15 | void pin_put(struct fs_pin *); | ||
16 | void pin_remove(struct fs_pin *); | 15 | void pin_remove(struct fs_pin *); |
17 | void pin_insert(struct fs_pin *, struct vfsmount *); | 16 | void pin_insert(struct fs_pin *, struct vfsmount *); |
diff --git a/kernel/acct.c b/kernel/acct.c index 33738ef972f3..7bb9e659a7da 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -124,6 +124,12 @@ out: | |||
124 | return acct->active; | 124 | return acct->active; |
125 | } | 125 | } |
126 | 126 | ||
127 | static void acct_put(struct bsd_acct_struct *p) | ||
128 | { | ||
129 | if (atomic_long_dec_and_test(&p->pin.count)) | ||
130 | kfree_rcu(p, pin.rcu); | ||
131 | } | ||
132 | |||
127 | static struct bsd_acct_struct *acct_get(struct pid_namespace *ns) | 133 | static struct bsd_acct_struct *acct_get(struct pid_namespace *ns) |
128 | { | 134 | { |
129 | struct bsd_acct_struct *res; | 135 | struct bsd_acct_struct *res; |
@@ -144,7 +150,7 @@ again: | |||
144 | mutex_lock(&res->lock); | 150 | mutex_lock(&res->lock); |
145 | if (!res->ns) { | 151 | if (!res->ns) { |
146 | mutex_unlock(&res->lock); | 152 | mutex_unlock(&res->lock); |
147 | pin_put(&res->pin); | 153 | acct_put(res); |
148 | goto again; | 154 | goto again; |
149 | } | 155 | } |
150 | return res; | 156 | return res; |
@@ -175,7 +181,7 @@ static void acct_kill(struct bsd_acct_struct *acct, | |||
175 | acct->ns = NULL; | 181 | acct->ns = NULL; |
176 | atomic_long_dec(&acct->pin.count); | 182 | atomic_long_dec(&acct->pin.count); |
177 | mutex_unlock(&acct->lock); | 183 | mutex_unlock(&acct->lock); |
178 | pin_put(&acct->pin); | 184 | acct_put(acct); |
179 | } | 185 | } |
180 | } | 186 | } |
181 | 187 | ||
@@ -186,7 +192,7 @@ static void acct_pin_kill(struct fs_pin *pin) | |||
186 | mutex_lock(&acct->lock); | 192 | mutex_lock(&acct->lock); |
187 | if (!acct->ns) { | 193 | if (!acct->ns) { |
188 | mutex_unlock(&acct->lock); | 194 | mutex_unlock(&acct->lock); |
189 | pin_put(pin); | 195 | acct_put(acct); |
190 | acct = NULL; | 196 | acct = NULL; |
191 | } | 197 | } |
192 | acct_kill(acct, NULL); | 198 | acct_kill(acct, NULL); |
@@ -576,7 +582,7 @@ static void slow_acct_process(struct pid_namespace *ns) | |||
576 | if (acct) { | 582 | if (acct) { |
577 | do_acct_process(acct); | 583 | do_acct_process(acct); |
578 | mutex_unlock(&acct->lock); | 584 | mutex_unlock(&acct->lock); |
579 | pin_put(&acct->pin); | 585 | acct_put(acct); |
580 | } | 586 | } |
581 | } | 587 | } |
582 | } | 588 | } |