diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-10 12:47:38 -0500 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-25 23:17:27 -0500 |
| commit | 34cece2e8a1d2b66f00e153a19b80b4d4cec4eb8 (patch) | |
| tree | acb981809dfccd4aead012d604650435be41f7ef /kernel | |
| parent | 360f54796ed65939093ae373b92ebd5ef3341776 (diff) | |
take count and rcu_head out of fs_pin
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/acct.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index a74f3d1a0c26..b8fbefb8678f 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
| @@ -80,6 +80,8 @@ static void do_acct_process(struct bsd_acct_struct *acct); | |||
| 80 | 80 | ||
| 81 | struct bsd_acct_struct { | 81 | struct bsd_acct_struct { |
| 82 | struct fs_pin pin; | 82 | struct fs_pin pin; |
| 83 | atomic_long_t count; | ||
| 84 | struct rcu_head rcu; | ||
| 83 | struct mutex lock; | 85 | struct mutex lock; |
| 84 | int active; | 86 | int active; |
| 85 | unsigned long needcheck; | 87 | unsigned long needcheck; |
| @@ -126,8 +128,8 @@ out: | |||
| 126 | 128 | ||
| 127 | static void acct_put(struct bsd_acct_struct *p) | 129 | static void acct_put(struct bsd_acct_struct *p) |
| 128 | { | 130 | { |
| 129 | if (atomic_long_dec_and_test(&p->pin.count)) | 131 | if (atomic_long_dec_and_test(&p->count)) |
| 130 | kfree_rcu(p, pin.rcu); | 132 | kfree_rcu(p, rcu); |
| 131 | } | 133 | } |
| 132 | 134 | ||
| 133 | static struct bsd_acct_struct *acct_get(struct pid_namespace *ns) | 135 | static struct bsd_acct_struct *acct_get(struct pid_namespace *ns) |
| @@ -141,7 +143,7 @@ again: | |||
| 141 | rcu_read_unlock(); | 143 | rcu_read_unlock(); |
| 142 | return NULL; | 144 | return NULL; |
| 143 | } | 145 | } |
| 144 | if (!atomic_long_inc_not_zero(&res->pin.count)) { | 146 | if (!atomic_long_inc_not_zero(&res->count)) { |
| 145 | rcu_read_unlock(); | 147 | rcu_read_unlock(); |
| 146 | cpu_relax(); | 148 | cpu_relax(); |
| 147 | goto again; | 149 | goto again; |
| @@ -179,7 +181,7 @@ static void acct_kill(struct bsd_acct_struct *acct, | |||
| 179 | pin_remove(&acct->pin); | 181 | pin_remove(&acct->pin); |
| 180 | ns->bacct = new; | 182 | ns->bacct = new; |
| 181 | acct->ns = NULL; | 183 | acct->ns = NULL; |
| 182 | atomic_long_dec(&acct->pin.count); | 184 | atomic_long_dec(&acct->count); |
| 183 | mutex_unlock(&acct->lock); | 185 | mutex_unlock(&acct->lock); |
| 184 | acct_put(acct); | 186 | acct_put(acct); |
| 185 | } | 187 | } |
| @@ -189,7 +191,7 @@ static void acct_pin_kill(struct fs_pin *pin) | |||
| 189 | { | 191 | { |
| 190 | struct bsd_acct_struct *acct; | 192 | struct bsd_acct_struct *acct; |
| 191 | acct = container_of(pin, struct bsd_acct_struct, pin); | 193 | acct = container_of(pin, struct bsd_acct_struct, pin); |
| 192 | if (!atomic_long_inc_not_zero(&pin->count)) { | 194 | if (!atomic_long_inc_not_zero(&acct->count)) { |
| 193 | rcu_read_unlock(); | 195 | rcu_read_unlock(); |
| 194 | cpu_relax(); | 196 | cpu_relax(); |
| 195 | return; | 197 | return; |
| @@ -250,7 +252,7 @@ static int acct_on(struct filename *pathname) | |||
| 250 | mnt = file->f_path.mnt; | 252 | mnt = file->f_path.mnt; |
| 251 | file->f_path.mnt = internal; | 253 | file->f_path.mnt = internal; |
| 252 | 254 | ||
| 253 | atomic_long_set(&acct->pin.count, 1); | 255 | atomic_long_set(&acct->count, 1); |
| 254 | acct->pin.kill = acct_pin_kill; | 256 | acct->pin.kill = acct_pin_kill; |
| 255 | acct->file = file; | 257 | acct->file = file; |
| 256 | acct->needcheck = jiffies; | 258 | acct->needcheck = jiffies; |
