diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-11 10:57:27 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-01-25 23:17:28 -0500 |
commit | fdab684d7202774bfd8762d4a656a553b787c8ec (patch) | |
tree | 8ddb298648037f9abd37bc3b263e53695ceb9ce2 | |
parent | 3b994d98a815d934ab6a77a380882865982c14f9 (diff) |
allow attaching fs_pin to a group not associated with some superblock
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/fs_pin.c | 20 | ||||
-rw-r--r-- | fs/internal.h | 2 | ||||
-rw-r--r-- | fs/super.c | 4 | ||||
-rw-r--r-- | include/linux/fs_pin.h | 1 |
4 files changed, 17 insertions, 10 deletions
diff --git a/fs/fs_pin.c b/fs/fs_pin.c index 5eb39a93a560..50ef7d2ef03c 100644 --- a/fs/fs_pin.c +++ b/fs/fs_pin.c | |||
@@ -14,14 +14,20 @@ void pin_remove(struct fs_pin *pin) | |||
14 | spin_unlock(&pin_lock); | 14 | spin_unlock(&pin_lock); |
15 | } | 15 | } |
16 | 16 | ||
17 | void pin_insert(struct fs_pin *pin, struct vfsmount *m) | 17 | void pin_insert_group(struct fs_pin *pin, struct vfsmount *m, struct hlist_head *p) |
18 | { | 18 | { |
19 | spin_lock(&pin_lock); | 19 | spin_lock(&pin_lock); |
20 | hlist_add_head(&pin->s_list, &m->mnt_sb->s_pins); | 20 | if (p) |
21 | hlist_add_head(&pin->s_list, p); | ||
21 | hlist_add_head(&pin->m_list, &real_mount(m)->mnt_pins); | 22 | hlist_add_head(&pin->m_list, &real_mount(m)->mnt_pins); |
22 | spin_unlock(&pin_lock); | 23 | spin_unlock(&pin_lock); |
23 | } | 24 | } |
24 | 25 | ||
26 | void pin_insert(struct fs_pin *pin, struct vfsmount *m) | ||
27 | { | ||
28 | pin_insert_group(pin, m, &m->mnt_sb->s_pins); | ||
29 | } | ||
30 | |||
25 | void mnt_pin_kill(struct mount *m) | 31 | void mnt_pin_kill(struct mount *m) |
26 | { | 32 | { |
27 | while (1) { | 33 | while (1) { |
@@ -38,18 +44,18 @@ void mnt_pin_kill(struct mount *m) | |||
38 | } | 44 | } |
39 | } | 45 | } |
40 | 46 | ||
41 | void sb_pin_kill(struct super_block *sb) | 47 | void group_pin_kill(struct hlist_head *p) |
42 | { | 48 | { |
43 | while (1) { | 49 | while (1) { |
44 | struct hlist_node *p; | 50 | struct hlist_node *q; |
45 | struct fs_pin *pin; | 51 | struct fs_pin *pin; |
46 | rcu_read_lock(); | 52 | rcu_read_lock(); |
47 | p = ACCESS_ONCE(sb->s_pins.first); | 53 | q = ACCESS_ONCE(p->first); |
48 | if (!p) { | 54 | if (!q) { |
49 | rcu_read_unlock(); | 55 | rcu_read_unlock(); |
50 | break; | 56 | break; |
51 | } | 57 | } |
52 | pin = hlist_entry(p, struct fs_pin, s_list); | 58 | pin = hlist_entry(q, struct fs_pin, s_list); |
53 | pin->kill(pin); | 59 | pin->kill(pin); |
54 | } | 60 | } |
55 | } | 61 | } |
diff --git a/fs/internal.h b/fs/internal.h index e9a61fe67575..a6efd2f09ba3 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -145,7 +145,7 @@ extern const struct file_operations pipefifo_fops; | |||
145 | /* | 145 | /* |
146 | * fs_pin.c | 146 | * fs_pin.c |
147 | */ | 147 | */ |
148 | extern void sb_pin_kill(struct super_block *sb); | 148 | extern void group_pin_kill(struct hlist_head *p); |
149 | extern void mnt_pin_kill(struct mount *m); | 149 | extern void mnt_pin_kill(struct mount *m); |
150 | 150 | ||
151 | /* | 151 | /* |
diff --git a/fs/super.c b/fs/super.c index eae088f6aaae..2d822459bc3d 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -706,9 +706,9 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) | |||
706 | remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); | 706 | remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); |
707 | 707 | ||
708 | if (remount_ro) { | 708 | if (remount_ro) { |
709 | if (sb->s_pins.first) { | 709 | if (!hlist_empty(&sb->s_pins)) { |
710 | up_write(&sb->s_umount); | 710 | up_write(&sb->s_umount); |
711 | sb_pin_kill(sb); | 711 | group_pin_kill(&sb->s_pins); |
712 | down_write(&sb->s_umount); | 712 | down_write(&sb->s_umount); |
713 | if (!sb->s_root) | 713 | if (!sb->s_root) |
714 | return 0; | 714 | return 0; |
diff --git a/include/linux/fs_pin.h b/include/linux/fs_pin.h index a2e71912e758..2be38d1464ae 100644 --- a/include/linux/fs_pin.h +++ b/include/linux/fs_pin.h | |||
@@ -7,4 +7,5 @@ struct fs_pin { | |||
7 | }; | 7 | }; |
8 | 8 | ||
9 | void pin_remove(struct fs_pin *); | 9 | void pin_remove(struct fs_pin *); |
10 | void pin_insert_group(struct fs_pin *, struct vfsmount *, struct hlist_head *); | ||
10 | void pin_insert(struct fs_pin *, struct vfsmount *); | 11 | void pin_insert(struct fs_pin *, struct vfsmount *); |