Skip to content

Commit 30d7030

Browse files
committed
Merge tag 'configfs-for-5.3' of git://git.infradead.org/users/hch/configfs
Pull configfs fixes from Christoph Hellwig: "Late configfs fixes from Al that fix pretty nasty removal vs attribute access races" * tag 'configfs-for-5.3' of git://git.infradead.org/users/hch/configfs: configfs: provide exclusion between IO and removals configfs: new object reprsenting tree fragments configfs_register_group() shouldn't be (and isn't) called in rmdirable parts configfs: stash the data we need into configfs_buffer at open time
2 parents 76f5e9f + b0841ee commit 30d7030

File tree

3 files changed

+257
-175
lines changed

3 files changed

+257
-175
lines changed

fs/configfs/configfs_internal.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
#include <linux/list.h>
2121
#include <linux/spinlock.h>
2222

23+
struct configfs_fragment {
24+
atomic_t frag_count;
25+
struct rw_semaphore frag_sem;
26+
bool frag_dead;
27+
};
28+
29+
void put_fragment(struct configfs_fragment *);
30+
struct configfs_fragment *get_fragment(struct configfs_fragment *);
31+
2332
struct configfs_dirent {
2433
atomic_t s_count;
2534
int s_dependent_count;
@@ -34,6 +43,7 @@ struct configfs_dirent {
3443
#ifdef CONFIG_LOCKDEP
3544
int s_depth;
3645
#endif
46+
struct configfs_fragment *s_frag;
3747
};
3848

3949
#define CONFIGFS_ROOT 0x0001
@@ -61,8 +71,8 @@ extern int configfs_create(struct dentry *, umode_t mode, void (*init)(struct in
6171
extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
6272
extern int configfs_create_bin_file(struct config_item *,
6373
const struct configfs_bin_attribute *);
64-
extern int configfs_make_dirent(struct configfs_dirent *,
65-
struct dentry *, void *, umode_t, int);
74+
extern int configfs_make_dirent(struct configfs_dirent *, struct dentry *,
75+
void *, umode_t, int, struct configfs_fragment *);
6676
extern int configfs_dirent_is_ready(struct configfs_dirent *);
6777

6878
extern void configfs_hash_and_remove(struct dentry * dir, const char * name);
@@ -137,6 +147,7 @@ static inline void release_configfs_dirent(struct configfs_dirent * sd)
137147
{
138148
if (!(sd->s_type & CONFIGFS_ROOT)) {
139149
kfree(sd->s_iattr);
150+
put_fragment(sd->s_frag);
140151
kmem_cache_free(configfs_dir_cachep, sd);
141152
}
142153
}

0 commit comments

Comments
 (0)