Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154082
b: refs/heads/master
c: 9a7aa12
h: refs/heads/master
v: v3
  • Loading branch information
Jan Kara authored and Joel Becker committed Jun 22, 2009
1 parent 0043d83 commit bb94c9f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: df152c241df9e9d2b9a65d37bd02961abe7f591a
refs/heads/master: 9a7aa12f3911853a3574d47d567b81a2a5df7208
17 changes: 11 additions & 6 deletions trunk/fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,17 @@ void unlock_new_inode(struct inode *inode)
if (inode->i_mode & S_IFDIR) {
struct file_system_type *type = inode->i_sb->s_type;

/*
* ensure nobody is actually holding i_mutex
*/
mutex_destroy(&inode->i_mutex);
mutex_init(&inode->i_mutex);
lockdep_set_class(&inode->i_mutex, &type->i_mutex_dir_key);
/* Set new key only if filesystem hasn't already changed it */
if (!lockdep_match_class(&inode->i_mutex,
&type->i_mutex_key)) {
/*
* ensure nobody is actually holding i_mutex
*/
mutex_destroy(&inode->i_mutex);
mutex_init(&inode->i_mutex);
lockdep_set_class(&inode->i_mutex,
&type->i_mutex_dir_key);
}
}
#endif
/*
Expand Down
15 changes: 15 additions & 0 deletions trunk/include/linux/lockdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,16 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
#define lockdep_set_subclass(lock, sub) \
lockdep_init_map(&(lock)->dep_map, #lock, \
(lock)->dep_map.key, sub)
/*
* Compare locking classes
*/
#define lockdep_match_class(lock, key) lockdep_match_key(&(lock)->dep_map, key)

static inline int lockdep_match_key(struct lockdep_map *lock,
struct lock_class_key *key)
{
return lock->key == key;
}

/*
* Acquire a lock.
Expand Down Expand Up @@ -326,6 +336,11 @@ static inline void lockdep_on(void)
#define lockdep_set_class_and_subclass(lock, key, sub) \
do { (void)(key); } while (0)
#define lockdep_set_subclass(lock, sub) do { } while (0)
/*
* We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP
* case since the result is not well defined and the caller should rather
* #ifdef the call himself.
*/

# define INIT_LOCKDEP
# define lockdep_reset() do { debug_locks = 1; } while (0)
Expand Down

0 comments on commit bb94c9f

Please sign in to comment.