diff options
-rw-r--r-- | arch/powerpc/configs/ppc6xx_defconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/configs/ps3_defconfig | 1 | ||||
-rw-r--r-- | arch/s390/configs/default_defconfig | 1 | ||||
-rw-r--r-- | arch/sh/configs/rsk7203_defconfig | 1 | ||||
-rw-r--r-- | arch/xtensa/configs/iss_defconfig | 1 | ||||
-rw-r--r-- | arch/xtensa/configs/s6105_defconfig | 1 | ||||
-rw-r--r-- | fs/file_table.c | 5 | ||||
-rw-r--r-- | fs/open.c | 8 | ||||
-rw-r--r-- | include/linux/fs.h | 49 | ||||
-rw-r--r-- | lib/Kconfig.debug | 10 |
10 files changed, 0 insertions, 78 deletions
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig index c2353bf059fd..175a8b99c196 100644 --- a/arch/powerpc/configs/ppc6xx_defconfig +++ b/arch/powerpc/configs/ppc6xx_defconfig | |||
@@ -1244,7 +1244,6 @@ CONFIG_DEBUG_SPINLOCK_SLEEP=y | |||
1244 | CONFIG_DEBUG_HIGHMEM=y | 1244 | CONFIG_DEBUG_HIGHMEM=y |
1245 | CONFIG_DEBUG_INFO=y | 1245 | CONFIG_DEBUG_INFO=y |
1246 | CONFIG_DEBUG_VM=y | 1246 | CONFIG_DEBUG_VM=y |
1247 | CONFIG_DEBUG_WRITECOUNT=y | ||
1248 | CONFIG_DEBUG_LIST=y | 1247 | CONFIG_DEBUG_LIST=y |
1249 | CONFIG_DEBUG_SG=y | 1248 | CONFIG_DEBUG_SG=y |
1250 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | 1249 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set |
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig index 139a8308070c..fdee37fab81c 100644 --- a/arch/powerpc/configs/ps3_defconfig +++ b/arch/powerpc/configs/ps3_defconfig | |||
@@ -174,7 +174,6 @@ CONFIG_DETECT_HUNG_TASK=y | |||
174 | CONFIG_PROVE_LOCKING=y | 174 | CONFIG_PROVE_LOCKING=y |
175 | CONFIG_DEBUG_LOCKDEP=y | 175 | CONFIG_DEBUG_LOCKDEP=y |
176 | CONFIG_DEBUG_INFO=y | 176 | CONFIG_DEBUG_INFO=y |
177 | CONFIG_DEBUG_WRITECOUNT=y | ||
178 | CONFIG_DEBUG_MEMORY_INIT=y | 177 | CONFIG_DEBUG_MEMORY_INIT=y |
179 | CONFIG_DEBUG_LIST=y | 178 | CONFIG_DEBUG_LIST=y |
180 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 179 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig index e0af2ee58751..3f538468a86e 100644 --- a/arch/s390/configs/default_defconfig +++ b/arch/s390/configs/default_defconfig | |||
@@ -550,7 +550,6 @@ CONFIG_LOCK_STAT=y | |||
550 | CONFIG_DEBUG_LOCKDEP=y | 550 | CONFIG_DEBUG_LOCKDEP=y |
551 | CONFIG_DEBUG_ATOMIC_SLEEP=y | 551 | CONFIG_DEBUG_ATOMIC_SLEEP=y |
552 | CONFIG_DEBUG_LOCKING_API_SELFTESTS=y | 552 | CONFIG_DEBUG_LOCKING_API_SELFTESTS=y |
553 | CONFIG_DEBUG_WRITECOUNT=y | ||
554 | CONFIG_DEBUG_LIST=y | 553 | CONFIG_DEBUG_LIST=y |
555 | CONFIG_DEBUG_SG=y | 554 | CONFIG_DEBUG_SG=y |
556 | CONFIG_DEBUG_NOTIFIERS=y | 555 | CONFIG_DEBUG_NOTIFIERS=y |
diff --git a/arch/sh/configs/rsk7203_defconfig b/arch/sh/configs/rsk7203_defconfig index 4e5229b0c5bb..47236573db83 100644 --- a/arch/sh/configs/rsk7203_defconfig +++ b/arch/sh/configs/rsk7203_defconfig | |||
@@ -128,7 +128,6 @@ CONFIG_DEBUG_MUTEXES=y | |||
128 | CONFIG_DEBUG_SPINLOCK_SLEEP=y | 128 | CONFIG_DEBUG_SPINLOCK_SLEEP=y |
129 | CONFIG_DEBUG_INFO=y | 129 | CONFIG_DEBUG_INFO=y |
130 | CONFIG_DEBUG_VM=y | 130 | CONFIG_DEBUG_VM=y |
131 | CONFIG_DEBUG_WRITECOUNT=y | ||
132 | CONFIG_DEBUG_LIST=y | 131 | CONFIG_DEBUG_LIST=y |
133 | CONFIG_DEBUG_SG=y | 132 | CONFIG_DEBUG_SG=y |
134 | CONFIG_FRAME_POINTER=y | 133 | CONFIG_FRAME_POINTER=y |
diff --git a/arch/xtensa/configs/iss_defconfig b/arch/xtensa/configs/iss_defconfig index 4f233204faf9..711f8aa14743 100644 --- a/arch/xtensa/configs/iss_defconfig +++ b/arch/xtensa/configs/iss_defconfig | |||
@@ -627,7 +627,6 @@ CONFIG_SCHED_DEBUG=y | |||
627 | # CONFIG_DEBUG_KOBJECT is not set | 627 | # CONFIG_DEBUG_KOBJECT is not set |
628 | # CONFIG_DEBUG_INFO is not set | 628 | # CONFIG_DEBUG_INFO is not set |
629 | # CONFIG_DEBUG_VM is not set | 629 | # CONFIG_DEBUG_VM is not set |
630 | # CONFIG_DEBUG_WRITECOUNT is not set | ||
631 | # CONFIG_DEBUG_MEMORY_INIT is not set | 630 | # CONFIG_DEBUG_MEMORY_INIT is not set |
632 | # CONFIG_DEBUG_LIST is not set | 631 | # CONFIG_DEBUG_LIST is not set |
633 | # CONFIG_DEBUG_SG is not set | 632 | # CONFIG_DEBUG_SG is not set |
diff --git a/arch/xtensa/configs/s6105_defconfig b/arch/xtensa/configs/s6105_defconfig index d929f77a0360..78318a76fa16 100644 --- a/arch/xtensa/configs/s6105_defconfig +++ b/arch/xtensa/configs/s6105_defconfig | |||
@@ -569,7 +569,6 @@ CONFIG_DEBUG_SPINLOCK_SLEEP=y | |||
569 | # CONFIG_DEBUG_INFO is not set | 569 | # CONFIG_DEBUG_INFO is not set |
570 | # CONFIG_DEBUG_VM is not set | 570 | # CONFIG_DEBUG_VM is not set |
571 | CONFIG_DEBUG_NOMMU_REGIONS=y | 571 | CONFIG_DEBUG_NOMMU_REGIONS=y |
572 | # CONFIG_DEBUG_WRITECOUNT is not set | ||
573 | # CONFIG_DEBUG_MEMORY_INIT is not set | 572 | # CONFIG_DEBUG_MEMORY_INIT is not set |
574 | # CONFIG_DEBUG_LIST is not set | 573 | # CONFIG_DEBUG_LIST is not set |
575 | # CONFIG_DEBUG_SG is not set | 574 | # CONFIG_DEBUG_SG is not set |
diff --git a/fs/file_table.c b/fs/file_table.c index 79ecae62209a..ee20658a0647 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -52,7 +52,6 @@ static void file_free_rcu(struct rcu_head *head) | |||
52 | static inline void file_free(struct file *f) | 52 | static inline void file_free(struct file *f) |
53 | { | 53 | { |
54 | percpu_counter_dec(&nr_files); | 54 | percpu_counter_dec(&nr_files); |
55 | file_check_state(f); | ||
56 | call_rcu(&f->f_u.fu_rcuhead, file_free_rcu); | 55 | call_rcu(&f->f_u.fu_rcuhead, file_free_rcu); |
57 | } | 56 | } |
58 | 57 | ||
@@ -186,7 +185,6 @@ struct file *alloc_file(struct path *path, fmode_t mode, | |||
186 | * that we can do debugging checks at __fput() | 185 | * that we can do debugging checks at __fput() |
187 | */ | 186 | */ |
188 | if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) { | 187 | if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) { |
189 | file_take_write(file); | ||
190 | WARN_ON(mnt_clone_write(path->mnt)); | 188 | WARN_ON(mnt_clone_write(path->mnt)); |
191 | } | 189 | } |
192 | if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) | 190 | if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) |
@@ -213,10 +211,7 @@ static void drop_file_write_access(struct file *file) | |||
213 | return; | 211 | return; |
214 | 212 | ||
215 | put_write_access(inode); | 213 | put_write_access(inode); |
216 | if (file_check_writeable(file) != 0) | ||
217 | return; | ||
218 | __mnt_drop_write(mnt); | 214 | __mnt_drop_write(mnt); |
219 | file_release_write(file); | ||
220 | } | 215 | } |
221 | 216 | ||
222 | /* the real guts of fput() - releasing the last reference to file | 217 | /* the real guts of fput() - releasing the last reference to file |
@@ -683,7 +683,6 @@ static int do_dentry_open(struct file *f, | |||
683 | error = __get_file_write_access(inode, f->f_path.mnt); | 683 | error = __get_file_write_access(inode, f->f_path.mnt); |
684 | if (error) | 684 | if (error) |
685 | goto cleanup_file; | 685 | goto cleanup_file; |
686 | file_take_write(f); | ||
687 | } | 686 | } |
688 | 687 | ||
689 | f->f_mapping = inode->i_mapping; | 688 | f->f_mapping = inode->i_mapping; |
@@ -731,14 +730,7 @@ cleanup_all: | |||
731 | fops_put(f->f_op); | 730 | fops_put(f->f_op); |
732 | if (f->f_mode & FMODE_WRITE) { | 731 | if (f->f_mode & FMODE_WRITE) { |
733 | if (!special_file(inode->i_mode)) { | 732 | if (!special_file(inode->i_mode)) { |
734 | /* | ||
735 | * We don't consider this a real | ||
736 | * mnt_want/drop_write() pair | ||
737 | * because it all happenend right | ||
738 | * here, so just reset the state. | ||
739 | */ | ||
740 | put_write_access(inode); | 733 | put_write_access(inode); |
741 | file_reset_write(f); | ||
742 | __mnt_drop_write(f->f_path.mnt); | 734 | __mnt_drop_write(f->f_path.mnt); |
743 | } | 735 | } |
744 | } | 736 | } |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 23b2a35d712e..e80659ed78fc 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -769,9 +769,6 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) | |||
769 | index < ra->start + ra->size); | 769 | index < ra->start + ra->size); |
770 | } | 770 | } |
771 | 771 | ||
772 | #define FILE_MNT_WRITE_TAKEN 1 | ||
773 | #define FILE_MNT_WRITE_RELEASED 2 | ||
774 | |||
775 | struct file { | 772 | struct file { |
776 | union { | 773 | union { |
777 | struct llist_node fu_llist; | 774 | struct llist_node fu_llist; |
@@ -809,9 +806,6 @@ struct file { | |||
809 | struct list_head f_tfile_llink; | 806 | struct list_head f_tfile_llink; |
810 | #endif /* #ifdef CONFIG_EPOLL */ | 807 | #endif /* #ifdef CONFIG_EPOLL */ |
811 | struct address_space *f_mapping; | 808 | struct address_space *f_mapping; |
812 | #ifdef CONFIG_DEBUG_WRITECOUNT | ||
813 | unsigned long f_mnt_write_state; | ||
814 | #endif | ||
815 | } __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ | 809 | } __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ |
816 | 810 | ||
817 | struct file_handle { | 811 | struct file_handle { |
@@ -829,49 +823,6 @@ static inline struct file *get_file(struct file *f) | |||
829 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 823 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
830 | #define file_count(x) atomic_long_read(&(x)->f_count) | 824 | #define file_count(x) atomic_long_read(&(x)->f_count) |
831 | 825 | ||
832 | #ifdef CONFIG_DEBUG_WRITECOUNT | ||
833 | static inline void file_take_write(struct file *f) | ||
834 | { | ||
835 | WARN_ON(f->f_mnt_write_state != 0); | ||
836 | f->f_mnt_write_state = FILE_MNT_WRITE_TAKEN; | ||
837 | } | ||
838 | static inline void file_release_write(struct file *f) | ||
839 | { | ||
840 | f->f_mnt_write_state |= FILE_MNT_WRITE_RELEASED; | ||
841 | } | ||
842 | static inline void file_reset_write(struct file *f) | ||
843 | { | ||
844 | f->f_mnt_write_state = 0; | ||
845 | } | ||
846 | static inline void file_check_state(struct file *f) | ||
847 | { | ||
848 | /* | ||
849 | * At this point, either both or neither of these bits | ||
850 | * should be set. | ||
851 | */ | ||
852 | WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN); | ||
853 | WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_RELEASED); | ||
854 | } | ||
855 | static inline int file_check_writeable(struct file *f) | ||
856 | { | ||
857 | if (f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN) | ||
858 | return 0; | ||
859 | printk(KERN_WARNING "writeable file with no " | ||
860 | "mnt_want_write()\n"); | ||
861 | WARN_ON(1); | ||
862 | return -EINVAL; | ||
863 | } | ||
864 | #else /* !CONFIG_DEBUG_WRITECOUNT */ | ||
865 | static inline void file_take_write(struct file *filp) {} | ||
866 | static inline void file_release_write(struct file *filp) {} | ||
867 | static inline void file_reset_write(struct file *filp) {} | ||
868 | static inline void file_check_state(struct file *filp) {} | ||
869 | static inline int file_check_writeable(struct file *filp) | ||
870 | { | ||
871 | return 0; | ||
872 | } | ||
873 | #endif /* CONFIG_DEBUG_WRITECOUNT */ | ||
874 | |||
875 | #define MAX_NON_LFS ((1UL<<31) - 1) | 826 | #define MAX_NON_LFS ((1UL<<31) - 1) |
876 | 827 | ||
877 | /* Page cache limit. The filesystems should put that into their s_maxbytes | 828 | /* Page cache limit. The filesystems should put that into their s_maxbytes |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index a48abeac753f..7a0859314bdf 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -1030,16 +1030,6 @@ config DEBUG_BUGVERBOSE | |||
1030 | of the BUG call as well as the EIP and oops trace. This aids | 1030 | of the BUG call as well as the EIP and oops trace. This aids |
1031 | debugging but costs about 70-100K of memory. | 1031 | debugging but costs about 70-100K of memory. |
1032 | 1032 | ||
1033 | config DEBUG_WRITECOUNT | ||
1034 | bool "Debug filesystem writers count" | ||
1035 | depends on DEBUG_KERNEL | ||
1036 | help | ||
1037 | Enable this to catch wrong use of the writers count in struct | ||
1038 | vfsmount. This will increase the size of each file struct by | ||
1039 | 32 bits. | ||
1040 | |||
1041 | If unsure, say N. | ||
1042 | |||
1043 | config DEBUG_LIST | 1033 | config DEBUG_LIST |
1044 | bool "Debug linked list manipulation" | 1034 | bool "Debug linked list manipulation" |
1045 | depends on DEBUG_KERNEL | 1035 | depends on DEBUG_KERNEL |