diff options
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/fs/inode.c b/fs/inode.c index f643be565df8..901bad1e5f12 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/fsnotify.h> | 25 | #include <linux/fsnotify.h> |
26 | #include <linux/mount.h> | 26 | #include <linux/mount.h> |
27 | #include <linux/async.h> | 27 | #include <linux/async.h> |
28 | #include <linux/posix_acl.h> | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | * This is needed for the following functions: | 31 | * This is needed for the following functions: |
@@ -189,6 +190,9 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode) | |||
189 | } | 190 | } |
190 | inode->i_private = NULL; | 191 | inode->i_private = NULL; |
191 | inode->i_mapping = mapping; | 192 | inode->i_mapping = mapping; |
193 | #ifdef CONFIG_FS_POSIX_ACL | ||
194 | inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED; | ||
195 | #endif | ||
192 | 196 | ||
193 | #ifdef CONFIG_FSNOTIFY | 197 | #ifdef CONFIG_FSNOTIFY |
194 | inode->i_fsnotify_mask = 0; | 198 | inode->i_fsnotify_mask = 0; |
@@ -227,6 +231,12 @@ void destroy_inode(struct inode *inode) | |||
227 | ima_inode_free(inode); | 231 | ima_inode_free(inode); |
228 | security_inode_free(inode); | 232 | security_inode_free(inode); |
229 | fsnotify_inode_delete(inode); | 233 | fsnotify_inode_delete(inode); |
234 | #ifdef CONFIG_FS_POSIX_ACL | ||
235 | if (inode->i_acl && inode->i_acl != ACL_NOT_CACHED) | ||
236 | posix_acl_release(inode->i_acl); | ||
237 | if (inode->i_default_acl && inode->i_default_acl != ACL_NOT_CACHED) | ||
238 | posix_acl_release(inode->i_default_acl); | ||
239 | #endif | ||
230 | if (inode->i_sb->s_op->destroy_inode) | 240 | if (inode->i_sb->s_op->destroy_inode) |
231 | inode->i_sb->s_op->destroy_inode(inode); | 241 | inode->i_sb->s_op->destroy_inode(inode); |
232 | else | 242 | else |
@@ -665,12 +675,17 @@ void unlock_new_inode(struct inode *inode) | |||
665 | if (inode->i_mode & S_IFDIR) { | 675 | if (inode->i_mode & S_IFDIR) { |
666 | struct file_system_type *type = inode->i_sb->s_type; | 676 | struct file_system_type *type = inode->i_sb->s_type; |
667 | 677 | ||
668 | /* | 678 | /* Set new key only if filesystem hasn't already changed it */ |
669 | * ensure nobody is actually holding i_mutex | 679 | if (!lockdep_match_class(&inode->i_mutex, |
670 | */ | 680 | &type->i_mutex_key)) { |
671 | mutex_destroy(&inode->i_mutex); | 681 | /* |
672 | mutex_init(&inode->i_mutex); | 682 | * ensure nobody is actually holding i_mutex |
673 | lockdep_set_class(&inode->i_mutex, &type->i_mutex_dir_key); | 683 | */ |
684 | mutex_destroy(&inode->i_mutex); | ||
685 | mutex_init(&inode->i_mutex); | ||
686 | lockdep_set_class(&inode->i_mutex, | ||
687 | &type->i_mutex_dir_key); | ||
688 | } | ||
674 | } | 689 | } |
675 | #endif | 690 | #endif |
676 | /* | 691 | /* |