Commit 30d7030b authored by Linus Torvalds's avatar Linus Torvalds

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
parents 76f5e9f8 b0841eef
...@@ -20,6 +20,15 @@ ...@@ -20,6 +20,15 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
struct configfs_fragment {
atomic_t frag_count;
struct rw_semaphore frag_sem;
bool frag_dead;
};
void put_fragment(struct configfs_fragment *);
struct configfs_fragment *get_fragment(struct configfs_fragment *);
struct configfs_dirent { struct configfs_dirent {
atomic_t s_count; atomic_t s_count;
int s_dependent_count; int s_dependent_count;
...@@ -34,6 +43,7 @@ struct configfs_dirent { ...@@ -34,6 +43,7 @@ struct configfs_dirent {
#ifdef CONFIG_LOCKDEP #ifdef CONFIG_LOCKDEP
int s_depth; int s_depth;
#endif #endif
struct configfs_fragment *s_frag;
}; };
#define CONFIGFS_ROOT 0x0001 #define CONFIGFS_ROOT 0x0001
...@@ -61,8 +71,8 @@ extern int configfs_create(struct dentry *, umode_t mode, void (*init)(struct in ...@@ -61,8 +71,8 @@ extern int configfs_create(struct dentry *, umode_t mode, void (*init)(struct in
extern int configfs_create_file(struct config_item *, const struct configfs_attribute *); extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
extern int configfs_create_bin_file(struct config_item *, extern int configfs_create_bin_file(struct config_item *,
const struct configfs_bin_attribute *); const struct configfs_bin_attribute *);
extern int configfs_make_dirent(struct configfs_dirent *, extern int configfs_make_dirent(struct configfs_dirent *, struct dentry *,
struct dentry *, void *, umode_t, int); void *, umode_t, int, struct configfs_fragment *);
extern int configfs_dirent_is_ready(struct configfs_dirent *); extern int configfs_dirent_is_ready(struct configfs_dirent *);
extern void configfs_hash_and_remove(struct dentry * dir, const char * name); 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) ...@@ -137,6 +147,7 @@ static inline void release_configfs_dirent(struct configfs_dirent * sd)
{ {
if (!(sd->s_type & CONFIGFS_ROOT)) { if (!(sd->s_type & CONFIGFS_ROOT)) {
kfree(sd->s_iattr); kfree(sd->s_iattr);
put_fragment(sd->s_frag);
kmem_cache_free(configfs_dir_cachep, sd); kmem_cache_free(configfs_dir_cachep, sd);
} }
} }
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment