diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-16 14:51:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-16 14:51:08 -0400 |
commit | 271ecc5253e2b317d729d366560789cd7f93836c (patch) | |
tree | d3a60bc4dfa8245ff934f357f2367db76b59e7cf /fs | |
parent | aa6865d836418eb2ba888a4cb1318a28e9aa2e0c (diff) | |
parent | 63c06227a22b098a3849c5c99e836aea161ca0d7 (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge first patch-bomb from Andrew Morton:
- some misc things
- ofs2 updates
- about half of MM
- checkpatch updates
- autofs4 update
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (120 commits)
autofs4: fix string.h include in auto_dev-ioctl.h
autofs4: use pr_xxx() macros directly for logging
autofs4: change log print macros to not insert newline
autofs4: make autofs log prints consistent
autofs4: fix some white space errors
autofs4: fix invalid ioctl return in autofs4_root_ioctl_unlocked()
autofs4: fix coding style line length in autofs4_wait()
autofs4: fix coding style problem in autofs4_get_set_timeout()
autofs4: coding style fixes
autofs: show pipe inode in mount options
kallsyms: add support for relative offsets in kallsyms address table
kallsyms: don't overload absolute symbol type for percpu symbols
x86: kallsyms: disable absolute percpu symbols on !SMP
checkpatch: fix another left brace warning
checkpatch: improve UNSPECIFIED_INT test for bare signed/unsigned uses
checkpatch: warn on bare unsigned or signed declarations without int
checkpatch: exclude asm volatile from complex macro check
mm: memcontrol: drop unnecessary lru locking from mem_cgroup_migrate()
mm: migrate: consolidate mem_cgroup_migrate() calls
mm/compaction: speed up pageblock_pfn_to_page() when zone is contiguous
...
Diffstat (limited to 'fs')
-rw-r--r-- | fs/autofs4/autofs_i.h | 72 | ||||
-rw-r--r-- | fs/autofs4/dev-ioctl.c | 57 | ||||
-rw-r--r-- | fs/autofs4/expire.c | 84 | ||||
-rw-r--r-- | fs/autofs4/init.c | 10 | ||||
-rw-r--r-- | fs/autofs4/inode.c | 52 | ||||
-rw-r--r-- | fs/autofs4/root.c | 163 | ||||
-rw-r--r-- | fs/autofs4/symlink.c | 11 | ||||
-rw-r--r-- | fs/autofs4/waitq.c | 78 | ||||
-rw-r--r-- | fs/buffer.c | 24 | ||||
-rw-r--r-- | fs/mpage.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 10 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmcommon.h | 26 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmdomain.c | 13 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmmaster.c | 127 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 40 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmthread.c | 13 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_aops.c | 11 |
18 files changed, 501 insertions, 298 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index c37149b929be..f0d268b97d19 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -1,15 +1,11 @@ | |||
1 | /* -*- c -*- ------------------------------------------------------------- * | 1 | /* |
2 | * | 2 | * Copyright 1997-1998 Transmeta Corporation - All Rights Reserved |
3 | * linux/fs/autofs/autofs_i.h | 3 | * Copyright 2005-2006 Ian Kent <raven@themaw.net> |
4 | * | ||
5 | * Copyright 1997-1998 Transmeta Corporation - All Rights Reserved | ||
6 | * Copyright 2005-2006 Ian Kent <raven@themaw.net> | ||
7 | * | 4 | * |
8 | * This file is part of the Linux kernel and is made available under | 5 | * This file is part of the Linux kernel and is made available under |
9 | * the terms of the GNU General Public License, version 2, or at your | 6 | * the terms of the GNU General Public License, version 2, or at your |
10 | * option, any later version, incorporated herein by reference. | 7 | * option, any later version, incorporated herein by reference. |
11 | * | 8 | */ |
12 | * ----------------------------------------------------------------------- */ | ||
13 | 9 | ||
14 | /* Internal header file for autofs */ | 10 | /* Internal header file for autofs */ |
15 | 11 | ||
@@ -35,28 +31,23 @@ | |||
35 | #include <linux/mount.h> | 31 | #include <linux/mount.h> |
36 | #include <linux/namei.h> | 32 | #include <linux/namei.h> |
37 | #include <asm/current.h> | 33 | #include <asm/current.h> |
38 | #include <asm/uaccess.h> | 34 | #include <linux/uaccess.h> |
39 | 35 | ||
40 | /* #define DEBUG */ | 36 | /* #define DEBUG */ |
41 | 37 | ||
42 | #define DPRINTK(fmt, ...) \ | 38 | #ifdef pr_fmt |
43 | pr_debug("pid %d: %s: " fmt "\n", \ | 39 | #undef pr_fmt |
44 | current->pid, __func__, ##__VA_ARGS__) | 40 | #endif |
45 | 41 | #define pr_fmt(fmt) KBUILD_MODNAME ":pid:%d:%s: " fmt, current->pid, __func__ | |
46 | #define AUTOFS_WARN(fmt, ...) \ | 42 | |
47 | printk(KERN_WARNING "pid %d: %s: " fmt "\n", \ | 43 | /* |
48 | current->pid, __func__, ##__VA_ARGS__) | 44 | * Unified info structure. This is pointed to by both the dentry and |
49 | 45 | * inode structures. Each file in the filesystem has an instance of this | |
50 | #define AUTOFS_ERROR(fmt, ...) \ | 46 | * structure. It holds a reference to the dentry, so dentries are never |
51 | printk(KERN_ERR "pid %d: %s: " fmt "\n", \ | 47 | * flushed while the file exists. All name lookups are dealt with at the |
52 | current->pid, __func__, ##__VA_ARGS__) | 48 | * dentry level, although the filesystem can interfere in the validation |
53 | 49 | * process. Readdir is implemented by traversing the dentry lists. | |
54 | /* Unified info structure. This is pointed to by both the dentry and | 50 | */ |
55 | inode structures. Each file in the filesystem has an instance of this | ||
56 | structure. It holds a reference to the dentry, so dentries are never | ||
57 | flushed while the file exists. All name lookups are dealt with at the | ||
58 | dentry level, although the filesystem can interfere in the validation | ||
59 | process. Readdir is implemented by traversing the dentry lists. */ | ||
60 | struct autofs_info { | 51 | struct autofs_info { |
61 | struct dentry *dentry; | 52 | struct dentry *dentry; |
62 | struct inode *inode; | 53 | struct inode *inode; |
@@ -78,7 +69,7 @@ struct autofs_info { | |||
78 | kgid_t gid; | 69 | kgid_t gid; |
79 | }; | 70 | }; |
80 | 71 | ||
81 | #define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */ | 72 | #define AUTOFS_INF_EXPIRING (1<<0) /* dentry in the process of expiring */ |
82 | #define AUTOFS_INF_NO_RCU (1<<1) /* the dentry is being considered | 73 | #define AUTOFS_INF_NO_RCU (1<<1) /* the dentry is being considered |
83 | * for expiry, so RCU_walk is | 74 | * for expiry, so RCU_walk is |
84 | * not permitted | 75 | * not permitted |
@@ -140,10 +131,11 @@ static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry) | |||
140 | } | 131 | } |
141 | 132 | ||
142 | /* autofs4_oz_mode(): do we see the man behind the curtain? (The | 133 | /* autofs4_oz_mode(): do we see the man behind the curtain? (The |
143 | processes which do manipulations for us in user space sees the raw | 134 | * processes which do manipulations for us in user space sees the raw |
144 | filesystem without "magic".) */ | 135 | * filesystem without "magic".) |
145 | 136 | */ | |
146 | static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) { | 137 | static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) |
138 | { | ||
147 | return sbi->catatonic || task_pgrp(current) == sbi->oz_pgrp; | 139 | return sbi->catatonic || task_pgrp(current) == sbi->oz_pgrp; |
148 | } | 140 | } |
149 | 141 | ||
@@ -154,12 +146,12 @@ void autofs4_free_ino(struct autofs_info *); | |||
154 | int is_autofs4_dentry(struct dentry *); | 146 | int is_autofs4_dentry(struct dentry *); |
155 | int autofs4_expire_wait(struct dentry *dentry, int rcu_walk); | 147 | int autofs4_expire_wait(struct dentry *dentry, int rcu_walk); |
156 | int autofs4_expire_run(struct super_block *, struct vfsmount *, | 148 | int autofs4_expire_run(struct super_block *, struct vfsmount *, |
157 | struct autofs_sb_info *, | 149 | struct autofs_sb_info *, |
158 | struct autofs_packet_expire __user *); | 150 | struct autofs_packet_expire __user *); |
159 | int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, | 151 | int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, |
160 | struct autofs_sb_info *sbi, int when); | 152 | struct autofs_sb_info *sbi, int when); |
161 | int autofs4_expire_multi(struct super_block *, struct vfsmount *, | 153 | int autofs4_expire_multi(struct super_block *, struct vfsmount *, |
162 | struct autofs_sb_info *, int __user *); | 154 | struct autofs_sb_info *, int __user *); |
163 | struct dentry *autofs4_expire_direct(struct super_block *sb, | 155 | struct dentry *autofs4_expire_direct(struct super_block *sb, |
164 | struct vfsmount *mnt, | 156 | struct vfsmount *mnt, |
165 | struct autofs_sb_info *sbi, int how); | 157 | struct autofs_sb_info *sbi, int how); |
@@ -224,8 +216,8 @@ static inline int autofs_prepare_pipe(struct file *pipe) | |||
224 | 216 | ||
225 | /* Queue management functions */ | 217 | /* Queue management functions */ |
226 | 218 | ||
227 | int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); | 219 | int autofs4_wait(struct autofs_sb_info *, struct dentry *, enum autofs_notify); |
228 | int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int); | 220 | int autofs4_wait_release(struct autofs_sb_info *, autofs_wqt_t, int); |
229 | void autofs4_catatonic_mode(struct autofs_sb_info *); | 221 | void autofs4_catatonic_mode(struct autofs_sb_info *); |
230 | 222 | ||
231 | static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi) | 223 | static inline u32 autofs4_get_dev(struct autofs_sb_info *sbi) |
@@ -242,37 +234,37 @@ static inline void __autofs4_add_expiring(struct dentry *dentry) | |||
242 | { | 234 | { |
243 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 235 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
244 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 236 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
237 | |||
245 | if (ino) { | 238 | if (ino) { |
246 | if (list_empty(&ino->expiring)) | 239 | if (list_empty(&ino->expiring)) |
247 | list_add(&ino->expiring, &sbi->expiring_list); | 240 | list_add(&ino->expiring, &sbi->expiring_list); |
248 | } | 241 | } |
249 | return; | ||
250 | } | 242 | } |
251 | 243 | ||
252 | static inline void autofs4_add_expiring(struct dentry *dentry) | 244 | static inline void autofs4_add_expiring(struct dentry *dentry) |
253 | { | 245 | { |
254 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 246 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
255 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 247 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
248 | |||
256 | if (ino) { | 249 | if (ino) { |
257 | spin_lock(&sbi->lookup_lock); | 250 | spin_lock(&sbi->lookup_lock); |
258 | if (list_empty(&ino->expiring)) | 251 | if (list_empty(&ino->expiring)) |
259 | list_add(&ino->expiring, &sbi->expiring_list); | 252 | list_add(&ino->expiring, &sbi->expiring_list); |
260 | spin_unlock(&sbi->lookup_lock); | 253 | spin_unlock(&sbi->lookup_lock); |
261 | } | 254 | } |
262 | return; | ||
263 | } | 255 | } |
264 | 256 | ||
265 | static inline void autofs4_del_expiring(struct dentry *dentry) | 257 | static inline void autofs4_del_expiring(struct dentry *dentry) |
266 | { | 258 | { |
267 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 259 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
268 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 260 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
261 | |||
269 | if (ino) { | 262 | if (ino) { |
270 | spin_lock(&sbi->lookup_lock); | 263 | spin_lock(&sbi->lookup_lock); |
271 | if (!list_empty(&ino->expiring)) | 264 | if (!list_empty(&ino->expiring)) |
272 | list_del_init(&ino->expiring); | 265 | list_del_init(&ino->expiring); |
273 | spin_unlock(&sbi->lookup_lock); | 266 | spin_unlock(&sbi->lookup_lock); |
274 | } | 267 | } |
275 | return; | ||
276 | } | 268 | } |
277 | 269 | ||
278 | extern void autofs4_kill_sb(struct super_block *); | 270 | extern void autofs4_kill_sb(struct super_block *); |
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index ac7d921ed984..c7fcc7438843 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
@@ -72,13 +72,13 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param) | |||
72 | { | 72 | { |
73 | int err = 0; | 73 | int err = 0; |
74 | 74 | ||
75 | if ((AUTOFS_DEV_IOCTL_VERSION_MAJOR != param->ver_major) || | 75 | if ((param->ver_major != AUTOFS_DEV_IOCTL_VERSION_MAJOR) || |
76 | (AUTOFS_DEV_IOCTL_VERSION_MINOR < param->ver_minor)) { | 76 | (param->ver_minor > AUTOFS_DEV_IOCTL_VERSION_MINOR)) { |
77 | AUTOFS_WARN("ioctl control interface version mismatch: " | 77 | pr_warn("ioctl control interface version mismatch: " |
78 | "kernel(%u.%u), user(%u.%u), cmd(%d)", | 78 | "kernel(%u.%u), user(%u.%u), cmd(%d)\n", |
79 | AUTOFS_DEV_IOCTL_VERSION_MAJOR, | 79 | AUTOFS_DEV_IOCTL_VERSION_MAJOR, |
80 | AUTOFS_DEV_IOCTL_VERSION_MINOR, | 80 | AUTOFS_DEV_IOCTL_VERSION_MINOR, |
81 | param->ver_major, param->ver_minor, cmd); | 81 | param->ver_major, param->ver_minor, cmd); |
82 | err = -EINVAL; | 82 | err = -EINVAL; |
83 | } | 83 | } |
84 | 84 | ||
@@ -93,7 +93,8 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param) | |||
93 | * Copy parameter control struct, including a possible path allocated | 93 | * Copy parameter control struct, including a possible path allocated |
94 | * at the end of the struct. | 94 | * at the end of the struct. |
95 | */ | 95 | */ |
96 | static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in) | 96 | static struct autofs_dev_ioctl * |
97 | copy_dev_ioctl(struct autofs_dev_ioctl __user *in) | ||
97 | { | 98 | { |
98 | struct autofs_dev_ioctl tmp, *res; | 99 | struct autofs_dev_ioctl tmp, *res; |
99 | 100 | ||
@@ -116,7 +117,6 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i | |||
116 | static inline void free_dev_ioctl(struct autofs_dev_ioctl *param) | 117 | static inline void free_dev_ioctl(struct autofs_dev_ioctl *param) |
117 | { | 118 | { |
118 | kfree(param); | 119 | kfree(param); |
119 | return; | ||
120 | } | 120 | } |
121 | 121 | ||
122 | /* | 122 | /* |
@@ -129,24 +129,24 @@ static int validate_dev_ioctl(int cmd, struct autofs_dev_ioctl *param) | |||
129 | 129 | ||
130 | err = check_dev_ioctl_version(cmd, param); | 130 | err = check_dev_ioctl_version(cmd, param); |
131 | if (err) { | 131 | if (err) { |
132 | AUTOFS_WARN("invalid device control module version " | 132 | pr_warn("invalid device control module version " |
133 | "supplied for cmd(0x%08x)", cmd); | 133 | "supplied for cmd(0x%08x)\n", cmd); |
134 | goto out; | 134 | goto out; |
135 | } | 135 | } |
136 | 136 | ||
137 | if (param->size > sizeof(*param)) { | 137 | if (param->size > sizeof(*param)) { |
138 | err = invalid_str(param->path, param->size - sizeof(*param)); | 138 | err = invalid_str(param->path, param->size - sizeof(*param)); |
139 | if (err) { | 139 | if (err) { |
140 | AUTOFS_WARN( | 140 | pr_warn( |
141 | "path string terminator missing for cmd(0x%08x)", | 141 | "path string terminator missing for cmd(0x%08x)\n", |
142 | cmd); | 142 | cmd); |
143 | goto out; | 143 | goto out; |
144 | } | 144 | } |
145 | 145 | ||
146 | err = check_name(param->path); | 146 | err = check_name(param->path); |
147 | if (err) { | 147 | if (err) { |
148 | AUTOFS_WARN("invalid path supplied for cmd(0x%08x)", | 148 | pr_warn("invalid path supplied for cmd(0x%08x)\n", |
149 | cmd); | 149 | cmd); |
150 | goto out; | 150 | goto out; |
151 | } | 151 | } |
152 | } | 152 | } |
@@ -197,7 +197,9 @@ static int find_autofs_mount(const char *pathname, | |||
197 | void *data) | 197 | void *data) |
198 | { | 198 | { |
199 | struct path path; | 199 | struct path path; |
200 | int err = kern_path_mountpoint(AT_FDCWD, pathname, &path, 0); | 200 | int err; |
201 | |||
202 | err = kern_path_mountpoint(AT_FDCWD, pathname, &path, 0); | ||
201 | if (err) | 203 | if (err) |
202 | return err; | 204 | return err; |
203 | err = -ENOENT; | 205 | err = -ENOENT; |
@@ -225,6 +227,7 @@ static int test_by_dev(struct path *path, void *p) | |||
225 | static int test_by_type(struct path *path, void *p) | 227 | static int test_by_type(struct path *path, void *p) |
226 | { | 228 | { |
227 | struct autofs_info *ino = autofs4_dentry_ino(path->dentry); | 229 | struct autofs_info *ino = autofs4_dentry_ino(path->dentry); |
230 | |||
228 | return ino && ino->sbi->type & *(unsigned *)p; | 231 | return ino && ino->sbi->type & *(unsigned *)p; |
229 | } | 232 | } |
230 | 233 | ||
@@ -370,7 +373,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp, | |||
370 | new_pid = get_task_pid(current, PIDTYPE_PGID); | 373 | new_pid = get_task_pid(current, PIDTYPE_PGID); |
371 | 374 | ||
372 | if (ns_of_pid(new_pid) != ns_of_pid(sbi->oz_pgrp)) { | 375 | if (ns_of_pid(new_pid) != ns_of_pid(sbi->oz_pgrp)) { |
373 | AUTOFS_WARN("Not allowed to change PID namespace"); | 376 | pr_warn("not allowed to change PID namespace\n"); |
374 | err = -EINVAL; | 377 | err = -EINVAL; |
375 | goto out; | 378 | goto out; |
376 | } | 379 | } |
@@ -456,8 +459,10 @@ static int autofs_dev_ioctl_requester(struct file *fp, | |||
456 | err = 0; | 459 | err = 0; |
457 | autofs4_expire_wait(path.dentry, 0); | 460 | autofs4_expire_wait(path.dentry, 0); |
458 | spin_lock(&sbi->fs_lock); | 461 | spin_lock(&sbi->fs_lock); |
459 | param->requester.uid = from_kuid_munged(current_user_ns(), ino->uid); | 462 | param->requester.uid = |
460 | param->requester.gid = from_kgid_munged(current_user_ns(), ino->gid); | 463 | from_kuid_munged(current_user_ns(), ino->uid); |
464 | param->requester.gid = | ||
465 | from_kgid_munged(current_user_ns(), ino->gid); | ||
461 | spin_unlock(&sbi->fs_lock); | 466 | spin_unlock(&sbi->fs_lock); |
462 | } | 467 | } |
463 | path_put(&path); | 468 | path_put(&path); |
@@ -619,7 +624,8 @@ static ioctl_fn lookup_dev_ioctl(unsigned int cmd) | |||
619 | } | 624 | } |
620 | 625 | ||
621 | /* ioctl dispatcher */ | 626 | /* ioctl dispatcher */ |
622 | static int _autofs_dev_ioctl(unsigned int command, struct autofs_dev_ioctl __user *user) | 627 | static int _autofs_dev_ioctl(unsigned int command, |
628 | struct autofs_dev_ioctl __user *user) | ||
623 | { | 629 | { |
624 | struct autofs_dev_ioctl *param; | 630 | struct autofs_dev_ioctl *param; |
625 | struct file *fp; | 631 | struct file *fp; |
@@ -655,7 +661,7 @@ static int _autofs_dev_ioctl(unsigned int command, struct autofs_dev_ioctl __use | |||
655 | 661 | ||
656 | fn = lookup_dev_ioctl(cmd); | 662 | fn = lookup_dev_ioctl(cmd); |
657 | if (!fn) { | 663 | if (!fn) { |
658 | AUTOFS_WARN("unknown command 0x%08x", command); | 664 | pr_warn("unknown command 0x%08x\n", command); |
659 | return -ENOTTY; | 665 | return -ENOTTY; |
660 | } | 666 | } |
661 | 667 | ||
@@ -711,6 +717,7 @@ out: | |||
711 | static long autofs_dev_ioctl(struct file *file, uint command, ulong u) | 717 | static long autofs_dev_ioctl(struct file *file, uint command, ulong u) |
712 | { | 718 | { |
713 | int err; | 719 | int err; |
720 | |||
714 | err = _autofs_dev_ioctl(command, (struct autofs_dev_ioctl __user *) u); | 721 | err = _autofs_dev_ioctl(command, (struct autofs_dev_ioctl __user *) u); |
715 | return (long) err; | 722 | return (long) err; |
716 | } | 723 | } |
@@ -733,8 +740,8 @@ static const struct file_operations _dev_ioctl_fops = { | |||
733 | 740 | ||
734 | static struct miscdevice _autofs_dev_ioctl_misc = { | 741 | static struct miscdevice _autofs_dev_ioctl_misc = { |
735 | .minor = AUTOFS_MINOR, | 742 | .minor = AUTOFS_MINOR, |
736 | .name = AUTOFS_DEVICE_NAME, | 743 | .name = AUTOFS_DEVICE_NAME, |
737 | .fops = &_dev_ioctl_fops | 744 | .fops = &_dev_ioctl_fops |
738 | }; | 745 | }; |
739 | 746 | ||
740 | MODULE_ALIAS_MISCDEV(AUTOFS_MINOR); | 747 | MODULE_ALIAS_MISCDEV(AUTOFS_MINOR); |
@@ -747,7 +754,7 @@ int __init autofs_dev_ioctl_init(void) | |||
747 | 754 | ||
748 | r = misc_register(&_autofs_dev_ioctl_misc); | 755 | r = misc_register(&_autofs_dev_ioctl_misc); |
749 | if (r) { | 756 | if (r) { |
750 | AUTOFS_ERROR("misc_register failed for control device"); | 757 | pr_err("misc_register failed for control device\n"); |
751 | return r; | 758 | return r; |
752 | } | 759 | } |
753 | 760 | ||
@@ -757,6 +764,4 @@ int __init autofs_dev_ioctl_init(void) | |||
757 | void autofs_dev_ioctl_exit(void) | 764 | void autofs_dev_ioctl_exit(void) |
758 | { | 765 | { |
759 | misc_deregister(&_autofs_dev_ioctl_misc); | 766 | misc_deregister(&_autofs_dev_ioctl_misc); |
760 | return; | ||
761 | } | 767 | } |
762 | |||
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 1cebc3c52fa5..9510d8d2e9cd 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -1,16 +1,12 @@ | |||
1 | /* -*- c -*- --------------------------------------------------------------- * | 1 | /* |
2 | * | 2 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved |
3 | * linux/fs/autofs/expire.c | 3 | * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> |
4 | * | 4 | * Copyright 2001-2006 Ian Kent <raven@themaw.net> |
5 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved | ||
6 | * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> | ||
7 | * Copyright 2001-2006 Ian Kent <raven@themaw.net> | ||
8 | * | 5 | * |
9 | * This file is part of the Linux kernel and is made available under | 6 | * This file is part of the Linux kernel and is made available under |
10 | * the terms of the GNU General Public License, version 2, or at your | 7 | * the terms of the GNU General Public License, version 2, or at your |
11 | * option, any later version, incorporated herein by reference. | 8 | * option, any later version, incorporated herein by reference. |
12 | * | 9 | */ |
13 | * ------------------------------------------------------------------------- */ | ||
14 | 10 | ||
15 | #include "autofs_i.h" | 11 | #include "autofs_i.h" |
16 | 12 | ||
@@ -18,7 +14,7 @@ static unsigned long now; | |||
18 | 14 | ||
19 | /* Check if a dentry can be expired */ | 15 | /* Check if a dentry can be expired */ |
20 | static inline int autofs4_can_expire(struct dentry *dentry, | 16 | static inline int autofs4_can_expire(struct dentry *dentry, |
21 | unsigned long timeout, int do_now) | 17 | unsigned long timeout, int do_now) |
22 | { | 18 | { |
23 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 19 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
24 | 20 | ||
@@ -41,7 +37,7 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) | |||
41 | struct path path = {.mnt = mnt, .dentry = dentry}; | 37 | struct path path = {.mnt = mnt, .dentry = dentry}; |
42 | int status = 1; | 38 | int status = 1; |
43 | 39 | ||
44 | DPRINTK("dentry %p %pd", dentry, dentry); | 40 | pr_debug("dentry %p %pd\n", dentry, dentry); |
45 | 41 | ||
46 | path_get(&path); | 42 | path_get(&path); |
47 | 43 | ||
@@ -58,14 +54,16 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry) | |||
58 | 54 | ||
59 | /* Update the expiry counter if fs is busy */ | 55 | /* Update the expiry counter if fs is busy */ |
60 | if (!may_umount_tree(path.mnt)) { | 56 | if (!may_umount_tree(path.mnt)) { |
61 | struct autofs_info *ino = autofs4_dentry_ino(top); | 57 | struct autofs_info *ino; |
58 | |||
59 | ino = autofs4_dentry_ino(top); | ||
62 | ino->last_used = jiffies; | 60 | ino->last_used = jiffies; |
63 | goto done; | 61 | goto done; |
64 | } | 62 | } |
65 | 63 | ||
66 | status = 0; | 64 | status = 0; |
67 | done: | 65 | done: |
68 | DPRINTK("returning = %d", status); | 66 | pr_debug("returning = %d\n", status); |
69 | path_put(&path); | 67 | path_put(&path); |
70 | return status; | 68 | return status; |
71 | } | 69 | } |
@@ -74,7 +72,7 @@ done: | |||
74 | * Calculate and dget next entry in the subdirs list under root. | 72 | * Calculate and dget next entry in the subdirs list under root. |
75 | */ | 73 | */ |
76 | static struct dentry *get_next_positive_subdir(struct dentry *prev, | 74 | static struct dentry *get_next_positive_subdir(struct dentry *prev, |
77 | struct dentry *root) | 75 | struct dentry *root) |
78 | { | 76 | { |
79 | struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); | 77 | struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); |
80 | struct list_head *next; | 78 | struct list_head *next; |
@@ -121,7 +119,7 @@ cont: | |||
121 | * Calculate and dget next entry in top down tree traversal. | 119 | * Calculate and dget next entry in top down tree traversal. |
122 | */ | 120 | */ |
123 | static struct dentry *get_next_positive_dentry(struct dentry *prev, | 121 | static struct dentry *get_next_positive_dentry(struct dentry *prev, |
124 | struct dentry *root) | 122 | struct dentry *root) |
125 | { | 123 | { |
126 | struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); | 124 | struct autofs_sb_info *sbi = autofs4_sbi(root->d_sb); |
127 | struct list_head *next; | 125 | struct list_head *next; |
@@ -187,15 +185,17 @@ again: | |||
187 | * autofs submounts. | 185 | * autofs submounts. |
188 | */ | 186 | */ |
189 | static int autofs4_direct_busy(struct vfsmount *mnt, | 187 | static int autofs4_direct_busy(struct vfsmount *mnt, |
190 | struct dentry *top, | 188 | struct dentry *top, |
191 | unsigned long timeout, | 189 | unsigned long timeout, |
192 | int do_now) | 190 | int do_now) |
193 | { | 191 | { |
194 | DPRINTK("top %p %pd", top, top); | 192 | pr_debug("top %p %pd\n", top, top); |
195 | 193 | ||
196 | /* If it's busy update the expiry counters */ | 194 | /* If it's busy update the expiry counters */ |
197 | if (!may_umount_tree(mnt)) { | 195 | if (!may_umount_tree(mnt)) { |
198 | struct autofs_info *ino = autofs4_dentry_ino(top); | 196 | struct autofs_info *ino; |
197 | |||
198 | ino = autofs4_dentry_ino(top); | ||
199 | if (ino) | 199 | if (ino) |
200 | ino->last_used = jiffies; | 200 | ino->last_used = jiffies; |
201 | return 1; | 201 | return 1; |
@@ -208,7 +208,8 @@ static int autofs4_direct_busy(struct vfsmount *mnt, | |||
208 | return 0; | 208 | return 0; |
209 | } | 209 | } |
210 | 210 | ||
211 | /* Check a directory tree of mount points for busyness | 211 | /* |
212 | * Check a directory tree of mount points for busyness | ||
212 | * The tree is not busy iff no mountpoints are busy | 213 | * The tree is not busy iff no mountpoints are busy |
213 | */ | 214 | */ |
214 | static int autofs4_tree_busy(struct vfsmount *mnt, | 215 | static int autofs4_tree_busy(struct vfsmount *mnt, |
@@ -219,7 +220,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt, | |||
219 | struct autofs_info *top_ino = autofs4_dentry_ino(top); | 220 | struct autofs_info *top_ino = autofs4_dentry_ino(top); |
220 | struct dentry *p; | 221 | struct dentry *p; |
221 | 222 | ||
222 | DPRINTK("top %p %pd", top, top); | 223 | pr_debug("top %p %pd\n", top, top); |
223 | 224 | ||
224 | /* Negative dentry - give up */ | 225 | /* Negative dentry - give up */ |
225 | if (!simple_positive(top)) | 226 | if (!simple_positive(top)) |
@@ -227,7 +228,7 @@ static int autofs4_tree_busy(struct vfsmount *mnt, | |||
227 | 228 | ||
228 | p = NULL; | 229 | p = NULL; |
229 | while ((p = get_next_positive_dentry(p, top))) { | 230 | while ((p = get_next_positive_dentry(p, top))) { |
230 | DPRINTK("dentry %p %pd", p, p); | 231 | pr_debug("dentry %p %pd\n", p, p); |
231 | 232 | ||
232 | /* | 233 | /* |
233 | * Is someone visiting anywhere in the subtree ? | 234 | * Is someone visiting anywhere in the subtree ? |
@@ -273,11 +274,11 @@ static struct dentry *autofs4_check_leaves(struct vfsmount *mnt, | |||
273 | { | 274 | { |
274 | struct dentry *p; | 275 | struct dentry *p; |
275 | 276 | ||
276 | DPRINTK("parent %p %pd", parent, parent); | 277 | pr_debug("parent %p %pd\n", parent, parent); |
277 | 278 | ||
278 | p = NULL; | 279 | p = NULL; |
279 | while ((p = get_next_positive_dentry(p, parent))) { | 280 | while ((p = get_next_positive_dentry(p, parent))) { |
280 | DPRINTK("dentry %p %pd", p, p); | 281 | pr_debug("dentry %p %pd\n", p, p); |
281 | 282 | ||
282 | if (d_mountpoint(p)) { | 283 | if (d_mountpoint(p)) { |
283 | /* Can we umount this guy */ | 284 | /* Can we umount this guy */ |
@@ -362,7 +363,7 @@ static struct dentry *should_expire(struct dentry *dentry, | |||
362 | * offset (autofs-5.0+). | 363 | * offset (autofs-5.0+). |
363 | */ | 364 | */ |
364 | if (d_mountpoint(dentry)) { | 365 | if (d_mountpoint(dentry)) { |
365 | DPRINTK("checking mountpoint %p %pd", dentry, dentry); | 366 | pr_debug("checking mountpoint %p %pd\n", dentry, dentry); |
366 | 367 | ||
367 | /* Can we umount this guy */ | 368 | /* Can we umount this guy */ |
368 | if (autofs4_mount_busy(mnt, dentry)) | 369 | if (autofs4_mount_busy(mnt, dentry)) |
@@ -375,7 +376,7 @@ static struct dentry *should_expire(struct dentry *dentry, | |||
375 | } | 376 | } |
376 | 377 | ||
377 | if (d_really_is_positive(dentry) && d_is_symlink(dentry)) { | 378 | if (d_really_is_positive(dentry) && d_is_symlink(dentry)) { |
378 | DPRINTK("checking symlink %p %pd", dentry, dentry); | 379 | pr_debug("checking symlink %p %pd\n", dentry, dentry); |
379 | /* | 380 | /* |
380 | * A symlink can't be "busy" in the usual sense so | 381 | * A symlink can't be "busy" in the usual sense so |
381 | * just check last used for expire timeout. | 382 | * just check last used for expire timeout. |
@@ -404,6 +405,7 @@ static struct dentry *should_expire(struct dentry *dentry, | |||
404 | } else { | 405 | } else { |
405 | /* Path walk currently on this dentry? */ | 406 | /* Path walk currently on this dentry? */ |
406 | struct dentry *expired; | 407 | struct dentry *expired; |
408 | |||
407 | ino_count = atomic_read(&ino->count) + 1; | 409 | ino_count = atomic_read(&ino->count) + 1; |
408 | if (d_count(dentry) > ino_count) | 410 | if (d_count(dentry) > ino_count) |
409 | return NULL; | 411 | return NULL; |
@@ -471,7 +473,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
471 | return NULL; | 473 | return NULL; |
472 | 474 | ||
473 | found: | 475 | found: |
474 | DPRINTK("returning %p %pd", expired, expired); | 476 | pr_debug("returning %p %pd\n", expired, expired); |
475 | ino->flags |= AUTOFS_INF_EXPIRING; | 477 | ino->flags |= AUTOFS_INF_EXPIRING; |
476 | smp_mb(); | 478 | smp_mb(); |
477 | ino->flags &= ~AUTOFS_INF_NO_RCU; | 479 | ino->flags &= ~AUTOFS_INF_NO_RCU; |
@@ -503,12 +505,12 @@ int autofs4_expire_wait(struct dentry *dentry, int rcu_walk) | |||
503 | if (ino->flags & AUTOFS_INF_EXPIRING) { | 505 | if (ino->flags & AUTOFS_INF_EXPIRING) { |
504 | spin_unlock(&sbi->fs_lock); | 506 | spin_unlock(&sbi->fs_lock); |
505 | 507 | ||
506 | DPRINTK("waiting for expire %p name=%pd", dentry, dentry); | 508 | pr_debug("waiting for expire %p name=%pd\n", dentry, dentry); |
507 | 509 | ||
508 | status = autofs4_wait(sbi, dentry, NFY_NONE); | 510 | status = autofs4_wait(sbi, dentry, NFY_NONE); |
509 | wait_for_completion(&ino->expire_complete); | 511 | wait_for_completion(&ino->expire_complete); |
510 | 512 | ||
511 | DPRINTK("expire done status=%d", status); | 513 | pr_debug("expire done status=%d\n", status); |
512 | 514 | ||
513 | if (d_unhashed(dentry)) | 515 | if (d_unhashed(dentry)) |
514 | return -EAGAIN; | 516 | return -EAGAIN; |
@@ -522,21 +524,22 @@ int autofs4_expire_wait(struct dentry *dentry, int rcu_walk) | |||
522 | 524 | ||
523 | /* Perform an expiry operation */ | 525 | /* Perform an expiry operation */ |
524 | int autofs4_expire_run(struct super_block *sb, | 526 | int autofs4_expire_run(struct super_block *sb, |
525 | struct vfsmount *mnt, | 527 | struct vfsmount *mnt, |
526 | struct autofs_sb_info *sbi, | 528 | struct autofs_sb_info *sbi, |
527 | struct autofs_packet_expire __user *pkt_p) | 529 | struct autofs_packet_expire __user *pkt_p) |
528 | { | 530 | { |
529 | struct autofs_packet_expire pkt; | 531 | struct autofs_packet_expire pkt; |
530 | struct autofs_info *ino; | 532 | struct autofs_info *ino; |
531 | struct dentry *dentry; | 533 | struct dentry *dentry; |
532 | int ret = 0; | 534 | int ret = 0; |
533 | 535 | ||
534 | memset(&pkt,0,sizeof pkt); | 536 | memset(&pkt, 0, sizeof(pkt)); |
535 | 537 | ||
536 | pkt.hdr.proto_version = sbi->version; | 538 | pkt.hdr.proto_version = sbi->version; |
537 | pkt.hdr.type = autofs_ptype_expire; | 539 | pkt.hdr.type = autofs_ptype_expire; |
538 | 540 | ||
539 | if ((dentry = autofs4_expire_indirect(sb, mnt, sbi, 0)) == NULL) | 541 | dentry = autofs4_expire_indirect(sb, mnt, sbi, 0); |
542 | if (!dentry) | ||
540 | return -EAGAIN; | 543 | return -EAGAIN; |
541 | 544 | ||
542 | pkt.len = dentry->d_name.len; | 545 | pkt.len = dentry->d_name.len; |
@@ -544,7 +547,7 @@ int autofs4_expire_run(struct super_block *sb, | |||
544 | pkt.name[pkt.len] = '\0'; | 547 | pkt.name[pkt.len] = '\0'; |
545 | dput(dentry); | 548 | dput(dentry); |
546 | 549 | ||
547 | if ( copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire)) ) | 550 | if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire))) |
548 | ret = -EFAULT; | 551 | ret = -EFAULT; |
549 | 552 | ||
550 | spin_lock(&sbi->fs_lock); | 553 | spin_lock(&sbi->fs_lock); |
@@ -573,7 +576,8 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, | |||
573 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 576 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
574 | 577 | ||
575 | /* This is synchronous because it makes the daemon a | 578 | /* This is synchronous because it makes the daemon a |
576 | little easier */ | 579 | * little easier |
580 | */ | ||
577 | ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); | 581 | ret = autofs4_wait(sbi, dentry, NFY_EXPIRE); |
578 | 582 | ||
579 | spin_lock(&sbi->fs_lock); | 583 | spin_lock(&sbi->fs_lock); |
@@ -588,8 +592,10 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, | |||
588 | return ret; | 592 | return ret; |
589 | } | 593 | } |
590 | 594 | ||
591 | /* Call repeatedly until it returns -EAGAIN, meaning there's nothing | 595 | /* |
592 | more to be done */ | 596 | * Call repeatedly until it returns -EAGAIN, meaning there's nothing |
597 | * more to be done. | ||
598 | */ | ||
593 | int autofs4_expire_multi(struct super_block *sb, struct vfsmount *mnt, | 599 | int autofs4_expire_multi(struct super_block *sb, struct vfsmount *mnt, |
594 | struct autofs_sb_info *sbi, int __user *arg) | 600 | struct autofs_sb_info *sbi, int __user *arg) |
595 | { | 601 | { |
diff --git a/fs/autofs4/init.c b/fs/autofs4/init.c index b3db517e89ec..8cf0e63389ae 100644 --- a/fs/autofs4/init.c +++ b/fs/autofs4/init.c | |||
@@ -1,14 +1,10 @@ | |||
1 | /* -*- c -*- --------------------------------------------------------------- * | 1 | /* |
2 | * | 2 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved |
3 | * linux/fs/autofs/init.c | ||
4 | * | ||
5 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved | ||
6 | * | 3 | * |
7 | * This file is part of the Linux kernel and is made available under | 4 | * This file is part of the Linux kernel and is made available under |
8 | * the terms of the GNU General Public License, version 2, or at your | 5 | * the terms of the GNU General Public License, version 2, or at your |
9 | * option, any later version, incorporated herein by reference. | 6 | * option, any later version, incorporated herein by reference. |
10 | * | 7 | */ |
11 | * ------------------------------------------------------------------------- */ | ||
12 | 8 | ||
13 | #include <linux/module.h> | 9 | #include <linux/module.h> |
14 | #include <linux/init.h> | 10 | #include <linux/init.h> |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index a3ae0b2aeb5a..61b21051bd5a 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -1,15 +1,11 @@ | |||
1 | /* -*- c -*- --------------------------------------------------------------- * | 1 | /* |
2 | * | 2 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved |
3 | * linux/fs/autofs/inode.c | 3 | * Copyright 2005-2006 Ian Kent <raven@themaw.net> |
4 | * | ||
5 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved | ||
6 | * Copyright 2005-2006 Ian Kent <raven@themaw.net> | ||
7 | * | 4 | * |
8 | * This file is part of the Linux kernel and is made available under | 5 | * This file is part of the Linux kernel and is made available under |
9 | * the terms of the GNU General Public License, version 2, or at your | 6 | * the terms of the GNU General Public License, version 2, or at your |
10 | * option, any later version, incorporated herein by reference. | 7 | * option, any later version, incorporated herein by reference. |
11 | * | 8 | */ |
12 | * ------------------------------------------------------------------------- */ | ||
13 | 9 | ||
14 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
15 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
@@ -24,7 +20,9 @@ | |||
24 | 20 | ||
25 | struct autofs_info *autofs4_new_ino(struct autofs_sb_info *sbi) | 21 | struct autofs_info *autofs4_new_ino(struct autofs_sb_info *sbi) |
26 | { | 22 | { |
27 | struct autofs_info *ino = kzalloc(sizeof(*ino), GFP_KERNEL); | 23 | struct autofs_info *ino; |
24 | |||
25 | ino = kzalloc(sizeof(*ino), GFP_KERNEL); | ||
28 | if (ino) { | 26 | if (ino) { |
29 | INIT_LIST_HEAD(&ino->active); | 27 | INIT_LIST_HEAD(&ino->active); |
30 | INIT_LIST_HEAD(&ino->expiring); | 28 | INIT_LIST_HEAD(&ino->expiring); |
@@ -62,7 +60,7 @@ void autofs4_kill_sb(struct super_block *sb) | |||
62 | put_pid(sbi->oz_pgrp); | 60 | put_pid(sbi->oz_pgrp); |
63 | } | 61 | } |
64 | 62 | ||
65 | DPRINTK("shutting down"); | 63 | pr_debug("shutting down\n"); |
66 | kill_litter_super(sb); | 64 | kill_litter_super(sb); |
67 | if (sbi) | 65 | if (sbi) |
68 | kfree_rcu(sbi, rcu); | 66 | kfree_rcu(sbi, rcu); |
@@ -94,7 +92,12 @@ static int autofs4_show_options(struct seq_file *m, struct dentry *root) | |||
94 | seq_printf(m, ",direct"); | 92 | seq_printf(m, ",direct"); |
95 | else | 93 | else |
96 | seq_printf(m, ",indirect"); | 94 | seq_printf(m, ",indirect"); |
97 | 95 | #ifdef CONFIG_CHECKPOINT_RESTORE | |
96 | if (sbi->pipe) | ||
97 | seq_printf(m, ",pipe_ino=%ld", sbi->pipe->f_inode->i_ino); | ||
98 | else | ||
99 | seq_printf(m, ",pipe_ino=-1"); | ||
100 | #endif | ||
98 | return 0; | 101 | return 0; |
99 | } | 102 | } |
100 | 103 | ||
@@ -147,6 +150,7 @@ static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid, | |||
147 | 150 | ||
148 | while ((p = strsep(&options, ",")) != NULL) { | 151 | while ((p = strsep(&options, ",")) != NULL) { |
149 | int token; | 152 | int token; |
153 | |||
150 | if (!*p) | 154 | if (!*p) |
151 | continue; | 155 | continue; |
152 | 156 | ||
@@ -204,9 +208,9 @@ static int parse_options(char *options, int *pipefd, kuid_t *uid, kgid_t *gid, | |||
204 | 208 | ||
205 | int autofs4_fill_super(struct super_block *s, void *data, int silent) | 209 | int autofs4_fill_super(struct super_block *s, void *data, int silent) |
206 | { | 210 | { |
207 | struct inode * root_inode; | 211 | struct inode *root_inode; |
208 | struct dentry * root; | 212 | struct dentry *root; |
209 | struct file * pipe; | 213 | struct file *pipe; |
210 | int pipefd; | 214 | int pipefd; |
211 | struct autofs_sb_info *sbi; | 215 | struct autofs_sb_info *sbi; |
212 | struct autofs_info *ino; | 216 | struct autofs_info *ino; |
@@ -217,7 +221,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
217 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 221 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
218 | if (!sbi) | 222 | if (!sbi) |
219 | return -ENOMEM; | 223 | return -ENOMEM; |
220 | DPRINTK("starting up, sbi = %p",sbi); | 224 | pr_debug("starting up, sbi = %p\n", sbi); |
221 | 225 | ||
222 | s->s_fs_info = sbi; | 226 | s->s_fs_info = sbi; |
223 | sbi->magic = AUTOFS_SBI_MAGIC; | 227 | sbi->magic = AUTOFS_SBI_MAGIC; |
@@ -266,14 +270,14 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
266 | if (parse_options(data, &pipefd, &root_inode->i_uid, &root_inode->i_gid, | 270 | if (parse_options(data, &pipefd, &root_inode->i_uid, &root_inode->i_gid, |
267 | &pgrp, &pgrp_set, &sbi->type, &sbi->min_proto, | 271 | &pgrp, &pgrp_set, &sbi->type, &sbi->min_proto, |
268 | &sbi->max_proto)) { | 272 | &sbi->max_proto)) { |
269 | printk("autofs: called with bogus options\n"); | 273 | pr_err("called with bogus options\n"); |
270 | goto fail_dput; | 274 | goto fail_dput; |
271 | } | 275 | } |
272 | 276 | ||
273 | if (pgrp_set) { | 277 | if (pgrp_set) { |
274 | sbi->oz_pgrp = find_get_pid(pgrp); | 278 | sbi->oz_pgrp = find_get_pid(pgrp); |
275 | if (!sbi->oz_pgrp) { | 279 | if (!sbi->oz_pgrp) { |
276 | pr_warn("autofs: could not find process group %d\n", | 280 | pr_err("could not find process group %d\n", |
277 | pgrp); | 281 | pgrp); |
278 | goto fail_dput; | 282 | goto fail_dput; |
279 | } | 283 | } |
@@ -290,10 +294,10 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
290 | /* Couldn't this be tested earlier? */ | 294 | /* Couldn't this be tested earlier? */ |
291 | if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION || | 295 | if (sbi->max_proto < AUTOFS_MIN_PROTO_VERSION || |
292 | sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) { | 296 | sbi->min_proto > AUTOFS_MAX_PROTO_VERSION) { |
293 | printk("autofs: kernel does not match daemon version " | 297 | pr_err("kernel does not match daemon version " |
294 | "daemon (%d, %d) kernel (%d, %d)\n", | 298 | "daemon (%d, %d) kernel (%d, %d)\n", |
295 | sbi->min_proto, sbi->max_proto, | 299 | sbi->min_proto, sbi->max_proto, |
296 | AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION); | 300 | AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION); |
297 | goto fail_dput; | 301 | goto fail_dput; |
298 | } | 302 | } |
299 | 303 | ||
@@ -304,11 +308,11 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
304 | sbi->version = sbi->max_proto; | 308 | sbi->version = sbi->max_proto; |
305 | sbi->sub_version = AUTOFS_PROTO_SUBVERSION; | 309 | sbi->sub_version = AUTOFS_PROTO_SUBVERSION; |
306 | 310 | ||
307 | DPRINTK("pipe fd = %d, pgrp = %u", pipefd, pid_nr(sbi->oz_pgrp)); | 311 | pr_debug("pipe fd = %d, pgrp = %u\n", pipefd, pid_nr(sbi->oz_pgrp)); |
308 | pipe = fget(pipefd); | 312 | pipe = fget(pipefd); |
309 | 313 | ||
310 | if (!pipe) { | 314 | if (!pipe) { |
311 | printk("autofs: could not open pipe file descriptor\n"); | 315 | pr_err("could not open pipe file descriptor\n"); |
312 | goto fail_dput; | 316 | goto fail_dput; |
313 | } | 317 | } |
314 | ret = autofs_prepare_pipe(pipe); | 318 | ret = autofs_prepare_pipe(pipe); |
@@ -323,12 +327,12 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent) | |||
323 | */ | 327 | */ |
324 | s->s_root = root; | 328 | s->s_root = root; |
325 | return 0; | 329 | return 0; |
326 | 330 | ||
327 | /* | 331 | /* |
328 | * Failure ... clean up. | 332 | * Failure ... clean up. |
329 | */ | 333 | */ |
330 | fail_fput: | 334 | fail_fput: |
331 | printk("autofs: pipe file descriptor does not contain proper ops\n"); | 335 | pr_err("pipe file descriptor does not contain proper ops\n"); |
332 | fput(pipe); | 336 | fput(pipe); |
333 | /* fall through */ | 337 | /* fall through */ |
334 | fail_dput: | 338 | fail_dput: |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index c6d7d3dbd52a..9328b5861c7a 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -1,16 +1,12 @@ | |||
1 | /* -*- c -*- --------------------------------------------------------------- * | 1 | /* |
2 | * | 2 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved |
3 | * linux/fs/autofs/root.c | 3 | * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> |
4 | * | 4 | * Copyright 2001-2006 Ian Kent <raven@themaw.net> |
5 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved | ||
6 | * Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org> | ||
7 | * Copyright 2001-2006 Ian Kent <raven@themaw.net> | ||
8 | * | 5 | * |
9 | * This file is part of the Linux kernel and is made available under | 6 | * This file is part of the Linux kernel and is made available under |
10 | * the terms of the GNU General Public License, version 2, or at your | 7 | * the terms of the GNU General Public License, version 2, or at your |
11 | * option, any later version, incorporated herein by reference. | 8 | * option, any later version, incorporated herein by reference. |
12 | * | 9 | */ |
13 | * ------------------------------------------------------------------------- */ | ||
14 | 10 | ||
15 | #include <linux/capability.h> | 11 | #include <linux/capability.h> |
16 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
@@ -23,16 +19,18 @@ | |||
23 | 19 | ||
24 | #include "autofs_i.h" | 20 | #include "autofs_i.h" |
25 | 21 | ||
26 | static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); | 22 | static int autofs4_dir_symlink(struct inode *, struct dentry *, const char *); |
27 | static int autofs4_dir_unlink(struct inode *,struct dentry *); | 23 | static int autofs4_dir_unlink(struct inode *, struct dentry *); |
28 | static int autofs4_dir_rmdir(struct inode *,struct dentry *); | 24 | static int autofs4_dir_rmdir(struct inode *, struct dentry *); |
29 | static int autofs4_dir_mkdir(struct inode *,struct dentry *,umode_t); | 25 | static int autofs4_dir_mkdir(struct inode *, struct dentry *, umode_t); |
30 | static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long); | 26 | static long autofs4_root_ioctl(struct file *, unsigned int, unsigned long); |
31 | #ifdef CONFIG_COMPAT | 27 | #ifdef CONFIG_COMPAT |
32 | static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long); | 28 | static long autofs4_root_compat_ioctl(struct file *, |
29 | unsigned int, unsigned long); | ||
33 | #endif | 30 | #endif |
34 | static int autofs4_dir_open(struct inode *inode, struct file *file); | 31 | static int autofs4_dir_open(struct inode *inode, struct file *file); |
35 | static struct dentry *autofs4_lookup(struct inode *,struct dentry *, unsigned int); | 32 | static struct dentry *autofs4_lookup(struct inode *, |
33 | struct dentry *, unsigned int); | ||
36 | static struct vfsmount *autofs4_d_automount(struct path *); | 34 | static struct vfsmount *autofs4_d_automount(struct path *); |
37 | static int autofs4_d_manage(struct dentry *, bool); | 35 | static int autofs4_d_manage(struct dentry *, bool); |
38 | static void autofs4_dentry_release(struct dentry *); | 36 | static void autofs4_dentry_release(struct dentry *); |
@@ -74,7 +72,9 @@ const struct dentry_operations autofs4_dentry_operations = { | |||
74 | static void autofs4_add_active(struct dentry *dentry) | 72 | static void autofs4_add_active(struct dentry *dentry) |
75 | { | 73 | { |
76 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 74 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
77 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 75 | struct autofs_info *ino; |
76 | |||
77 | ino = autofs4_dentry_ino(dentry); | ||
78 | if (ino) { | 78 | if (ino) { |
79 | spin_lock(&sbi->lookup_lock); | 79 | spin_lock(&sbi->lookup_lock); |
80 | if (!ino->active_count) { | 80 | if (!ino->active_count) { |
@@ -84,13 +84,14 @@ static void autofs4_add_active(struct dentry *dentry) | |||
84 | ino->active_count++; | 84 | ino->active_count++; |
85 | spin_unlock(&sbi->lookup_lock); | 85 | spin_unlock(&sbi->lookup_lock); |
86 | } | 86 | } |
87 | return; | ||
88 | } | 87 | } |
89 | 88 | ||
90 | static void autofs4_del_active(struct dentry *dentry) | 89 | static void autofs4_del_active(struct dentry *dentry) |
91 | { | 90 | { |
92 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 91 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
93 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 92 | struct autofs_info *ino; |
93 | |||
94 | ino = autofs4_dentry_ino(dentry); | ||
94 | if (ino) { | 95 | if (ino) { |
95 | spin_lock(&sbi->lookup_lock); | 96 | spin_lock(&sbi->lookup_lock); |
96 | ino->active_count--; | 97 | ino->active_count--; |
@@ -100,7 +101,6 @@ static void autofs4_del_active(struct dentry *dentry) | |||
100 | } | 101 | } |
101 | spin_unlock(&sbi->lookup_lock); | 102 | spin_unlock(&sbi->lookup_lock); |
102 | } | 103 | } |
103 | return; | ||
104 | } | 104 | } |
105 | 105 | ||
106 | static int autofs4_dir_open(struct inode *inode, struct file *file) | 106 | static int autofs4_dir_open(struct inode *inode, struct file *file) |
@@ -108,7 +108,7 @@ static int autofs4_dir_open(struct inode *inode, struct file *file) | |||
108 | struct dentry *dentry = file->f_path.dentry; | 108 | struct dentry *dentry = file->f_path.dentry; |
109 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 109 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
110 | 110 | ||
111 | DPRINTK("file=%p dentry=%p %pd", file, dentry, dentry); | 111 | pr_debug("file=%p dentry=%p %pd\n", file, dentry, dentry); |
112 | 112 | ||
113 | if (autofs4_oz_mode(sbi)) | 113 | if (autofs4_oz_mode(sbi)) |
114 | goto out; | 114 | goto out; |
@@ -138,7 +138,7 @@ static void autofs4_dentry_release(struct dentry *de) | |||
138 | struct autofs_info *ino = autofs4_dentry_ino(de); | 138 | struct autofs_info *ino = autofs4_dentry_ino(de); |
139 | struct autofs_sb_info *sbi = autofs4_sbi(de->d_sb); | 139 | struct autofs_sb_info *sbi = autofs4_sbi(de->d_sb); |
140 | 140 | ||
141 | DPRINTK("releasing %p", de); | 141 | pr_debug("releasing %p\n", de); |
142 | 142 | ||
143 | if (!ino) | 143 | if (!ino) |
144 | return; | 144 | return; |
@@ -278,9 +278,9 @@ static int autofs4_mount_wait(struct dentry *dentry, bool rcu_walk) | |||
278 | if (ino->flags & AUTOFS_INF_PENDING) { | 278 | if (ino->flags & AUTOFS_INF_PENDING) { |
279 | if (rcu_walk) | 279 | if (rcu_walk) |
280 | return -ECHILD; | 280 | return -ECHILD; |
281 | DPRINTK("waiting for mount name=%pd", dentry); | 281 | pr_debug("waiting for mount name=%pd\n", dentry); |
282 | status = autofs4_wait(sbi, dentry, NFY_MOUNT); | 282 | status = autofs4_wait(sbi, dentry, NFY_MOUNT); |
283 | DPRINTK("mount wait done status=%d", status); | 283 | pr_debug("mount wait done status=%d\n", status); |
284 | } | 284 | } |
285 | ino->last_used = jiffies; | 285 | ino->last_used = jiffies; |
286 | return status; | 286 | return status; |
@@ -320,7 +320,9 @@ static struct dentry *autofs4_mountpoint_changed(struct path *path) | |||
320 | if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) { | 320 | if (autofs_type_indirect(sbi->type) && d_unhashed(dentry)) { |
321 | struct dentry *parent = dentry->d_parent; | 321 | struct dentry *parent = dentry->d_parent; |
322 | struct autofs_info *ino; | 322 | struct autofs_info *ino; |
323 | struct dentry *new = d_lookup(parent, &dentry->d_name); | 323 | struct dentry *new; |
324 | |||
325 | new = d_lookup(parent, &dentry->d_name); | ||
324 | if (!new) | 326 | if (!new) |
325 | return NULL; | 327 | return NULL; |
326 | ino = autofs4_dentry_ino(new); | 328 | ino = autofs4_dentry_ino(new); |
@@ -338,7 +340,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path) | |||
338 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 340 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
339 | int status; | 341 | int status; |
340 | 342 | ||
341 | DPRINTK("dentry=%p %pd", dentry, dentry); | 343 | pr_debug("dentry=%p %pd\n", dentry, dentry); |
342 | 344 | ||
343 | /* The daemon never triggers a mount. */ | 345 | /* The daemon never triggers a mount. */ |
344 | if (autofs4_oz_mode(sbi)) | 346 | if (autofs4_oz_mode(sbi)) |
@@ -425,7 +427,7 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk) | |||
425 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 427 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
426 | int status; | 428 | int status; |
427 | 429 | ||
428 | DPRINTK("dentry=%p %pd", dentry, dentry); | 430 | pr_debug("dentry=%p %pd\n", dentry, dentry); |
429 | 431 | ||
430 | /* The daemon never waits. */ | 432 | /* The daemon never waits. */ |
431 | if (autofs4_oz_mode(sbi)) { | 433 | if (autofs4_oz_mode(sbi)) { |
@@ -455,6 +457,7 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk) | |||
455 | * a mount-trap. | 457 | * a mount-trap. |
456 | */ | 458 | */ |
457 | struct inode *inode; | 459 | struct inode *inode; |
460 | |||
458 | if (ino->flags & (AUTOFS_INF_EXPIRING | AUTOFS_INF_NO_RCU)) | 461 | if (ino->flags & (AUTOFS_INF_EXPIRING | AUTOFS_INF_NO_RCU)) |
459 | return 0; | 462 | return 0; |
460 | if (d_mountpoint(dentry)) | 463 | if (d_mountpoint(dentry)) |
@@ -494,13 +497,14 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk) | |||
494 | } | 497 | } |
495 | 498 | ||
496 | /* Lookups in the root directory */ | 499 | /* Lookups in the root directory */ |
497 | static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) | 500 | static struct dentry *autofs4_lookup(struct inode *dir, |
501 | struct dentry *dentry, unsigned int flags) | ||
498 | { | 502 | { |
499 | struct autofs_sb_info *sbi; | 503 | struct autofs_sb_info *sbi; |
500 | struct autofs_info *ino; | 504 | struct autofs_info *ino; |
501 | struct dentry *active; | 505 | struct dentry *active; |
502 | 506 | ||
503 | DPRINTK("name = %pd", dentry); | 507 | pr_debug("name = %pd\n", dentry); |
504 | 508 | ||
505 | /* File name too long to exist */ | 509 | /* File name too long to exist */ |
506 | if (dentry->d_name.len > NAME_MAX) | 510 | if (dentry->d_name.len > NAME_MAX) |
@@ -508,14 +512,14 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, u | |||
508 | 512 | ||
509 | sbi = autofs4_sbi(dir->i_sb); | 513 | sbi = autofs4_sbi(dir->i_sb); |
510 | 514 | ||
511 | DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d", | 515 | pr_debug("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d\n", |
512 | current->pid, task_pgrp_nr(current), sbi->catatonic, | 516 | current->pid, task_pgrp_nr(current), sbi->catatonic, |
513 | autofs4_oz_mode(sbi)); | 517 | autofs4_oz_mode(sbi)); |
514 | 518 | ||
515 | active = autofs4_lookup_active(dentry); | 519 | active = autofs4_lookup_active(dentry); |
516 | if (active) { | 520 | if (active) |
517 | return active; | 521 | return active; |
518 | } else { | 522 | else { |
519 | /* | 523 | /* |
520 | * A dentry that is not within the root can never trigger a | 524 | * A dentry that is not within the root can never trigger a |
521 | * mount operation, unless the directory already exists, so we | 525 | * mount operation, unless the directory already exists, so we |
@@ -526,7 +530,8 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, u | |||
526 | return ERR_PTR(-ENOENT); | 530 | return ERR_PTR(-ENOENT); |
527 | 531 | ||
528 | /* Mark entries in the root as mount triggers */ | 532 | /* Mark entries in the root as mount triggers */ |
529 | if (autofs_type_indirect(sbi->type) && IS_ROOT(dentry->d_parent)) | 533 | if (IS_ROOT(dentry->d_parent) && |
534 | autofs_type_indirect(sbi->type)) | ||
530 | __managed_dentry_set_managed(dentry); | 535 | __managed_dentry_set_managed(dentry); |
531 | 536 | ||
532 | ino = autofs4_new_ino(sbi); | 537 | ino = autofs4_new_ino(sbi); |
@@ -554,7 +559,7 @@ static int autofs4_dir_symlink(struct inode *dir, | |||
554 | size_t size = strlen(symname); | 559 | size_t size = strlen(symname); |
555 | char *cp; | 560 | char *cp; |
556 | 561 | ||
557 | DPRINTK("%s <- %pd", symname, dentry); | 562 | pr_debug("%s <- %pd\n", symname, dentry); |
558 | 563 | ||
559 | if (!autofs4_oz_mode(sbi)) | 564 | if (!autofs4_oz_mode(sbi)) |
560 | return -EACCES; | 565 | return -EACCES; |
@@ -613,7 +618,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry) | |||
613 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); | 618 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); |
614 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 619 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
615 | struct autofs_info *p_ino; | 620 | struct autofs_info *p_ino; |
616 | 621 | ||
617 | /* This allows root to remove symlinks */ | 622 | /* This allows root to remove symlinks */ |
618 | if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) | 623 | if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) |
619 | return -EPERM; | 624 | return -EPERM; |
@@ -664,7 +669,6 @@ static void autofs_set_leaf_automount_flags(struct dentry *dentry) | |||
664 | if (IS_ROOT(parent->d_parent)) | 669 | if (IS_ROOT(parent->d_parent)) |
665 | return; | 670 | return; |
666 | managed_dentry_clear_managed(parent); | 671 | managed_dentry_clear_managed(parent); |
667 | return; | ||
668 | } | 672 | } |
669 | 673 | ||
670 | static void autofs_clear_leaf_automount_flags(struct dentry *dentry) | 674 | static void autofs_clear_leaf_automount_flags(struct dentry *dentry) |
@@ -687,7 +691,6 @@ static void autofs_clear_leaf_automount_flags(struct dentry *dentry) | |||
687 | if (d_child->next == &parent->d_subdirs && | 691 | if (d_child->next == &parent->d_subdirs && |
688 | d_child->prev == &parent->d_subdirs) | 692 | d_child->prev == &parent->d_subdirs) |
689 | managed_dentry_set_managed(parent); | 693 | managed_dentry_set_managed(parent); |
690 | return; | ||
691 | } | 694 | } |
692 | 695 | ||
693 | static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) | 696 | static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) |
@@ -695,8 +698,8 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) | |||
695 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); | 698 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); |
696 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 699 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
697 | struct autofs_info *p_ino; | 700 | struct autofs_info *p_ino; |
698 | 701 | ||
699 | DPRINTK("dentry %p, removing %pd", dentry, dentry); | 702 | pr_debug("dentry %p, removing %pd\n", dentry, dentry); |
700 | 703 | ||
701 | if (!autofs4_oz_mode(sbi)) | 704 | if (!autofs4_oz_mode(sbi)) |
702 | return -EACCES; | 705 | return -EACCES; |
@@ -728,7 +731,8 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) | |||
728 | return 0; | 731 | return 0; |
729 | } | 732 | } |
730 | 733 | ||
731 | static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | 734 | static int autofs4_dir_mkdir(struct inode *dir, |
735 | struct dentry *dentry, umode_t mode) | ||
732 | { | 736 | { |
733 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); | 737 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); |
734 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 738 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
@@ -738,7 +742,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t m | |||
738 | if (!autofs4_oz_mode(sbi)) | 742 | if (!autofs4_oz_mode(sbi)) |
739 | return -EACCES; | 743 | return -EACCES; |
740 | 744 | ||
741 | DPRINTK("dentry %p, creating %pd", dentry, dentry); | 745 | pr_debug("dentry %p, creating %pd\n", dentry, dentry); |
742 | 746 | ||
743 | BUG_ON(!ino); | 747 | BUG_ON(!ino); |
744 | 748 | ||
@@ -768,14 +772,18 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t m | |||
768 | /* Get/set timeout ioctl() operation */ | 772 | /* Get/set timeout ioctl() operation */ |
769 | #ifdef CONFIG_COMPAT | 773 | #ifdef CONFIG_COMPAT |
770 | static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, | 774 | static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, |
771 | compat_ulong_t __user *p) | 775 | compat_ulong_t __user *p) |
772 | { | 776 | { |
773 | int rv; | ||
774 | unsigned long ntimeout; | 777 | unsigned long ntimeout; |
778 | int rv; | ||
775 | 779 | ||
776 | if ((rv = get_user(ntimeout, p)) || | 780 | rv = get_user(ntimeout, p); |
777 | (rv = put_user(sbi->exp_timeout/HZ, p))) | 781 | if (rv) |
778 | return rv; | 782 | goto error; |
783 | |||
784 | rv = put_user(sbi->exp_timeout/HZ, p); | ||
785 | if (rv) | ||
786 | goto error; | ||
779 | 787 | ||
780 | if (ntimeout > UINT_MAX/HZ) | 788 | if (ntimeout > UINT_MAX/HZ) |
781 | sbi->exp_timeout = 0; | 789 | sbi->exp_timeout = 0; |
@@ -783,18 +791,24 @@ static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, | |||
783 | sbi->exp_timeout = ntimeout * HZ; | 791 | sbi->exp_timeout = ntimeout * HZ; |
784 | 792 | ||
785 | return 0; | 793 | return 0; |
794 | error: | ||
795 | return rv; | ||
786 | } | 796 | } |
787 | #endif | 797 | #endif |
788 | 798 | ||
789 | static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, | 799 | static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, |
790 | unsigned long __user *p) | 800 | unsigned long __user *p) |
791 | { | 801 | { |
792 | int rv; | ||
793 | unsigned long ntimeout; | 802 | unsigned long ntimeout; |
803 | int rv; | ||
794 | 804 | ||
795 | if ((rv = get_user(ntimeout, p)) || | 805 | rv = get_user(ntimeout, p); |
796 | (rv = put_user(sbi->exp_timeout/HZ, p))) | 806 | if (rv) |
797 | return rv; | 807 | goto error; |
808 | |||
809 | rv = put_user(sbi->exp_timeout/HZ, p); | ||
810 | if (rv) | ||
811 | goto error; | ||
798 | 812 | ||
799 | if (ntimeout > ULONG_MAX/HZ) | 813 | if (ntimeout > ULONG_MAX/HZ) |
800 | sbi->exp_timeout = 0; | 814 | sbi->exp_timeout = 0; |
@@ -802,16 +816,20 @@ static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, | |||
802 | sbi->exp_timeout = ntimeout * HZ; | 816 | sbi->exp_timeout = ntimeout * HZ; |
803 | 817 | ||
804 | return 0; | 818 | return 0; |
819 | error: | ||
820 | return rv; | ||
805 | } | 821 | } |
806 | 822 | ||
807 | /* Return protocol version */ | 823 | /* Return protocol version */ |
808 | static inline int autofs4_get_protover(struct autofs_sb_info *sbi, int __user *p) | 824 | static inline int autofs4_get_protover(struct autofs_sb_info *sbi, |
825 | int __user *p) | ||
809 | { | 826 | { |
810 | return put_user(sbi->version, p); | 827 | return put_user(sbi->version, p); |
811 | } | 828 | } |
812 | 829 | ||
813 | /* Return protocol sub version */ | 830 | /* Return protocol sub version */ |
814 | static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi, int __user *p) | 831 | static inline int autofs4_get_protosubver(struct autofs_sb_info *sbi, |
832 | int __user *p) | ||
815 | { | 833 | { |
816 | return put_user(sbi->sub_version, p); | 834 | return put_user(sbi->sub_version, p); |
817 | } | 835 | } |
@@ -826,7 +844,7 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p) | |||
826 | if (may_umount(mnt)) | 844 | if (may_umount(mnt)) |
827 | status = 1; | 845 | status = 1; |
828 | 846 | ||
829 | DPRINTK("returning %d", status); | 847 | pr_debug("returning %d\n", status); |
830 | 848 | ||
831 | status = put_user(status, p); | 849 | status = put_user(status, p); |
832 | 850 | ||
@@ -834,9 +852,9 @@ static inline int autofs4_ask_umount(struct vfsmount *mnt, int __user *p) | |||
834 | } | 852 | } |
835 | 853 | ||
836 | /* Identify autofs4_dentries - this is so we can tell if there's | 854 | /* Identify autofs4_dentries - this is so we can tell if there's |
837 | an extra dentry refcount or not. We only hold a refcount on the | 855 | * an extra dentry refcount or not. We only hold a refcount on the |
838 | dentry if its non-negative (ie, d_inode != NULL) | 856 | * dentry if its non-negative (ie, d_inode != NULL) |
839 | */ | 857 | */ |
840 | int is_autofs4_dentry(struct dentry *dentry) | 858 | int is_autofs4_dentry(struct dentry *dentry) |
841 | { | 859 | { |
842 | return dentry && d_really_is_positive(dentry) && | 860 | return dentry && d_really_is_positive(dentry) && |
@@ -854,21 +872,21 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp, | |||
854 | struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb); | 872 | struct autofs_sb_info *sbi = autofs4_sbi(inode->i_sb); |
855 | void __user *p = (void __user *)arg; | 873 | void __user *p = (void __user *)arg; |
856 | 874 | ||
857 | DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u", | 875 | pr_debug("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n", |
858 | cmd,arg,sbi,task_pgrp_nr(current)); | 876 | cmd, arg, sbi, task_pgrp_nr(current)); |
859 | 877 | ||
860 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || | 878 | if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || |
861 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) | 879 | _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) |
862 | return -ENOTTY; | 880 | return -ENOTTY; |
863 | 881 | ||
864 | if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) | 882 | if (!autofs4_oz_mode(sbi) && !capable(CAP_SYS_ADMIN)) |
865 | return -EPERM; | 883 | return -EPERM; |
866 | 884 | ||
867 | switch(cmd) { | 885 | switch (cmd) { |
868 | case AUTOFS_IOC_READY: /* Wait queue: go ahead and retry */ | 886 | case AUTOFS_IOC_READY: /* Wait queue: go ahead and retry */ |
869 | return autofs4_wait_release(sbi,(autofs_wqt_t)arg,0); | 887 | return autofs4_wait_release(sbi, (autofs_wqt_t) arg, 0); |
870 | case AUTOFS_IOC_FAIL: /* Wait queue: fail with ENOENT */ | 888 | case AUTOFS_IOC_FAIL: /* Wait queue: fail with ENOENT */ |
871 | return autofs4_wait_release(sbi,(autofs_wqt_t)arg,-ENOENT); | 889 | return autofs4_wait_release(sbi, (autofs_wqt_t) arg, -ENOENT); |
872 | case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */ | 890 | case AUTOFS_IOC_CATATONIC: /* Enter catatonic mode (daemon shutdown) */ |
873 | autofs4_catatonic_mode(sbi); | 891 | autofs4_catatonic_mode(sbi); |
874 | return 0; | 892 | return 0; |
@@ -888,13 +906,15 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp, | |||
888 | 906 | ||
889 | /* return a single thing to expire */ | 907 | /* return a single thing to expire */ |
890 | case AUTOFS_IOC_EXPIRE: | 908 | case AUTOFS_IOC_EXPIRE: |
891 | return autofs4_expire_run(inode->i_sb,filp->f_path.mnt,sbi, p); | 909 | return autofs4_expire_run(inode->i_sb, |
910 | filp->f_path.mnt, sbi, p); | ||
892 | /* same as above, but can send multiple expires through pipe */ | 911 | /* same as above, but can send multiple expires through pipe */ |
893 | case AUTOFS_IOC_EXPIRE_MULTI: | 912 | case AUTOFS_IOC_EXPIRE_MULTI: |
894 | return autofs4_expire_multi(inode->i_sb,filp->f_path.mnt,sbi, p); | 913 | return autofs4_expire_multi(inode->i_sb, |
914 | filp->f_path.mnt, sbi, p); | ||
895 | 915 | ||
896 | default: | 916 | default: |
897 | return -ENOSYS; | 917 | return -EINVAL; |
898 | } | 918 | } |
899 | } | 919 | } |
900 | 920 | ||
@@ -902,12 +922,13 @@ static long autofs4_root_ioctl(struct file *filp, | |||
902 | unsigned int cmd, unsigned long arg) | 922 | unsigned int cmd, unsigned long arg) |
903 | { | 923 | { |
904 | struct inode *inode = file_inode(filp); | 924 | struct inode *inode = file_inode(filp); |
925 | |||
905 | return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); | 926 | return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); |
906 | } | 927 | } |
907 | 928 | ||
908 | #ifdef CONFIG_COMPAT | 929 | #ifdef CONFIG_COMPAT |
909 | static long autofs4_root_compat_ioctl(struct file *filp, | 930 | static long autofs4_root_compat_ioctl(struct file *filp, |
910 | unsigned int cmd, unsigned long arg) | 931 | unsigned int cmd, unsigned long arg) |
911 | { | 932 | { |
912 | struct inode *inode = file_inode(filp); | 933 | struct inode *inode = file_inode(filp); |
913 | int ret; | 934 | int ret; |
@@ -916,7 +937,7 @@ static long autofs4_root_compat_ioctl(struct file *filp, | |||
916 | ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); | 937 | ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); |
917 | else | 938 | else |
918 | ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, | 939 | ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, |
919 | (unsigned long)compat_ptr(arg)); | 940 | (unsigned long) compat_ptr(arg)); |
920 | 941 | ||
921 | return ret; | 942 | return ret; |
922 | } | 943 | } |
diff --git a/fs/autofs4/symlink.c b/fs/autofs4/symlink.c index 84e037d1d129..99aab00dc217 100644 --- a/fs/autofs4/symlink.c +++ b/fs/autofs4/symlink.c | |||
@@ -1,14 +1,10 @@ | |||
1 | /* -*- c -*- --------------------------------------------------------------- * | 1 | /* |
2 | * | 2 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved |
3 | * linux/fs/autofs/symlink.c | ||
4 | * | ||
5 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved | ||
6 | * | 3 | * |
7 | * This file is part of the Linux kernel and is made available under | 4 | * This file is part of the Linux kernel and is made available under |
8 | * the terms of the GNU General Public License, version 2, or at your | 5 | * the terms of the GNU General Public License, version 2, or at your |
9 | * option, any later version, incorporated herein by reference. | 6 | * option, any later version, incorporated herein by reference. |
10 | * | 7 | */ |
11 | * ------------------------------------------------------------------------- */ | ||
12 | 8 | ||
13 | #include "autofs_i.h" | 9 | #include "autofs_i.h" |
14 | 10 | ||
@@ -18,6 +14,7 @@ static const char *autofs4_get_link(struct dentry *dentry, | |||
18 | { | 14 | { |
19 | struct autofs_sb_info *sbi; | 15 | struct autofs_sb_info *sbi; |
20 | struct autofs_info *ino; | 16 | struct autofs_info *ino; |
17 | |||
21 | if (!dentry) | 18 | if (!dentry) |
22 | return ERR_PTR(-ECHILD); | 19 | return ERR_PTR(-ECHILD); |
23 | sbi = autofs4_sbi(dentry->d_sb); | 20 | sbi = autofs4_sbi(dentry->d_sb); |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 35b755e79c2d..0146d911f468 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -1,15 +1,11 @@ | |||
1 | /* -*- c -*- --------------------------------------------------------------- * | 1 | /* |
2 | * | 2 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved |
3 | * linux/fs/autofs/waitq.c | 3 | * Copyright 2001-2006 Ian Kent <raven@themaw.net> |
4 | * | ||
5 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved | ||
6 | * Copyright 2001-2006 Ian Kent <raven@themaw.net> | ||
7 | * | 4 | * |
8 | * This file is part of the Linux kernel and is made available under | 5 | * This file is part of the Linux kernel and is made available under |
9 | * the terms of the GNU General Public License, version 2, or at your | 6 | * the terms of the GNU General Public License, version 2, or at your |
10 | * option, any later version, incorporated herein by reference. | 7 | * option, any later version, incorporated herein by reference. |
11 | * | 8 | */ |
12 | * ------------------------------------------------------------------------- */ | ||
13 | 9 | ||
14 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
15 | #include <linux/time.h> | 11 | #include <linux/time.h> |
@@ -18,7 +14,8 @@ | |||
18 | #include "autofs_i.h" | 14 | #include "autofs_i.h" |
19 | 15 | ||
20 | /* We make this a static variable rather than a part of the superblock; it | 16 | /* We make this a static variable rather than a part of the superblock; it |
21 | is better if we don't reassign numbers easily even across filesystems */ | 17 | * is better if we don't reassign numbers easily even across filesystems |
18 | */ | ||
22 | static autofs_wqt_t autofs4_next_wait_queue = 1; | 19 | static autofs_wqt_t autofs4_next_wait_queue = 1; |
23 | 20 | ||
24 | /* These are the signals we allow interrupting a pending mount */ | 21 | /* These are the signals we allow interrupting a pending mount */ |
@@ -34,7 +31,7 @@ void autofs4_catatonic_mode(struct autofs_sb_info *sbi) | |||
34 | return; | 31 | return; |
35 | } | 32 | } |
36 | 33 | ||
37 | DPRINTK("entering catatonic mode"); | 34 | pr_debug("entering catatonic mode\n"); |
38 | 35 | ||
39 | sbi->catatonic = 1; | 36 | sbi->catatonic = 1; |
40 | wq = sbi->queues; | 37 | wq = sbi->queues; |
@@ -69,17 +66,19 @@ static int autofs4_write(struct autofs_sb_info *sbi, | |||
69 | set_fs(KERNEL_DS); | 66 | set_fs(KERNEL_DS); |
70 | 67 | ||
71 | mutex_lock(&sbi->pipe_mutex); | 68 | mutex_lock(&sbi->pipe_mutex); |
72 | while (bytes && | 69 | wr = __vfs_write(file, data, bytes, &file->f_pos); |
73 | (wr = __vfs_write(file,data,bytes,&file->f_pos)) > 0) { | 70 | while (bytes && wr) { |
74 | data += wr; | 71 | data += wr; |
75 | bytes -= wr; | 72 | bytes -= wr; |
73 | wr = __vfs_write(file, data, bytes, &file->f_pos); | ||
76 | } | 74 | } |
77 | mutex_unlock(&sbi->pipe_mutex); | 75 | mutex_unlock(&sbi->pipe_mutex); |
78 | 76 | ||
79 | set_fs(fs); | 77 | set_fs(fs); |
80 | 78 | ||
81 | /* Keep the currently executing process from receiving a | 79 | /* Keep the currently executing process from receiving a |
82 | SIGPIPE unless it was already supposed to get one */ | 80 | * SIGPIPE unless it was already supposed to get one |
81 | */ | ||
83 | if (wr == -EPIPE && !sigpipe) { | 82 | if (wr == -EPIPE && !sigpipe) { |
84 | spin_lock_irqsave(¤t->sighand->siglock, flags); | 83 | spin_lock_irqsave(¤t->sighand->siglock, flags); |
85 | sigdelset(¤t->pending.signal, SIGPIPE); | 84 | sigdelset(¤t->pending.signal, SIGPIPE); |
@@ -89,7 +88,7 @@ static int autofs4_write(struct autofs_sb_info *sbi, | |||
89 | 88 | ||
90 | return (bytes > 0); | 89 | return (bytes > 0); |
91 | } | 90 | } |
92 | 91 | ||
93 | static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | 92 | static void autofs4_notify_daemon(struct autofs_sb_info *sbi, |
94 | struct autofs_wait_queue *wq, | 93 | struct autofs_wait_queue *wq, |
95 | int type) | 94 | int type) |
@@ -102,10 +101,11 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
102 | struct file *pipe = NULL; | 101 | struct file *pipe = NULL; |
103 | size_t pktsz; | 102 | size_t pktsz; |
104 | 103 | ||
105 | DPRINTK("wait id = 0x%08lx, name = %.*s, type=%d", | 104 | pr_debug("wait id = 0x%08lx, name = %.*s, type=%d\n", |
106 | (unsigned long) wq->wait_queue_token, wq->name.len, wq->name.name, type); | 105 | (unsigned long) wq->wait_queue_token, |
106 | wq->name.len, wq->name.name, type); | ||
107 | 107 | ||
108 | memset(&pkt,0,sizeof pkt); /* For security reasons */ | 108 | memset(&pkt, 0, sizeof(pkt)); /* For security reasons */ |
109 | 109 | ||
110 | pkt.hdr.proto_version = sbi->version; | 110 | pkt.hdr.proto_version = sbi->version; |
111 | pkt.hdr.type = type; | 111 | pkt.hdr.type = type; |
@@ -126,7 +126,8 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
126 | } | 126 | } |
127 | case autofs_ptype_expire_multi: | 127 | case autofs_ptype_expire_multi: |
128 | { | 128 | { |
129 | struct autofs_packet_expire_multi *ep = &pkt.v4_pkt.expire_multi; | 129 | struct autofs_packet_expire_multi *ep = |
130 | &pkt.v4_pkt.expire_multi; | ||
130 | 131 | ||
131 | pktsz = sizeof(*ep); | 132 | pktsz = sizeof(*ep); |
132 | 133 | ||
@@ -163,7 +164,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
163 | break; | 164 | break; |
164 | } | 165 | } |
165 | default: | 166 | default: |
166 | printk("autofs4_notify_daemon: bad type %d!\n", type); | 167 | pr_warn("bad type %d!\n", type); |
167 | mutex_unlock(&sbi->wq_mutex); | 168 | mutex_unlock(&sbi->wq_mutex); |
168 | return; | 169 | return; |
169 | } | 170 | } |
@@ -231,7 +232,7 @@ autofs4_find_wait(struct autofs_sb_info *sbi, struct qstr *qstr) | |||
231 | if (wq->name.hash == qstr->hash && | 232 | if (wq->name.hash == qstr->hash && |
232 | wq->name.len == qstr->len && | 233 | wq->name.len == qstr->len && |
233 | wq->name.name && | 234 | wq->name.name && |
234 | !memcmp(wq->name.name, qstr->name, qstr->len)) | 235 | !memcmp(wq->name.name, qstr->name, qstr->len)) |
235 | break; | 236 | break; |
236 | } | 237 | } |
237 | return wq; | 238 | return wq; |
@@ -248,7 +249,7 @@ autofs4_find_wait(struct autofs_sb_info *sbi, struct qstr *qstr) | |||
248 | static int validate_request(struct autofs_wait_queue **wait, | 249 | static int validate_request(struct autofs_wait_queue **wait, |
249 | struct autofs_sb_info *sbi, | 250 | struct autofs_sb_info *sbi, |
250 | struct qstr *qstr, | 251 | struct qstr *qstr, |
251 | struct dentry*dentry, enum autofs_notify notify) | 252 | struct dentry *dentry, enum autofs_notify notify) |
252 | { | 253 | { |
253 | struct autofs_wait_queue *wq; | 254 | struct autofs_wait_queue *wq; |
254 | struct autofs_info *ino; | 255 | struct autofs_info *ino; |
@@ -322,8 +323,10 @@ static int validate_request(struct autofs_wait_queue **wait, | |||
322 | * continue on and create a new request. | 323 | * continue on and create a new request. |
323 | */ | 324 | */ |
324 | if (!IS_ROOT(dentry)) { | 325 | if (!IS_ROOT(dentry)) { |
325 | if (d_really_is_positive(dentry) && d_unhashed(dentry)) { | 326 | if (d_unhashed(dentry) && |
327 | d_really_is_positive(dentry)) { | ||
326 | struct dentry *parent = dentry->d_parent; | 328 | struct dentry *parent = dentry->d_parent; |
329 | |||
327 | new = d_lookup(parent, &dentry->d_name); | 330 | new = d_lookup(parent, &dentry->d_name); |
328 | if (new) | 331 | if (new) |
329 | dentry = new; | 332 | dentry = new; |
@@ -340,8 +343,8 @@ static int validate_request(struct autofs_wait_queue **wait, | |||
340 | return 1; | 343 | return 1; |
341 | } | 344 | } |
342 | 345 | ||
343 | int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | 346 | int autofs4_wait(struct autofs_sb_info *sbi, |
344 | enum autofs_notify notify) | 347 | struct dentry *dentry, enum autofs_notify notify) |
345 | { | 348 | { |
346 | struct autofs_wait_queue *wq; | 349 | struct autofs_wait_queue *wq; |
347 | struct qstr qstr; | 350 | struct qstr qstr; |
@@ -411,7 +414,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
411 | 414 | ||
412 | if (!wq) { | 415 | if (!wq) { |
413 | /* Create a new wait queue */ | 416 | /* Create a new wait queue */ |
414 | wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); | 417 | wq = kmalloc(sizeof(struct autofs_wait_queue), GFP_KERNEL); |
415 | if (!wq) { | 418 | if (!wq) { |
416 | kfree(qstr.name); | 419 | kfree(qstr.name); |
417 | mutex_unlock(&sbi->wq_mutex); | 420 | mutex_unlock(&sbi->wq_mutex); |
@@ -450,17 +453,19 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
450 | autofs_ptype_expire_indirect; | 453 | autofs_ptype_expire_indirect; |
451 | } | 454 | } |
452 | 455 | ||
453 | DPRINTK("new wait id = 0x%08lx, name = %.*s, nfy=%d\n", | 456 | pr_debug("new wait id = 0x%08lx, name = %.*s, nfy=%d\n", |
454 | (unsigned long) wq->wait_queue_token, wq->name.len, | 457 | (unsigned long) wq->wait_queue_token, wq->name.len, |
455 | wq->name.name, notify); | 458 | wq->name.name, notify); |
456 | 459 | ||
457 | /* autofs4_notify_daemon() may block; it will unlock ->wq_mutex */ | 460 | /* |
461 | * autofs4_notify_daemon() may block; it will unlock ->wq_mutex | ||
462 | */ | ||
458 | autofs4_notify_daemon(sbi, wq, type); | 463 | autofs4_notify_daemon(sbi, wq, type); |
459 | } else { | 464 | } else { |
460 | wq->wait_ctr++; | 465 | wq->wait_ctr++; |
461 | DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d", | 466 | pr_debug("existing wait id = 0x%08lx, name = %.*s, nfy=%d\n", |
462 | (unsigned long) wq->wait_queue_token, wq->name.len, | 467 | (unsigned long) wq->wait_queue_token, wq->name.len, |
463 | wq->name.name, notify); | 468 | wq->name.name, notify); |
464 | mutex_unlock(&sbi->wq_mutex); | 469 | mutex_unlock(&sbi->wq_mutex); |
465 | kfree(qstr.name); | 470 | kfree(qstr.name); |
466 | } | 471 | } |
@@ -471,12 +476,14 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
471 | */ | 476 | */ |
472 | if (wq->name.name) { | 477 | if (wq->name.name) { |
473 | /* Block all but "shutdown" signals while waiting */ | 478 | /* Block all but "shutdown" signals while waiting */ |
474 | sigset_t oldset; | 479 | unsigned long shutdown_sigs_mask; |
475 | unsigned long irqflags; | 480 | unsigned long irqflags; |
481 | sigset_t oldset; | ||
476 | 482 | ||
477 | spin_lock_irqsave(¤t->sighand->siglock, irqflags); | 483 | spin_lock_irqsave(¤t->sighand->siglock, irqflags); |
478 | oldset = current->blocked; | 484 | oldset = current->blocked; |
479 | siginitsetinv(¤t->blocked, SHUTDOWN_SIGS & ~oldset.sig[0]); | 485 | shutdown_sigs_mask = SHUTDOWN_SIGS & ~oldset.sig[0]; |
486 | siginitsetinv(¤t->blocked, shutdown_sigs_mask); | ||
480 | recalc_sigpending(); | 487 | recalc_sigpending(); |
481 | spin_unlock_irqrestore(¤t->sighand->siglock, irqflags); | 488 | spin_unlock_irqrestore(¤t->sighand->siglock, irqflags); |
482 | 489 | ||
@@ -487,7 +494,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
487 | recalc_sigpending(); | 494 | recalc_sigpending(); |
488 | spin_unlock_irqrestore(¤t->sighand->siglock, irqflags); | 495 | spin_unlock_irqrestore(¤t->sighand->siglock, irqflags); |
489 | } else { | 496 | } else { |
490 | DPRINTK("skipped sleeping"); | 497 | pr_debug("skipped sleeping\n"); |
491 | } | 498 | } |
492 | 499 | ||
493 | status = wq->status; | 500 | status = wq->status; |
@@ -562,4 +569,3 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok | |||
562 | 569 | ||
563 | return 0; | 570 | return 0; |
564 | } | 571 | } |
565 | |||
diff --git a/fs/buffer.c b/fs/buffer.c index e1632abb4ca9..33be29675358 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -621,17 +621,17 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode); | |||
621 | * If warn is true, then emit a warning if the page is not uptodate and has | 621 | * If warn is true, then emit a warning if the page is not uptodate and has |
622 | * not been truncated. | 622 | * not been truncated. |
623 | * | 623 | * |
624 | * The caller must hold mem_cgroup_begin_page_stat() lock. | 624 | * The caller must hold lock_page_memcg(). |
625 | */ | 625 | */ |
626 | static void __set_page_dirty(struct page *page, struct address_space *mapping, | 626 | static void __set_page_dirty(struct page *page, struct address_space *mapping, |
627 | struct mem_cgroup *memcg, int warn) | 627 | int warn) |
628 | { | 628 | { |
629 | unsigned long flags; | 629 | unsigned long flags; |
630 | 630 | ||
631 | spin_lock_irqsave(&mapping->tree_lock, flags); | 631 | spin_lock_irqsave(&mapping->tree_lock, flags); |
632 | if (page->mapping) { /* Race with truncate? */ | 632 | if (page->mapping) { /* Race with truncate? */ |
633 | WARN_ON_ONCE(warn && !PageUptodate(page)); | 633 | WARN_ON_ONCE(warn && !PageUptodate(page)); |
634 | account_page_dirtied(page, mapping, memcg); | 634 | account_page_dirtied(page, mapping); |
635 | radix_tree_tag_set(&mapping->page_tree, | 635 | radix_tree_tag_set(&mapping->page_tree, |
636 | page_index(page), PAGECACHE_TAG_DIRTY); | 636 | page_index(page), PAGECACHE_TAG_DIRTY); |
637 | } | 637 | } |
@@ -666,7 +666,6 @@ static void __set_page_dirty(struct page *page, struct address_space *mapping, | |||
666 | int __set_page_dirty_buffers(struct page *page) | 666 | int __set_page_dirty_buffers(struct page *page) |
667 | { | 667 | { |
668 | int newly_dirty; | 668 | int newly_dirty; |
669 | struct mem_cgroup *memcg; | ||
670 | struct address_space *mapping = page_mapping(page); | 669 | struct address_space *mapping = page_mapping(page); |
671 | 670 | ||
672 | if (unlikely(!mapping)) | 671 | if (unlikely(!mapping)) |
@@ -683,17 +682,17 @@ int __set_page_dirty_buffers(struct page *page) | |||
683 | } while (bh != head); | 682 | } while (bh != head); |
684 | } | 683 | } |
685 | /* | 684 | /* |
686 | * Use mem_group_begin_page_stat() to keep PageDirty synchronized with | 685 | * Lock out page->mem_cgroup migration to keep PageDirty |
687 | * per-memcg dirty page counters. | 686 | * synchronized with per-memcg dirty page counters. |
688 | */ | 687 | */ |
689 | memcg = mem_cgroup_begin_page_stat(page); | 688 | lock_page_memcg(page); |
690 | newly_dirty = !TestSetPageDirty(page); | 689 | newly_dirty = !TestSetPageDirty(page); |
691 | spin_unlock(&mapping->private_lock); | 690 | spin_unlock(&mapping->private_lock); |
692 | 691 | ||
693 | if (newly_dirty) | 692 | if (newly_dirty) |
694 | __set_page_dirty(page, mapping, memcg, 1); | 693 | __set_page_dirty(page, mapping, 1); |
695 | 694 | ||
696 | mem_cgroup_end_page_stat(memcg); | 695 | unlock_page_memcg(page); |
697 | 696 | ||
698 | if (newly_dirty) | 697 | if (newly_dirty) |
699 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | 698 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); |
@@ -1167,15 +1166,14 @@ void mark_buffer_dirty(struct buffer_head *bh) | |||
1167 | if (!test_set_buffer_dirty(bh)) { | 1166 | if (!test_set_buffer_dirty(bh)) { |
1168 | struct page *page = bh->b_page; | 1167 | struct page *page = bh->b_page; |
1169 | struct address_space *mapping = NULL; | 1168 | struct address_space *mapping = NULL; |
1170 | struct mem_cgroup *memcg; | ||
1171 | 1169 | ||
1172 | memcg = mem_cgroup_begin_page_stat(page); | 1170 | lock_page_memcg(page); |
1173 | if (!TestSetPageDirty(page)) { | 1171 | if (!TestSetPageDirty(page)) { |
1174 | mapping = page_mapping(page); | 1172 | mapping = page_mapping(page); |
1175 | if (mapping) | 1173 | if (mapping) |
1176 | __set_page_dirty(page, mapping, memcg, 0); | 1174 | __set_page_dirty(page, mapping, 0); |
1177 | } | 1175 | } |
1178 | mem_cgroup_end_page_stat(memcg); | 1176 | unlock_page_memcg(page); |
1179 | if (mapping) | 1177 | if (mapping) |
1180 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | 1178 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); |
1181 | } | 1179 | } |
diff --git a/fs/mpage.c b/fs/mpage.c index 1480d3a18037..6bd9fd90964e 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/highmem.h> | 24 | #include <linux/highmem.h> |
25 | #include <linux/prefetch.h> | 25 | #include <linux/prefetch.h> |
26 | #include <linux/mpage.h> | 26 | #include <linux/mpage.h> |
27 | #include <linux/mm_inline.h> | ||
27 | #include <linux/writeback.h> | 28 | #include <linux/writeback.h> |
28 | #include <linux/backing-dev.h> | 29 | #include <linux/backing-dev.h> |
29 | #include <linux/pagevec.h> | 30 | #include <linux/pagevec.h> |
@@ -366,7 +367,7 @@ mpage_readpages(struct address_space *mapping, struct list_head *pages, | |||
366 | map_bh.b_state = 0; | 367 | map_bh.b_state = 0; |
367 | map_bh.b_size = 0; | 368 | map_bh.b_size = 0; |
368 | for (page_idx = 0; page_idx < nr_pages; page_idx++) { | 369 | for (page_idx = 0; page_idx < nr_pages; page_idx++) { |
369 | struct page *page = list_entry(pages->prev, struct page, lru); | 370 | struct page *page = lru_to_page(pages); |
370 | 371 | ||
371 | prefetchw(&page->flags); | 372 | prefetchw(&page->flags); |
372 | list_del(&page->lru); | 373 | list_del(&page->lru); |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index a76b9ea7722e..ef6a2ec494de 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -287,7 +287,6 @@ struct o2hb_bio_wait_ctxt { | |||
287 | static void o2hb_write_timeout(struct work_struct *work) | 287 | static void o2hb_write_timeout(struct work_struct *work) |
288 | { | 288 | { |
289 | int failed, quorum; | 289 | int failed, quorum; |
290 | unsigned long flags; | ||
291 | struct o2hb_region *reg = | 290 | struct o2hb_region *reg = |
292 | container_of(work, struct o2hb_region, | 291 | container_of(work, struct o2hb_region, |
293 | hr_write_timeout_work.work); | 292 | hr_write_timeout_work.work); |
@@ -297,14 +296,14 @@ static void o2hb_write_timeout(struct work_struct *work) | |||
297 | jiffies_to_msecs(jiffies - reg->hr_last_timeout_start)); | 296 | jiffies_to_msecs(jiffies - reg->hr_last_timeout_start)); |
298 | 297 | ||
299 | if (o2hb_global_heartbeat_active()) { | 298 | if (o2hb_global_heartbeat_active()) { |
300 | spin_lock_irqsave(&o2hb_live_lock, flags); | 299 | spin_lock(&o2hb_live_lock); |
301 | if (test_bit(reg->hr_region_num, o2hb_quorum_region_bitmap)) | 300 | if (test_bit(reg->hr_region_num, o2hb_quorum_region_bitmap)) |
302 | set_bit(reg->hr_region_num, o2hb_failed_region_bitmap); | 301 | set_bit(reg->hr_region_num, o2hb_failed_region_bitmap); |
303 | failed = bitmap_weight(o2hb_failed_region_bitmap, | 302 | failed = bitmap_weight(o2hb_failed_region_bitmap, |
304 | O2NM_MAX_REGIONS); | 303 | O2NM_MAX_REGIONS); |
305 | quorum = bitmap_weight(o2hb_quorum_region_bitmap, | 304 | quorum = bitmap_weight(o2hb_quorum_region_bitmap, |
306 | O2NM_MAX_REGIONS); | 305 | O2NM_MAX_REGIONS); |
307 | spin_unlock_irqrestore(&o2hb_live_lock, flags); | 306 | spin_unlock(&o2hb_live_lock); |
308 | 307 | ||
309 | mlog(ML_HEARTBEAT, "Number of regions %d, failed regions %d\n", | 308 | mlog(ML_HEARTBEAT, "Number of regions %d, failed regions %d\n", |
310 | quorum, failed); | 309 | quorum, failed); |
@@ -2425,11 +2424,10 @@ EXPORT_SYMBOL_GPL(o2hb_check_node_heartbeating); | |||
2425 | int o2hb_check_node_heartbeating_no_sem(u8 node_num) | 2424 | int o2hb_check_node_heartbeating_no_sem(u8 node_num) |
2426 | { | 2425 | { |
2427 | unsigned long testing_map[BITS_TO_LONGS(O2NM_MAX_NODES)]; | 2426 | unsigned long testing_map[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
2428 | unsigned long flags; | ||
2429 | 2427 | ||
2430 | spin_lock_irqsave(&o2hb_live_lock, flags); | 2428 | spin_lock(&o2hb_live_lock); |
2431 | o2hb_fill_node_map_from_callback(testing_map, sizeof(testing_map)); | 2429 | o2hb_fill_node_map_from_callback(testing_map, sizeof(testing_map)); |
2432 | spin_unlock_irqrestore(&o2hb_live_lock, flags); | 2430 | spin_unlock(&o2hb_live_lock); |
2433 | if (!test_bit(node_num, testing_map)) { | 2431 | if (!test_bit(node_num, testing_map)) { |
2434 | mlog(ML_HEARTBEAT, | 2432 | mlog(ML_HEARTBEAT, |
2435 | "node (%u) does not have heartbeating enabled.\n", | 2433 | "node (%u) does not have heartbeating enabled.\n", |
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 68c607e63ff6..004f2cbe8f71 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -282,6 +282,7 @@ static inline void __dlm_set_joining_node(struct dlm_ctxt *dlm, | |||
282 | #define DLM_LOCK_RES_DROPPING_REF 0x00000040 | 282 | #define DLM_LOCK_RES_DROPPING_REF 0x00000040 |
283 | #define DLM_LOCK_RES_BLOCK_DIRTY 0x00001000 | 283 | #define DLM_LOCK_RES_BLOCK_DIRTY 0x00001000 |
284 | #define DLM_LOCK_RES_SETREF_INPROG 0x00002000 | 284 | #define DLM_LOCK_RES_SETREF_INPROG 0x00002000 |
285 | #define DLM_LOCK_RES_RECOVERY_WAITING 0x00004000 | ||
285 | 286 | ||
286 | /* max milliseconds to wait to sync up a network failure with a node death */ | 287 | /* max milliseconds to wait to sync up a network failure with a node death */ |
287 | #define DLM_NODE_DEATH_WAIT_MAX (5 * 1000) | 288 | #define DLM_NODE_DEATH_WAIT_MAX (5 * 1000) |
@@ -451,6 +452,7 @@ enum { | |||
451 | DLM_QUERY_REGION = 519, | 452 | DLM_QUERY_REGION = 519, |
452 | DLM_QUERY_NODEINFO = 520, | 453 | DLM_QUERY_NODEINFO = 520, |
453 | DLM_BEGIN_EXIT_DOMAIN_MSG = 521, | 454 | DLM_BEGIN_EXIT_DOMAIN_MSG = 521, |
455 | DLM_DEREF_LOCKRES_DONE = 522, | ||
454 | }; | 456 | }; |
455 | 457 | ||
456 | struct dlm_reco_node_data | 458 | struct dlm_reco_node_data |
@@ -545,7 +547,7 @@ struct dlm_master_requery | |||
545 | * }; | 547 | * }; |
546 | * | 548 | * |
547 | * from ../cluster/tcp.h | 549 | * from ../cluster/tcp.h |
548 | * NET_MAX_PAYLOAD_BYTES (4096 - sizeof(net_msg)) | 550 | * O2NET_MAX_PAYLOAD_BYTES (4096 - sizeof(net_msg)) |
549 | * (roughly 4080 bytes) | 551 | * (roughly 4080 bytes) |
550 | * and sizeof(dlm_migratable_lockres) = 112 bytes | 552 | * and sizeof(dlm_migratable_lockres) = 112 bytes |
551 | * and sizeof(dlm_migratable_lock) = 16 bytes | 553 | * and sizeof(dlm_migratable_lock) = 16 bytes |
@@ -586,7 +588,7 @@ struct dlm_migratable_lockres | |||
586 | 588 | ||
587 | /* from above, 128 bytes | 589 | /* from above, 128 bytes |
588 | * for some undetermined future use */ | 590 | * for some undetermined future use */ |
589 | #define DLM_MIG_LOCKRES_RESERVED (NET_MAX_PAYLOAD_BYTES - \ | 591 | #define DLM_MIG_LOCKRES_RESERVED (O2NET_MAX_PAYLOAD_BYTES - \ |
590 | DLM_MIG_LOCKRES_MAX_LEN) | 592 | DLM_MIG_LOCKRES_MAX_LEN) |
591 | 593 | ||
592 | struct dlm_create_lock | 594 | struct dlm_create_lock |
@@ -782,6 +784,20 @@ struct dlm_deref_lockres | |||
782 | u8 name[O2NM_MAX_NAME_LEN]; | 784 | u8 name[O2NM_MAX_NAME_LEN]; |
783 | }; | 785 | }; |
784 | 786 | ||
787 | enum { | ||
788 | DLM_DEREF_RESPONSE_DONE = 0, | ||
789 | DLM_DEREF_RESPONSE_INPROG = 1, | ||
790 | }; | ||
791 | |||
792 | struct dlm_deref_lockres_done { | ||
793 | u32 pad1; | ||
794 | u16 pad2; | ||
795 | u8 node_idx; | ||
796 | u8 namelen; | ||
797 | |||
798 | u8 name[O2NM_MAX_NAME_LEN]; | ||
799 | }; | ||
800 | |||
785 | static inline enum dlm_status | 801 | static inline enum dlm_status |
786 | __dlm_lockres_state_to_status(struct dlm_lock_resource *res) | 802 | __dlm_lockres_state_to_status(struct dlm_lock_resource *res) |
787 | { | 803 | { |
@@ -789,7 +805,8 @@ __dlm_lockres_state_to_status(struct dlm_lock_resource *res) | |||
789 | 805 | ||
790 | assert_spin_locked(&res->spinlock); | 806 | assert_spin_locked(&res->spinlock); |
791 | 807 | ||
792 | if (res->state & DLM_LOCK_RES_RECOVERING) | 808 | if (res->state & (DLM_LOCK_RES_RECOVERING| |
809 | DLM_LOCK_RES_RECOVERY_WAITING)) | ||
793 | status = DLM_RECOVERING; | 810 | status = DLM_RECOVERING; |
794 | else if (res->state & DLM_LOCK_RES_MIGRATING) | 811 | else if (res->state & DLM_LOCK_RES_MIGRATING) |
795 | status = DLM_MIGRATING; | 812 | status = DLM_MIGRATING; |
@@ -968,6 +985,8 @@ int dlm_assert_master_handler(struct o2net_msg *msg, u32 len, void *data, | |||
968 | void dlm_assert_master_post_handler(int status, void *data, void *ret_data); | 985 | void dlm_assert_master_post_handler(int status, void *data, void *ret_data); |
969 | int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | 986 | int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data, |
970 | void **ret_data); | 987 | void **ret_data); |
988 | int dlm_deref_lockres_done_handler(struct o2net_msg *msg, u32 len, void *data, | ||
989 | void **ret_data); | ||
971 | int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data, | 990 | int dlm_migrate_request_handler(struct o2net_msg *msg, u32 len, void *data, |
972 | void **ret_data); | 991 | void **ret_data); |
973 | int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | 992 | int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data, |
@@ -1009,6 +1028,7 @@ static inline void __dlm_wait_on_lockres(struct dlm_lock_resource *res) | |||
1009 | { | 1028 | { |
1010 | __dlm_wait_on_lockres_flags(res, (DLM_LOCK_RES_IN_PROGRESS| | 1029 | __dlm_wait_on_lockres_flags(res, (DLM_LOCK_RES_IN_PROGRESS| |
1011 | DLM_LOCK_RES_RECOVERING| | 1030 | DLM_LOCK_RES_RECOVERING| |
1031 | DLM_LOCK_RES_RECOVERY_WAITING| | ||
1012 | DLM_LOCK_RES_MIGRATING)); | 1032 | DLM_LOCK_RES_MIGRATING)); |
1013 | } | 1033 | } |
1014 | 1034 | ||
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 2ee7fe747cea..12e064b8be9a 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -132,10 +132,13 @@ static DECLARE_WAIT_QUEUE_HEAD(dlm_domain_events); | |||
132 | * - Message DLM_QUERY_NODEINFO added to allow online node removes | 132 | * - Message DLM_QUERY_NODEINFO added to allow online node removes |
133 | * New in version 1.2: | 133 | * New in version 1.2: |
134 | * - Message DLM_BEGIN_EXIT_DOMAIN_MSG added to mark start of exit domain | 134 | * - Message DLM_BEGIN_EXIT_DOMAIN_MSG added to mark start of exit domain |
135 | * New in version 1.3: | ||
136 | * - Message DLM_DEREF_LOCKRES_DONE added to inform non-master that the | ||
137 | * refmap is cleared | ||
135 | */ | 138 | */ |
136 | static const struct dlm_protocol_version dlm_protocol = { | 139 | static const struct dlm_protocol_version dlm_protocol = { |
137 | .pv_major = 1, | 140 | .pv_major = 1, |
138 | .pv_minor = 2, | 141 | .pv_minor = 3, |
139 | }; | 142 | }; |
140 | 143 | ||
141 | #define DLM_DOMAIN_BACKOFF_MS 200 | 144 | #define DLM_DOMAIN_BACKOFF_MS 200 |
@@ -1396,7 +1399,7 @@ static int dlm_send_join_cancels(struct dlm_ctxt *dlm, | |||
1396 | unsigned int map_size) | 1399 | unsigned int map_size) |
1397 | { | 1400 | { |
1398 | int status, tmpstat; | 1401 | int status, tmpstat; |
1399 | unsigned int node; | 1402 | int node; |
1400 | 1403 | ||
1401 | if (map_size != (BITS_TO_LONGS(O2NM_MAX_NODES) * | 1404 | if (map_size != (BITS_TO_LONGS(O2NM_MAX_NODES) * |
1402 | sizeof(unsigned long))) { | 1405 | sizeof(unsigned long))) { |
@@ -1853,7 +1856,13 @@ static int dlm_register_domain_handlers(struct dlm_ctxt *dlm) | |||
1853 | sizeof(struct dlm_exit_domain), | 1856 | sizeof(struct dlm_exit_domain), |
1854 | dlm_begin_exit_domain_handler, | 1857 | dlm_begin_exit_domain_handler, |
1855 | dlm, NULL, &dlm->dlm_domain_handlers); | 1858 | dlm, NULL, &dlm->dlm_domain_handlers); |
1859 | if (status) | ||
1860 | goto bail; | ||
1856 | 1861 | ||
1862 | status = o2net_register_handler(DLM_DEREF_LOCKRES_DONE, dlm->key, | ||
1863 | sizeof(struct dlm_deref_lockres_done), | ||
1864 | dlm_deref_lockres_done_handler, | ||
1865 | dlm, NULL, &dlm->dlm_domain_handlers); | ||
1857 | bail: | 1866 | bail: |
1858 | if (status) | 1867 | if (status) |
1859 | dlm_unregister_domain_handlers(dlm); | 1868 | dlm_unregister_domain_handlers(dlm); |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 9477d6e1de37..9aed6e202201 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -2278,7 +2278,7 @@ int dlm_drop_lockres_ref(struct dlm_ctxt *dlm, struct dlm_lock_resource *res) | |||
2278 | dlm_print_one_lock_resource(res); | 2278 | dlm_print_one_lock_resource(res); |
2279 | BUG(); | 2279 | BUG(); |
2280 | } | 2280 | } |
2281 | return ret; | 2281 | return ret ? ret : r; |
2282 | } | 2282 | } |
2283 | 2283 | ||
2284 | int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | 2284 | int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data, |
@@ -2345,7 +2345,7 @@ int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | |||
2345 | res->lockname.len, res->lockname.name, node); | 2345 | res->lockname.len, res->lockname.name, node); |
2346 | dlm_print_one_lock_resource(res); | 2346 | dlm_print_one_lock_resource(res); |
2347 | } | 2347 | } |
2348 | ret = 0; | 2348 | ret = DLM_DEREF_RESPONSE_DONE; |
2349 | goto done; | 2349 | goto done; |
2350 | } | 2350 | } |
2351 | 2351 | ||
@@ -2365,7 +2365,7 @@ int dlm_deref_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | |||
2365 | spin_unlock(&dlm->work_lock); | 2365 | spin_unlock(&dlm->work_lock); |
2366 | 2366 | ||
2367 | queue_work(dlm->dlm_worker, &dlm->dispatched_work); | 2367 | queue_work(dlm->dlm_worker, &dlm->dispatched_work); |
2368 | return 0; | 2368 | return DLM_DEREF_RESPONSE_INPROG; |
2369 | 2369 | ||
2370 | done: | 2370 | done: |
2371 | if (res) | 2371 | if (res) |
@@ -2375,6 +2375,122 @@ done: | |||
2375 | return ret; | 2375 | return ret; |
2376 | } | 2376 | } |
2377 | 2377 | ||
2378 | int dlm_deref_lockres_done_handler(struct o2net_msg *msg, u32 len, void *data, | ||
2379 | void **ret_data) | ||
2380 | { | ||
2381 | struct dlm_ctxt *dlm = data; | ||
2382 | struct dlm_deref_lockres_done *deref | ||
2383 | = (struct dlm_deref_lockres_done *)msg->buf; | ||
2384 | struct dlm_lock_resource *res = NULL; | ||
2385 | char *name; | ||
2386 | unsigned int namelen; | ||
2387 | int ret = -EINVAL; | ||
2388 | u8 node; | ||
2389 | unsigned int hash; | ||
2390 | |||
2391 | if (!dlm_grab(dlm)) | ||
2392 | return 0; | ||
2393 | |||
2394 | name = deref->name; | ||
2395 | namelen = deref->namelen; | ||
2396 | node = deref->node_idx; | ||
2397 | |||
2398 | if (namelen > DLM_LOCKID_NAME_MAX) { | ||
2399 | mlog(ML_ERROR, "Invalid name length!"); | ||
2400 | goto done; | ||
2401 | } | ||
2402 | if (deref->node_idx >= O2NM_MAX_NODES) { | ||
2403 | mlog(ML_ERROR, "Invalid node number: %u\n", node); | ||
2404 | goto done; | ||
2405 | } | ||
2406 | |||
2407 | hash = dlm_lockid_hash(name, namelen); | ||
2408 | |||
2409 | spin_lock(&dlm->spinlock); | ||
2410 | res = __dlm_lookup_lockres_full(dlm, name, namelen, hash); | ||
2411 | if (!res) { | ||
2412 | spin_unlock(&dlm->spinlock); | ||
2413 | mlog(ML_ERROR, "%s:%.*s: bad lockres name\n", | ||
2414 | dlm->name, namelen, name); | ||
2415 | goto done; | ||
2416 | } | ||
2417 | |||
2418 | spin_lock(&res->spinlock); | ||
2419 | BUG_ON(!(res->state & DLM_LOCK_RES_DROPPING_REF)); | ||
2420 | if (!list_empty(&res->purge)) { | ||
2421 | mlog(0, "%s: Removing res %.*s from purgelist\n", | ||
2422 | dlm->name, res->lockname.len, res->lockname.name); | ||
2423 | list_del_init(&res->purge); | ||
2424 | dlm_lockres_put(res); | ||
2425 | dlm->purge_count--; | ||
2426 | } | ||
2427 | |||
2428 | if (!__dlm_lockres_unused(res)) { | ||
2429 | mlog(ML_ERROR, "%s: res %.*s in use after deref\n", | ||
2430 | dlm->name, res->lockname.len, res->lockname.name); | ||
2431 | __dlm_print_one_lock_resource(res); | ||
2432 | BUG(); | ||
2433 | } | ||
2434 | |||
2435 | __dlm_unhash_lockres(dlm, res); | ||
2436 | |||
2437 | spin_lock(&dlm->track_lock); | ||
2438 | if (!list_empty(&res->tracking)) | ||
2439 | list_del_init(&res->tracking); | ||
2440 | else { | ||
2441 | mlog(ML_ERROR, "%s: Resource %.*s not on the Tracking list\n", | ||
2442 | dlm->name, res->lockname.len, res->lockname.name); | ||
2443 | __dlm_print_one_lock_resource(res); | ||
2444 | } | ||
2445 | spin_unlock(&dlm->track_lock); | ||
2446 | |||
2447 | /* lockres is not in the hash now. drop the flag and wake up | ||
2448 | * any processes waiting in dlm_get_lock_resource. | ||
2449 | */ | ||
2450 | res->state &= ~DLM_LOCK_RES_DROPPING_REF; | ||
2451 | spin_unlock(&res->spinlock); | ||
2452 | wake_up(&res->wq); | ||
2453 | |||
2454 | dlm_lockres_put(res); | ||
2455 | |||
2456 | spin_unlock(&dlm->spinlock); | ||
2457 | |||
2458 | done: | ||
2459 | dlm_put(dlm); | ||
2460 | return ret; | ||
2461 | } | ||
2462 | |||
2463 | static void dlm_drop_lockres_ref_done(struct dlm_ctxt *dlm, | ||
2464 | struct dlm_lock_resource *res, u8 node) | ||
2465 | { | ||
2466 | struct dlm_deref_lockres_done deref; | ||
2467 | int ret = 0, r; | ||
2468 | const char *lockname; | ||
2469 | unsigned int namelen; | ||
2470 | |||
2471 | lockname = res->lockname.name; | ||
2472 | namelen = res->lockname.len; | ||
2473 | BUG_ON(namelen > O2NM_MAX_NAME_LEN); | ||
2474 | |||
2475 | memset(&deref, 0, sizeof(deref)); | ||
2476 | deref.node_idx = dlm->node_num; | ||
2477 | deref.namelen = namelen; | ||
2478 | memcpy(deref.name, lockname, namelen); | ||
2479 | |||
2480 | ret = o2net_send_message(DLM_DEREF_LOCKRES_DONE, dlm->key, | ||
2481 | &deref, sizeof(deref), node, &r); | ||
2482 | if (ret < 0) { | ||
2483 | mlog(ML_ERROR, "%s: res %.*s, error %d send DEREF DONE " | ||
2484 | " to node %u\n", dlm->name, namelen, | ||
2485 | lockname, ret, node); | ||
2486 | } else if (r < 0) { | ||
2487 | /* ignore the error */ | ||
2488 | mlog(ML_ERROR, "%s: res %.*s, DEREF to node %u got %d\n", | ||
2489 | dlm->name, namelen, lockname, node, r); | ||
2490 | dlm_print_one_lock_resource(res); | ||
2491 | } | ||
2492 | } | ||
2493 | |||
2378 | static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data) | 2494 | static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data) |
2379 | { | 2495 | { |
2380 | struct dlm_ctxt *dlm; | 2496 | struct dlm_ctxt *dlm; |
@@ -2395,6 +2511,8 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data) | |||
2395 | } | 2511 | } |
2396 | spin_unlock(&res->spinlock); | 2512 | spin_unlock(&res->spinlock); |
2397 | 2513 | ||
2514 | dlm_drop_lockres_ref_done(dlm, res, node); | ||
2515 | |||
2398 | if (cleared) { | 2516 | if (cleared) { |
2399 | mlog(0, "%s:%.*s node %u ref dropped in dispatch\n", | 2517 | mlog(0, "%s:%.*s node %u ref dropped in dispatch\n", |
2400 | dlm->name, res->lockname.len, res->lockname.name, node); | 2518 | dlm->name, res->lockname.len, res->lockname.name, node); |
@@ -2432,7 +2550,8 @@ static int dlm_is_lockres_migrateable(struct dlm_ctxt *dlm, | |||
2432 | return 0; | 2550 | return 0; |
2433 | 2551 | ||
2434 | /* delay migration when the lockres is in RECOCERING state */ | 2552 | /* delay migration when the lockres is in RECOCERING state */ |
2435 | if (res->state & DLM_LOCK_RES_RECOVERING) | 2553 | if (res->state & (DLM_LOCK_RES_RECOVERING| |
2554 | DLM_LOCK_RES_RECOVERY_WAITING)) | ||
2436 | return 0; | 2555 | return 0; |
2437 | 2556 | ||
2438 | if (res->owner != dlm->node_num) | 2557 | if (res->owner != dlm->node_num) |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index b94a425f0175..cd38488a10fc 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -1403,12 +1403,24 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data, | |||
1403 | * and RECOVERY flag changed when it completes. */ | 1403 | * and RECOVERY flag changed when it completes. */ |
1404 | hash = dlm_lockid_hash(mres->lockname, mres->lockname_len); | 1404 | hash = dlm_lockid_hash(mres->lockname, mres->lockname_len); |
1405 | spin_lock(&dlm->spinlock); | 1405 | spin_lock(&dlm->spinlock); |
1406 | res = __dlm_lookup_lockres(dlm, mres->lockname, mres->lockname_len, | 1406 | res = __dlm_lookup_lockres_full(dlm, mres->lockname, mres->lockname_len, |
1407 | hash); | 1407 | hash); |
1408 | if (res) { | 1408 | if (res) { |
1409 | /* this will get a ref on res */ | 1409 | /* this will get a ref on res */ |
1410 | /* mark it as recovering/migrating and hash it */ | 1410 | /* mark it as recovering/migrating and hash it */ |
1411 | spin_lock(&res->spinlock); | 1411 | spin_lock(&res->spinlock); |
1412 | if (res->state & DLM_LOCK_RES_DROPPING_REF) { | ||
1413 | mlog(0, "%s: node is attempting to migrate " | ||
1414 | "lockres %.*s, but marked as dropping " | ||
1415 | " ref!\n", dlm->name, | ||
1416 | mres->lockname_len, mres->lockname); | ||
1417 | ret = -EINVAL; | ||
1418 | spin_unlock(&res->spinlock); | ||
1419 | spin_unlock(&dlm->spinlock); | ||
1420 | dlm_lockres_put(res); | ||
1421 | goto leave; | ||
1422 | } | ||
1423 | |||
1412 | if (mres->flags & DLM_MRES_RECOVERY) { | 1424 | if (mres->flags & DLM_MRES_RECOVERY) { |
1413 | res->state |= DLM_LOCK_RES_RECOVERING; | 1425 | res->state |= DLM_LOCK_RES_RECOVERING; |
1414 | } else { | 1426 | } else { |
@@ -2163,6 +2175,13 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm, | |||
2163 | for (i = 0; i < DLM_HASH_BUCKETS; i++) { | 2175 | for (i = 0; i < DLM_HASH_BUCKETS; i++) { |
2164 | bucket = dlm_lockres_hash(dlm, i); | 2176 | bucket = dlm_lockres_hash(dlm, i); |
2165 | hlist_for_each_entry(res, bucket, hash_node) { | 2177 | hlist_for_each_entry(res, bucket, hash_node) { |
2178 | if (res->state & DLM_LOCK_RES_RECOVERY_WAITING) { | ||
2179 | spin_lock(&res->spinlock); | ||
2180 | res->state &= ~DLM_LOCK_RES_RECOVERY_WAITING; | ||
2181 | spin_unlock(&res->spinlock); | ||
2182 | wake_up(&res->wq); | ||
2183 | } | ||
2184 | |||
2166 | if (!(res->state & DLM_LOCK_RES_RECOVERING)) | 2185 | if (!(res->state & DLM_LOCK_RES_RECOVERING)) |
2167 | continue; | 2186 | continue; |
2168 | 2187 | ||
@@ -2300,6 +2319,7 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm, | |||
2300 | res->lockname.len, res->lockname.name, freed, dead_node); | 2319 | res->lockname.len, res->lockname.name, freed, dead_node); |
2301 | __dlm_print_one_lock_resource(res); | 2320 | __dlm_print_one_lock_resource(res); |
2302 | } | 2321 | } |
2322 | res->state |= DLM_LOCK_RES_RECOVERY_WAITING; | ||
2303 | dlm_lockres_clear_refmap_bit(dlm, res, dead_node); | 2323 | dlm_lockres_clear_refmap_bit(dlm, res, dead_node); |
2304 | } else if (test_bit(dead_node, res->refmap)) { | 2324 | } else if (test_bit(dead_node, res->refmap)) { |
2305 | mlog(0, "%s:%.*s: dead node %u had a ref, but had " | 2325 | mlog(0, "%s:%.*s: dead node %u had a ref, but had " |
@@ -2377,14 +2397,16 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node) | |||
2377 | dlm_revalidate_lvb(dlm, res, dead_node); | 2397 | dlm_revalidate_lvb(dlm, res, dead_node); |
2378 | if (res->owner == dead_node) { | 2398 | if (res->owner == dead_node) { |
2379 | if (res->state & DLM_LOCK_RES_DROPPING_REF) { | 2399 | if (res->state & DLM_LOCK_RES_DROPPING_REF) { |
2380 | mlog(ML_NOTICE, "%s: res %.*s, Skip " | 2400 | mlog(0, "%s:%.*s: owned by " |
2381 | "recovery as it is being freed\n", | 2401 | "dead node %u, this node was " |
2382 | dlm->name, res->lockname.len, | 2402 | "dropping its ref when it died. " |
2383 | res->lockname.name); | 2403 | "continue, dropping the flag.\n", |
2384 | } else | 2404 | dlm->name, res->lockname.len, |
2385 | dlm_move_lockres_to_recovery_list(dlm, | 2405 | res->lockname.name, dead_node); |
2386 | res); | 2406 | } |
2387 | 2407 | res->state &= ~DLM_LOCK_RES_DROPPING_REF; | |
2408 | dlm_move_lockres_to_recovery_list(dlm, | ||
2409 | res); | ||
2388 | } else if (res->owner == dlm->node_num) { | 2410 | } else if (res->owner == dlm->node_num) { |
2389 | dlm_free_dead_locks(dlm, res, dead_node); | 2411 | dlm_free_dead_locks(dlm, res, dead_node); |
2390 | __dlm_lockres_calc_usage(dlm, res); | 2412 | __dlm_lockres_calc_usage(dlm, res); |
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c index c5f6c241ecd7..68d239ba0c63 100644 --- a/fs/ocfs2/dlm/dlmthread.c +++ b/fs/ocfs2/dlm/dlmthread.c | |||
@@ -106,7 +106,8 @@ int __dlm_lockres_unused(struct dlm_lock_resource *res) | |||
106 | if (!list_empty(&res->dirty) || res->state & DLM_LOCK_RES_DIRTY) | 106 | if (!list_empty(&res->dirty) || res->state & DLM_LOCK_RES_DIRTY) |
107 | return 0; | 107 | return 0; |
108 | 108 | ||
109 | if (res->state & DLM_LOCK_RES_RECOVERING) | 109 | if (res->state & (DLM_LOCK_RES_RECOVERING| |
110 | DLM_LOCK_RES_RECOVERY_WAITING)) | ||
110 | return 0; | 111 | return 0; |
111 | 112 | ||
112 | /* Another node has this resource with this node as the master */ | 113 | /* Another node has this resource with this node as the master */ |
@@ -202,6 +203,13 @@ static void dlm_purge_lockres(struct dlm_ctxt *dlm, | |||
202 | dlm->purge_count--; | 203 | dlm->purge_count--; |
203 | } | 204 | } |
204 | 205 | ||
206 | if (!master && ret != 0) { | ||
207 | mlog(0, "%s: deref %.*s in progress or master goes down\n", | ||
208 | dlm->name, res->lockname.len, res->lockname.name); | ||
209 | spin_unlock(&res->spinlock); | ||
210 | return; | ||
211 | } | ||
212 | |||
205 | if (!__dlm_lockres_unused(res)) { | 213 | if (!__dlm_lockres_unused(res)) { |
206 | mlog(ML_ERROR, "%s: res %.*s in use after deref\n", | 214 | mlog(ML_ERROR, "%s: res %.*s in use after deref\n", |
207 | dlm->name, res->lockname.len, res->lockname.name); | 215 | dlm->name, res->lockname.len, res->lockname.name); |
@@ -700,7 +708,8 @@ static int dlm_thread(void *data) | |||
700 | * dirty for a short while. */ | 708 | * dirty for a short while. */ |
701 | BUG_ON(res->state & DLM_LOCK_RES_MIGRATING); | 709 | BUG_ON(res->state & DLM_LOCK_RES_MIGRATING); |
702 | if (res->state & (DLM_LOCK_RES_IN_PROGRESS | | 710 | if (res->state & (DLM_LOCK_RES_IN_PROGRESS | |
703 | DLM_LOCK_RES_RECOVERING)) { | 711 | DLM_LOCK_RES_RECOVERING | |
712 | DLM_LOCK_RES_RECOVERY_WAITING)) { | ||
704 | /* move it to the tail and keep going */ | 713 | /* move it to the tail and keep going */ |
705 | res->state &= ~DLM_LOCK_RES_DIRTY; | 714 | res->state &= ~DLM_LOCK_RES_DIRTY; |
706 | spin_unlock(&res->spinlock); | 715 | spin_unlock(&res->spinlock); |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index faa1365097bc..302854ee0985 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -236,6 +236,7 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len) | |||
236 | struct ocfs2_recovery_map *rm = osb->recovery_map; | 236 | struct ocfs2_recovery_map *rm = osb->recovery_map; |
237 | struct ocfs2_orphan_scan *os = &osb->osb_orphan_scan; | 237 | struct ocfs2_orphan_scan *os = &osb->osb_orphan_scan; |
238 | int i, out = 0; | 238 | int i, out = 0; |
239 | unsigned long flags; | ||
239 | 240 | ||
240 | out += snprintf(buf + out, len - out, | 241 | out += snprintf(buf + out, len - out, |
241 | "%10s => Id: %-s Uuid: %-s Gen: 0x%X Label: %-s\n", | 242 | "%10s => Id: %-s Uuid: %-s Gen: 0x%X Label: %-s\n", |
@@ -271,14 +272,14 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len) | |||
271 | cconn->cc_version.pv_minor); | 272 | cconn->cc_version.pv_minor); |
272 | } | 273 | } |
273 | 274 | ||
274 | spin_lock(&osb->dc_task_lock); | 275 | spin_lock_irqsave(&osb->dc_task_lock, flags); |
275 | out += snprintf(buf + out, len - out, | 276 | out += snprintf(buf + out, len - out, |
276 | "%10s => Pid: %d Count: %lu WakeSeq: %lu " | 277 | "%10s => Pid: %d Count: %lu WakeSeq: %lu " |
277 | "WorkSeq: %lu\n", "DownCnvt", | 278 | "WorkSeq: %lu\n", "DownCnvt", |
278 | (osb->dc_task ? task_pid_nr(osb->dc_task) : -1), | 279 | (osb->dc_task ? task_pid_nr(osb->dc_task) : -1), |
279 | osb->blocked_lock_count, osb->dc_wake_sequence, | 280 | osb->blocked_lock_count, osb->dc_wake_sequence, |
280 | osb->dc_work_sequence); | 281 | osb->dc_work_sequence); |
281 | spin_unlock(&osb->dc_task_lock); | 282 | spin_unlock_irqrestore(&osb->dc_task_lock, flags); |
282 | 283 | ||
283 | spin_lock(&osb->osb_lock); | 284 | spin_lock(&osb->osb_lock); |
284 | out += snprintf(buf + out, len - out, "%10s => Pid: %d Nodes:", | 285 | out += snprintf(buf + out, len - out, "%10s => Pid: %d Nodes:", |
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index a9ebabfe7587..5c57b7b40728 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -1957,7 +1957,6 @@ xfs_vm_set_page_dirty( | |||
1957 | loff_t end_offset; | 1957 | loff_t end_offset; |
1958 | loff_t offset; | 1958 | loff_t offset; |
1959 | int newly_dirty; | 1959 | int newly_dirty; |
1960 | struct mem_cgroup *memcg; | ||
1961 | 1960 | ||
1962 | if (unlikely(!mapping)) | 1961 | if (unlikely(!mapping)) |
1963 | return !TestSetPageDirty(page); | 1962 | return !TestSetPageDirty(page); |
@@ -1978,10 +1977,10 @@ xfs_vm_set_page_dirty( | |||
1978 | } while (bh != head); | 1977 | } while (bh != head); |
1979 | } | 1978 | } |
1980 | /* | 1979 | /* |
1981 | * Use mem_group_begin_page_stat() to keep PageDirty synchronized with | 1980 | * Lock out page->mem_cgroup migration to keep PageDirty |
1982 | * per-memcg dirty page counters. | 1981 | * synchronized with per-memcg dirty page counters. |
1983 | */ | 1982 | */ |
1984 | memcg = mem_cgroup_begin_page_stat(page); | 1983 | lock_page_memcg(page); |
1985 | newly_dirty = !TestSetPageDirty(page); | 1984 | newly_dirty = !TestSetPageDirty(page); |
1986 | spin_unlock(&mapping->private_lock); | 1985 | spin_unlock(&mapping->private_lock); |
1987 | 1986 | ||
@@ -1992,13 +1991,13 @@ xfs_vm_set_page_dirty( | |||
1992 | spin_lock_irqsave(&mapping->tree_lock, flags); | 1991 | spin_lock_irqsave(&mapping->tree_lock, flags); |
1993 | if (page->mapping) { /* Race with truncate? */ | 1992 | if (page->mapping) { /* Race with truncate? */ |
1994 | WARN_ON_ONCE(!PageUptodate(page)); | 1993 | WARN_ON_ONCE(!PageUptodate(page)); |
1995 | account_page_dirtied(page, mapping, memcg); | 1994 | account_page_dirtied(page, mapping); |
1996 | radix_tree_tag_set(&mapping->page_tree, | 1995 | radix_tree_tag_set(&mapping->page_tree, |
1997 | page_index(page), PAGECACHE_TAG_DIRTY); | 1996 | page_index(page), PAGECACHE_TAG_DIRTY); |
1998 | } | 1997 | } |
1999 | spin_unlock_irqrestore(&mapping->tree_lock, flags); | 1998 | spin_unlock_irqrestore(&mapping->tree_lock, flags); |
2000 | } | 1999 | } |
2001 | mem_cgroup_end_page_stat(memcg); | 2000 | unlock_page_memcg(page); |
2002 | if (newly_dirty) | 2001 | if (newly_dirty) |
2003 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | 2002 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); |
2004 | return newly_dirty; | 2003 | return newly_dirty; |