diff options
Diffstat (limited to 'fs/kernfs')
-rw-r--r-- | fs/kernfs/dir.c | 12 | ||||
-rw-r--r-- | fs/kernfs/mount.c | 8 |
2 files changed, 15 insertions, 5 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 5104cf5d25c5..bd6e18be6e1a 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -187,19 +187,23 @@ static void kernfs_deactivate(struct kernfs_node *kn) | |||
187 | 187 | ||
188 | kn->u.completion = (void *)&wait; | 188 | kn->u.completion = (void *)&wait; |
189 | 189 | ||
190 | rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_); | 190 | if (kn->flags & KERNFS_LOCKDEP) |
191 | rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_); | ||
191 | /* atomic_add_return() is a mb(), put_active() will always see | 192 | /* atomic_add_return() is a mb(), put_active() will always see |
192 | * the updated kn->u.completion. | 193 | * the updated kn->u.completion. |
193 | */ | 194 | */ |
194 | v = atomic_add_return(KN_DEACTIVATED_BIAS, &kn->active); | 195 | v = atomic_add_return(KN_DEACTIVATED_BIAS, &kn->active); |
195 | 196 | ||
196 | if (v != KN_DEACTIVATED_BIAS) { | 197 | if (v != KN_DEACTIVATED_BIAS) { |
197 | lock_contended(&kn->dep_map, _RET_IP_); | 198 | if (kn->flags & KERNFS_LOCKDEP) |
199 | lock_contended(&kn->dep_map, _RET_IP_); | ||
198 | wait_for_completion(&wait); | 200 | wait_for_completion(&wait); |
199 | } | 201 | } |
200 | 202 | ||
201 | lock_acquired(&kn->dep_map, _RET_IP_); | 203 | if (kn->flags & KERNFS_LOCKDEP) { |
202 | rwsem_release(&kn->dep_map, 1, _RET_IP_); | 204 | lock_acquired(&kn->dep_map, _RET_IP_); |
205 | rwsem_release(&kn->dep_map, 1, _RET_IP_); | ||
206 | } | ||
203 | } | 207 | } |
204 | 208 | ||
205 | /** | 209 | /** |
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index 0d6ce895a9ee..0f4152defe7b 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c | |||
@@ -94,6 +94,7 @@ const void *kernfs_super_ns(struct super_block *sb) | |||
94 | * @fs_type: file_system_type of the fs being mounted | 94 | * @fs_type: file_system_type of the fs being mounted |
95 | * @flags: mount flags specified for the mount | 95 | * @flags: mount flags specified for the mount |
96 | * @root: kernfs_root of the hierarchy being mounted | 96 | * @root: kernfs_root of the hierarchy being mounted |
97 | * @new_sb_created: tell the caller if we allocated a new superblock | ||
97 | * @ns: optional namespace tag of the mount | 98 | * @ns: optional namespace tag of the mount |
98 | * | 99 | * |
99 | * This is to be called from each kernfs user's file_system_type->mount() | 100 | * This is to be called from each kernfs user's file_system_type->mount() |
@@ -104,7 +105,8 @@ const void *kernfs_super_ns(struct super_block *sb) | |||
104 | * The return value can be passed to the vfs layer verbatim. | 105 | * The return value can be passed to the vfs layer verbatim. |
105 | */ | 106 | */ |
106 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | 107 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
107 | struct kernfs_root *root, const void *ns) | 108 | struct kernfs_root *root, bool *new_sb_created, |
109 | const void *ns) | ||
108 | { | 110 | { |
109 | struct super_block *sb; | 111 | struct super_block *sb; |
110 | struct kernfs_super_info *info; | 112 | struct kernfs_super_info *info; |
@@ -122,6 +124,10 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | |||
122 | kfree(info); | 124 | kfree(info); |
123 | if (IS_ERR(sb)) | 125 | if (IS_ERR(sb)) |
124 | return ERR_CAST(sb); | 126 | return ERR_CAST(sb); |
127 | |||
128 | if (new_sb_created) | ||
129 | *new_sb_created = !sb->s_root; | ||
130 | |||
125 | if (!sb->s_root) { | 131 | if (!sb->s_root) { |
126 | error = kernfs_fill_super(sb); | 132 | error = kernfs_fill_super(sb); |
127 | if (error) { | 133 | if (error) { |