diff options
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/fs/inode.c b/fs/inode.c index de80bc2bf713..aaaaf096aa8e 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
9 | #include <linux/dcache.h> | 9 | #include <linux/dcache.h> |
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/quotaops.h> | ||
12 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
13 | #include <linux/writeback.h> | 12 | #include <linux/writeback.h> |
14 | #include <linux/module.h> | 13 | #include <linux/module.h> |
@@ -18,7 +17,6 @@ | |||
18 | #include <linux/hash.h> | 17 | #include <linux/hash.h> |
19 | #include <linux/swap.h> | 18 | #include <linux/swap.h> |
20 | #include <linux/security.h> | 19 | #include <linux/security.h> |
21 | #include <linux/ima.h> | ||
22 | #include <linux/pagemap.h> | 20 | #include <linux/pagemap.h> |
23 | #include <linux/cdev.h> | 21 | #include <linux/cdev.h> |
24 | #include <linux/bootmem.h> | 22 | #include <linux/bootmem.h> |
@@ -114,7 +112,7 @@ static void wake_up_inode(struct inode *inode) | |||
114 | * Prevent speculative execution through spin_unlock(&inode_lock); | 112 | * Prevent speculative execution through spin_unlock(&inode_lock); |
115 | */ | 113 | */ |
116 | smp_mb(); | 114 | smp_mb(); |
117 | wake_up_bit(&inode->i_state, __I_LOCK); | 115 | wake_up_bit(&inode->i_state, __I_NEW); |
118 | } | 116 | } |
119 | 117 | ||
120 | /** | 118 | /** |
@@ -157,11 +155,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode) | |||
157 | 155 | ||
158 | if (security_inode_alloc(inode)) | 156 | if (security_inode_alloc(inode)) |
159 | goto out; | 157 | goto out; |
160 | |||
161 | /* allocate and initialize an i_integrity */ | ||
162 | if (ima_inode_alloc(inode)) | ||
163 | goto out_free_security; | ||
164 | |||
165 | spin_lock_init(&inode->i_lock); | 158 | spin_lock_init(&inode->i_lock); |
166 | lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); | 159 | lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); |
167 | 160 | ||
@@ -201,9 +194,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode) | |||
201 | #endif | 194 | #endif |
202 | 195 | ||
203 | return 0; | 196 | return 0; |
204 | |||
205 | out_free_security: | ||
206 | security_inode_free(inode); | ||
207 | out: | 197 | out: |
208 | return -ENOMEM; | 198 | return -ENOMEM; |
209 | } | 199 | } |
@@ -235,7 +225,6 @@ static struct inode *alloc_inode(struct super_block *sb) | |||
235 | void __destroy_inode(struct inode *inode) | 225 | void __destroy_inode(struct inode *inode) |
236 | { | 226 | { |
237 | BUG_ON(inode_has_buffers(inode)); | 227 | BUG_ON(inode_has_buffers(inode)); |
238 | ima_inode_free(inode); | ||
239 | security_inode_free(inode); | 228 | security_inode_free(inode); |
240 | fsnotify_inode_delete(inode); | 229 | fsnotify_inode_delete(inode); |
241 | #ifdef CONFIG_FS_POSIX_ACL | 230 | #ifdef CONFIG_FS_POSIX_ACL |
@@ -326,7 +315,6 @@ void clear_inode(struct inode *inode) | |||
326 | BUG_ON(!(inode->i_state & I_FREEING)); | 315 | BUG_ON(!(inode->i_state & I_FREEING)); |
327 | BUG_ON(inode->i_state & I_CLEAR); | 316 | BUG_ON(inode->i_state & I_CLEAR); |
328 | inode_sync_wait(inode); | 317 | inode_sync_wait(inode); |
329 | vfs_dq_drop(inode); | ||
330 | if (inode->i_sb->s_op->clear_inode) | 318 | if (inode->i_sb->s_op->clear_inode) |
331 | inode->i_sb->s_op->clear_inode(inode); | 319 | inode->i_sb->s_op->clear_inode(inode); |
332 | if (S_ISBLK(inode->i_mode) && inode->i_bdev) | 320 | if (S_ISBLK(inode->i_mode) && inode->i_bdev) |
@@ -702,17 +690,17 @@ void unlock_new_inode(struct inode *inode) | |||
702 | } | 690 | } |
703 | #endif | 691 | #endif |
704 | /* | 692 | /* |
705 | * This is special! We do not need the spinlock when clearing I_LOCK, | 693 | * This is special! We do not need the spinlock when clearing I_NEW, |
706 | * because we're guaranteed that nobody else tries to do anything about | 694 | * because we're guaranteed that nobody else tries to do anything about |
707 | * the state of the inode when it is locked, as we just created it (so | 695 | * the state of the inode when it is locked, as we just created it (so |
708 | * there can be no old holders that haven't tested I_LOCK). | 696 | * there can be no old holders that haven't tested I_NEW). |
709 | * However we must emit the memory barrier so that other CPUs reliably | 697 | * However we must emit the memory barrier so that other CPUs reliably |
710 | * see the clearing of I_LOCK after the other inode initialisation has | 698 | * see the clearing of I_NEW after the other inode initialisation has |
711 | * completed. | 699 | * completed. |
712 | */ | 700 | */ |
713 | smp_mb(); | 701 | smp_mb(); |
714 | WARN_ON((inode->i_state & (I_LOCK|I_NEW)) != (I_LOCK|I_NEW)); | 702 | WARN_ON(!(inode->i_state & I_NEW)); |
715 | inode->i_state &= ~(I_LOCK|I_NEW); | 703 | inode->i_state &= ~I_NEW; |
716 | wake_up_inode(inode); | 704 | wake_up_inode(inode); |
717 | } | 705 | } |
718 | EXPORT_SYMBOL(unlock_new_inode); | 706 | EXPORT_SYMBOL(unlock_new_inode); |
@@ -743,7 +731,7 @@ static struct inode *get_new_inode(struct super_block *sb, | |||
743 | goto set_failed; | 731 | goto set_failed; |
744 | 732 | ||
745 | __inode_add_to_lists(sb, head, inode); | 733 | __inode_add_to_lists(sb, head, inode); |
746 | inode->i_state = I_LOCK|I_NEW; | 734 | inode->i_state = I_NEW; |
747 | spin_unlock(&inode_lock); | 735 | spin_unlock(&inode_lock); |
748 | 736 | ||
749 | /* Return the locked inode with I_NEW set, the | 737 | /* Return the locked inode with I_NEW set, the |
@@ -790,7 +778,7 @@ static struct inode *get_new_inode_fast(struct super_block *sb, | |||
790 | if (!old) { | 778 | if (!old) { |
791 | inode->i_ino = ino; | 779 | inode->i_ino = ino; |
792 | __inode_add_to_lists(sb, head, inode); | 780 | __inode_add_to_lists(sb, head, inode); |
793 | inode->i_state = I_LOCK|I_NEW; | 781 | inode->i_state = I_NEW; |
794 | spin_unlock(&inode_lock); | 782 | spin_unlock(&inode_lock); |
795 | 783 | ||
796 | /* Return the locked inode with I_NEW set, the | 784 | /* Return the locked inode with I_NEW set, the |
@@ -1095,7 +1083,7 @@ int insert_inode_locked(struct inode *inode) | |||
1095 | ino_t ino = inode->i_ino; | 1083 | ino_t ino = inode->i_ino; |
1096 | struct hlist_head *head = inode_hashtable + hash(sb, ino); | 1084 | struct hlist_head *head = inode_hashtable + hash(sb, ino); |
1097 | 1085 | ||
1098 | inode->i_state |= I_LOCK|I_NEW; | 1086 | inode->i_state |= I_NEW; |
1099 | while (1) { | 1087 | while (1) { |
1100 | struct hlist_node *node; | 1088 | struct hlist_node *node; |
1101 | struct inode *old = NULL; | 1089 | struct inode *old = NULL; |
@@ -1132,7 +1120,7 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval, | |||
1132 | struct super_block *sb = inode->i_sb; | 1120 | struct super_block *sb = inode->i_sb; |
1133 | struct hlist_head *head = inode_hashtable + hash(sb, hashval); | 1121 | struct hlist_head *head = inode_hashtable + hash(sb, hashval); |
1134 | 1122 | ||
1135 | inode->i_state |= I_LOCK|I_NEW; | 1123 | inode->i_state |= I_NEW; |
1136 | 1124 | ||
1137 | while (1) { | 1125 | while (1) { |
1138 | struct hlist_node *node; | 1126 | struct hlist_node *node; |
@@ -1223,8 +1211,6 @@ void generic_delete_inode(struct inode *inode) | |||
1223 | 1211 | ||
1224 | if (op->delete_inode) { | 1212 | if (op->delete_inode) { |
1225 | void (*delete)(struct inode *) = op->delete_inode; | 1213 | void (*delete)(struct inode *) = op->delete_inode; |
1226 | if (!is_bad_inode(inode)) | ||
1227 | vfs_dq_init(inode); | ||
1228 | /* Filesystems implementing their own | 1214 | /* Filesystems implementing their own |
1229 | * s_op->delete_inode are required to call | 1215 | * s_op->delete_inode are required to call |
1230 | * truncate_inode_pages and clear_inode() | 1216 | * truncate_inode_pages and clear_inode() |
@@ -1522,7 +1508,7 @@ EXPORT_SYMBOL(inode_wait); | |||
1522 | * until the deletion _might_ have completed. Callers are responsible | 1508 | * until the deletion _might_ have completed. Callers are responsible |
1523 | * to recheck inode state. | 1509 | * to recheck inode state. |
1524 | * | 1510 | * |
1525 | * It doesn't matter if I_LOCK is not set initially, a call to | 1511 | * It doesn't matter if I_NEW is not set initially, a call to |
1526 | * wake_up_inode() after removing from the hash list will DTRT. | 1512 | * wake_up_inode() after removing from the hash list will DTRT. |
1527 | * | 1513 | * |
1528 | * This is called with inode_lock held. | 1514 | * This is called with inode_lock held. |
@@ -1530,8 +1516,8 @@ EXPORT_SYMBOL(inode_wait); | |||
1530 | static void __wait_on_freeing_inode(struct inode *inode) | 1516 | static void __wait_on_freeing_inode(struct inode *inode) |
1531 | { | 1517 | { |
1532 | wait_queue_head_t *wq; | 1518 | wait_queue_head_t *wq; |
1533 | DEFINE_WAIT_BIT(wait, &inode->i_state, __I_LOCK); | 1519 | DEFINE_WAIT_BIT(wait, &inode->i_state, __I_NEW); |
1534 | wq = bit_waitqueue(&inode->i_state, __I_LOCK); | 1520 | wq = bit_waitqueue(&inode->i_state, __I_NEW); |
1535 | prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE); | 1521 | prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE); |
1536 | spin_unlock(&inode_lock); | 1522 | spin_unlock(&inode_lock); |
1537 | schedule(); | 1523 | schedule(); |