Commit f3ad1165 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/configfs

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/configfs:
  configfs: Rework configfs_depend_item() locking and make lockdep happy
  configfs: Silence lockdep on mkdir() and rmdir()
parents d645727b 420118ca
...@@ -39,6 +39,9 @@ struct configfs_dirent { ...@@ -39,6 +39,9 @@ struct configfs_dirent {
umode_t s_mode; umode_t s_mode;
struct dentry * s_dentry; struct dentry * s_dentry;
struct iattr * s_iattr; struct iattr * s_iattr;
#ifdef CONFIG_LOCKDEP
int s_depth;
#endif
}; };
#define CONFIGFS_ROOT 0x0001 #define CONFIGFS_ROOT 0x0001
......
This diff is collapsed.
...@@ -33,10 +33,15 @@ ...@@ -33,10 +33,15 @@
#include <linux/backing-dev.h> #include <linux/backing-dev.h>
#include <linux/capability.h> #include <linux/capability.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/lockdep.h>
#include <linux/configfs.h> #include <linux/configfs.h>
#include "configfs_internal.h" #include "configfs_internal.h"
#ifdef CONFIG_LOCKDEP
static struct lock_class_key default_group_class[MAX_LOCK_DEPTH];
#endif
extern struct super_block * configfs_sb; extern struct super_block * configfs_sb;
static const struct address_space_operations configfs_aops = { static const struct address_space_operations configfs_aops = {
...@@ -150,6 +155,38 @@ struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent * sd) ...@@ -150,6 +155,38 @@ struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent * sd)
return inode; return inode;
} }
#ifdef CONFIG_LOCKDEP
static void configfs_set_inode_lock_class(struct configfs_dirent *sd,
struct inode *inode)
{
int depth = sd->s_depth;
if (depth > 0) {
if (depth <= ARRAY_SIZE(default_group_class)) {
lockdep_set_class(&inode->i_mutex,
&default_group_class[depth - 1]);
} else {
/*
* In practice the maximum level of locking depth is
* already reached. Just inform about possible reasons.
*/
printk(KERN_INFO "configfs: Too many levels of inodes"
" for the locking correctness validator.\n");
printk(KERN_INFO "Spurious warnings may appear.\n");
}
}
}
#else /* CONFIG_LOCKDEP */
static void configfs_set_inode_lock_class(struct configfs_dirent *sd,
struct inode *inode)
{
}
#endif /* CONFIG_LOCKDEP */
int configfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *)) int configfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *))
{ {
int error = 0; int error = 0;
...@@ -162,6 +199,7 @@ int configfs_create(struct dentry * dentry, int mode, int (*init)(struct inode * ...@@ -162,6 +199,7 @@ int configfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *
struct inode *p_inode = dentry->d_parent->d_inode; struct inode *p_inode = dentry->d_parent->d_inode;
p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME;
} }
configfs_set_inode_lock_class(sd, inode);
goto Proceed; goto Proceed;
} }
else else
......
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