X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Finode.c;h=f97de0aeb3b69dcd320668ccbf6bbeb6e9d57932;hb=4a66af9eaa9531372cfcb9e20103ed147c729ff9;hp=bf6adf122c688b337abf5d7c00288857b74a5927;hpb=d475fd428ce77aa2a8bc650d230e17663a4f49c3;p=linux-2.6 diff --git a/fs/inode.c b/fs/inode.c index bf6adf122c..f97de0aeb3 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -567,6 +567,18 @@ EXPORT_SYMBOL(new_inode); void unlock_new_inode(struct inode *inode) { +#ifdef CONFIG_DEBUG_LOCK_ALLOC + 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); + if (inode->i_mode & S_IFDIR) + lockdep_set_class(&inode->i_mutex, &type->i_mutex_dir_key); + else + lockdep_set_class(&inode->i_mutex, &type->i_mutex_key); +#endif /* * This is special! We do not need the spinlock * when clearing I_LOCK, because we're guaranteed