mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
vfs: Set special lockdep map for dirs only if not set by fs
Some filesystems need to set lockdep map for i_mutex differently for different directories. For example OCFS2 has system directories (for orphan inode tracking and for gathering all system files like journal or quota files into a single place) which have different locking locking rules than standard directories. For a filesystem setting lockdep map is naturaly done when the inode is read but we have to modify unlock_new_inode() not to overwrite the lockdep map the filesystem has set. Acked-by: [email protected] CC: [email protected] Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Joel Becker <[email protected]>
This commit is contained in:
parent
df152c241d
commit
9a7aa12f39
2 changed files with 26 additions and 6 deletions
17
fs/inode.c
17
fs/inode.c
|
|
@ -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
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue