diff options
34 files changed, 202 insertions, 291 deletions
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 95a3892b8d1b..a601a17cf568 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -29,6 +29,10 @@ config GENERIC_HARDIRQS | |||
29 | bool | 29 | bool |
30 | default n | 30 | default n |
31 | 31 | ||
32 | config GENERIC_TIME | ||
33 | bool | ||
34 | default y | ||
35 | |||
32 | config TIME_LOW_RES | 36 | config TIME_LOW_RES |
33 | bool | 37 | bool |
34 | default y | 38 | default y |
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c index d5b64e193d92..68a77fe3bb40 100644 --- a/arch/frv/kernel/time.c +++ b/arch/frv/kernel/time.c | |||
@@ -32,8 +32,6 @@ | |||
32 | 32 | ||
33 | #define TICK_SIZE (tick_nsec / 1000) | 33 | #define TICK_SIZE (tick_nsec / 1000) |
34 | 34 | ||
35 | extern unsigned long wall_jiffies; | ||
36 | |||
37 | unsigned long __nongprelbss __clkin_clock_speed_HZ; | 35 | unsigned long __nongprelbss __clkin_clock_speed_HZ; |
38 | unsigned long __nongprelbss __ext_bus_clock_speed_HZ; | 36 | unsigned long __nongprelbss __ext_bus_clock_speed_HZ; |
39 | unsigned long __nongprelbss __res_bus_clock_speed_HZ; | 37 | unsigned long __nongprelbss __res_bus_clock_speed_HZ; |
@@ -145,85 +143,6 @@ void time_init(void) | |||
145 | } | 143 | } |
146 | 144 | ||
147 | /* | 145 | /* |
148 | * This version of gettimeofday has near microsecond resolution. | ||
149 | */ | ||
150 | void do_gettimeofday(struct timeval *tv) | ||
151 | { | ||
152 | unsigned long seq; | ||
153 | unsigned long usec, sec; | ||
154 | unsigned long max_ntp_tick; | ||
155 | |||
156 | do { | ||
157 | unsigned long lost; | ||
158 | |||
159 | seq = read_seqbegin(&xtime_lock); | ||
160 | |||
161 | usec = 0; | ||
162 | lost = jiffies - wall_jiffies; | ||
163 | |||
164 | /* | ||
165 | * If time_adjust is negative then NTP is slowing the clock | ||
166 | * so make sure not to go into next possible interval. | ||
167 | * Better to lose some accuracy than have time go backwards.. | ||
168 | */ | ||
169 | if (unlikely(time_adjust < 0)) { | ||
170 | max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj; | ||
171 | usec = min(usec, max_ntp_tick); | ||
172 | |||
173 | if (lost) | ||
174 | usec += lost * max_ntp_tick; | ||
175 | } | ||
176 | else if (unlikely(lost)) | ||
177 | usec += lost * (USEC_PER_SEC / HZ); | ||
178 | |||
179 | sec = xtime.tv_sec; | ||
180 | usec += (xtime.tv_nsec / 1000); | ||
181 | } while (read_seqretry(&xtime_lock, seq)); | ||
182 | |||
183 | while (usec >= 1000000) { | ||
184 | usec -= 1000000; | ||
185 | sec++; | ||
186 | } | ||
187 | |||
188 | tv->tv_sec = sec; | ||
189 | tv->tv_usec = usec; | ||
190 | } | ||
191 | |||
192 | EXPORT_SYMBOL(do_gettimeofday); | ||
193 | |||
194 | int do_settimeofday(struct timespec *tv) | ||
195 | { | ||
196 | time_t wtm_sec, sec = tv->tv_sec; | ||
197 | long wtm_nsec, nsec = tv->tv_nsec; | ||
198 | |||
199 | if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) | ||
200 | return -EINVAL; | ||
201 | |||
202 | write_seqlock_irq(&xtime_lock); | ||
203 | /* | ||
204 | * This is revolting. We need to set "xtime" correctly. However, the | ||
205 | * value in this location is the value at the most recent update of | ||
206 | * wall time. Discover what correction gettimeofday() would have | ||
207 | * made, and then undo it! | ||
208 | */ | ||
209 | nsec -= 0 * NSEC_PER_USEC; | ||
210 | nsec -= (jiffies - wall_jiffies) * TICK_NSEC; | ||
211 | |||
212 | wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); | ||
213 | wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); | ||
214 | |||
215 | set_normalized_timespec(&xtime, sec, nsec); | ||
216 | set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec); | ||
217 | |||
218 | ntp_clear(); | ||
219 | write_sequnlock_irq(&xtime_lock); | ||
220 | clock_was_set(); | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | EXPORT_SYMBOL(do_settimeofday); | ||
225 | |||
226 | /* | ||
227 | * Scheduler clock - returns current time in nanosec units. | 146 | * Scheduler clock - returns current time in nanosec units. |
228 | */ | 147 | */ |
229 | unsigned long long sched_clock(void) | 148 | unsigned long long sched_clock(void) |
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 12701cf32d99..fef06571be99 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -1605,8 +1605,8 @@ sys_call_table: | |||
1605 | data8 sys_ni_syscall // 1295 reserved for ppoll | 1605 | data8 sys_ni_syscall // 1295 reserved for ppoll |
1606 | data8 sys_unshare | 1606 | data8 sys_unshare |
1607 | data8 sys_splice | 1607 | data8 sys_splice |
1608 | data8 sys_set_robust_list | 1608 | data8 sys_ni_syscall // reserved for set_robust_list |
1609 | data8 sys_get_robust_list | 1609 | data8 sys_ni_syscall // reserved for get_robust_list |
1610 | data8 sys_sync_file_range // 1300 | 1610 | data8 sys_sync_file_range // 1300 |
1611 | data8 sys_tee | 1611 | data8 sys_tee |
1612 | data8 sys_vmsplice | 1612 | data8 sys_vmsplice |
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S index 29236f0c62b5..44d540efa6d1 100644 --- a/arch/ia64/kernel/head.S +++ b/arch/ia64/kernel/head.S | |||
@@ -197,6 +197,11 @@ start_ap: | |||
197 | ;; | 197 | ;; |
198 | srlz.i | 198 | srlz.i |
199 | ;; | 199 | ;; |
200 | { | ||
201 | flushrs // must be first insn in group | ||
202 | srlz.i | ||
203 | } | ||
204 | ;; | ||
200 | /* | 205 | /* |
201 | * Save the region registers, predicate before they get clobbered | 206 | * Save the region registers, predicate before they get clobbered |
202 | */ | 207 | */ |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index c7ccd6ee1ddf..84a7e52f56f6 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -4936,13 +4936,15 @@ abort_locked: | |||
4936 | if (likely(ctx)) { | 4936 | if (likely(ctx)) { |
4937 | DPRINT(("context unlocked\n")); | 4937 | DPRINT(("context unlocked\n")); |
4938 | UNPROTECT_CTX(ctx, flags); | 4938 | UNPROTECT_CTX(ctx, flags); |
4939 | fput(file); | ||
4940 | } | 4939 | } |
4941 | 4940 | ||
4942 | /* copy argument back to user, if needed */ | 4941 | /* copy argument back to user, if needed */ |
4943 | if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; | 4942 | if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; |
4944 | 4943 | ||
4945 | error_args: | 4944 | error_args: |
4945 | if (file) | ||
4946 | fput(file); | ||
4947 | |||
4946 | kfree(args_k); | 4948 | kfree(args_k); |
4947 | 4949 | ||
4948 | DPRINT(("cmd=%s ret=%ld\n", PFM_CMD_NAME(cmd), ret)); | 4950 | DPRINT(("cmd=%s ret=%ld\n", PFM_CMD_NAME(cmd), ret)); |
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index 40722d88607a..9ef62a3fbfad 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c | |||
@@ -163,10 +163,25 @@ sys_pipe (void) | |||
163 | return retval; | 163 | return retval; |
164 | } | 164 | } |
165 | 165 | ||
166 | int ia64_mmap_check(unsigned long addr, unsigned long len, | ||
167 | unsigned long flags) | ||
168 | { | ||
169 | unsigned long roff; | ||
170 | |||
171 | /* | ||
172 | * Don't permit mappings into unmapped space, the virtual page table | ||
173 | * of a region, or across a region boundary. Note: RGN_MAP_LIMIT is | ||
174 | * equal to 2^n-PAGE_SIZE (for some integer n <= 61) and len > 0. | ||
175 | */ | ||
176 | roff = REGION_OFFSET(addr); | ||
177 | if ((len > RGN_MAP_LIMIT) || (roff > (RGN_MAP_LIMIT - len))) | ||
178 | return -EINVAL; | ||
179 | return 0; | ||
180 | } | ||
181 | |||
166 | static inline unsigned long | 182 | static inline unsigned long |
167 | do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, unsigned long pgoff) | 183 | do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, unsigned long pgoff) |
168 | { | 184 | { |
169 | unsigned long roff; | ||
170 | struct file *file = NULL; | 185 | struct file *file = NULL; |
171 | 186 | ||
172 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | 187 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); |
@@ -188,17 +203,6 @@ do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, un | |||
188 | goto out; | 203 | goto out; |
189 | } | 204 | } |
190 | 205 | ||
191 | /* | ||
192 | * Don't permit mappings into unmapped space, the virtual page table of a region, | ||
193 | * or across a region boundary. Note: RGN_MAP_LIMIT is equal to 2^n-PAGE_SIZE | ||
194 | * (for some integer n <= 61) and len > 0. | ||
195 | */ | ||
196 | roff = REGION_OFFSET(addr); | ||
197 | if ((len > RGN_MAP_LIMIT) || (roff > (RGN_MAP_LIMIT - len))) { | ||
198 | addr = -EINVAL; | ||
199 | goto out; | ||
200 | } | ||
201 | |||
202 | down_write(¤t->mm->mmap_sem); | 206 | down_write(¤t->mm->mmap_sem); |
203 | addr = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | 207 | addr = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); |
204 | up_write(¤t->mm->mmap_sem); | 208 | up_write(¤t->mm->mmap_sem); |
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c index c119e8b620de..5f2dcba7fa8d 100644 --- a/arch/ia64/sn/kernel/setup.c +++ b/arch/ia64/sn/kernel/setup.c | |||
@@ -565,7 +565,7 @@ static void __init sn_init_pdas(char **cmdline_p) | |||
565 | * Also sets up a few fields in the nodepda. Also known as | 565 | * Also sets up a few fields in the nodepda. Also known as |
566 | * platform_cpu_init() by the ia64 machvec code. | 566 | * platform_cpu_init() by the ia64 machvec code. |
567 | */ | 567 | */ |
568 | void __init sn_cpu_init(void) | 568 | void __cpuinit sn_cpu_init(void) |
569 | { | 569 | { |
570 | int cpuid; | 570 | int cpuid; |
571 | int cpuphyid; | 571 | int cpuphyid; |
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c index a41c8a5c2007..94ff58c9d4a9 100644 --- a/arch/sparc/kernel/sys_sparc.c +++ b/arch/sparc/kernel/sys_sparc.c | |||
@@ -219,6 +219,21 @@ out: | |||
219 | return err; | 219 | return err; |
220 | } | 220 | } |
221 | 221 | ||
222 | int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) | ||
223 | { | ||
224 | if (ARCH_SUN4C_SUN4 && | ||
225 | (len > 0x20000000 || | ||
226 | ((flags & MAP_FIXED) && | ||
227 | addr < 0xe0000000 && addr + len > 0x20000000))) | ||
228 | return -EINVAL; | ||
229 | |||
230 | /* See asm-sparc/uaccess.h */ | ||
231 | if (len > TASK_SIZE - PAGE_SIZE || addr + len > TASK_SIZE - PAGE_SIZE) | ||
232 | return -EINVAL; | ||
233 | |||
234 | return 0; | ||
235 | } | ||
236 | |||
222 | /* Linux version of mmap */ | 237 | /* Linux version of mmap */ |
223 | static unsigned long do_mmap2(unsigned long addr, unsigned long len, | 238 | static unsigned long do_mmap2(unsigned long addr, unsigned long len, |
224 | unsigned long prot, unsigned long flags, unsigned long fd, | 239 | unsigned long prot, unsigned long flags, unsigned long fd, |
@@ -233,25 +248,13 @@ static unsigned long do_mmap2(unsigned long addr, unsigned long len, | |||
233 | goto out; | 248 | goto out; |
234 | } | 249 | } |
235 | 250 | ||
236 | retval = -EINVAL; | ||
237 | len = PAGE_ALIGN(len); | 251 | len = PAGE_ALIGN(len); |
238 | if (ARCH_SUN4C_SUN4 && | ||
239 | (len > 0x20000000 || | ||
240 | ((flags & MAP_FIXED) && | ||
241 | addr < 0xe0000000 && addr + len > 0x20000000))) | ||
242 | goto out_putf; | ||
243 | |||
244 | /* See asm-sparc/uaccess.h */ | ||
245 | if (len > TASK_SIZE - PAGE_SIZE || addr + len > TASK_SIZE - PAGE_SIZE) | ||
246 | goto out_putf; | ||
247 | |||
248 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | 252 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); |
249 | 253 | ||
250 | down_write(¤t->mm->mmap_sem); | 254 | down_write(¤t->mm->mmap_sem); |
251 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | 255 | retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); |
252 | up_write(¤t->mm->mmap_sem); | 256 | up_write(¤t->mm->mmap_sem); |
253 | 257 | ||
254 | out_putf: | ||
255 | if (file) | 258 | if (file) |
256 | fput(file); | 259 | fput(file); |
257 | out: | 260 | out: |
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 054d0abdb7ee..bf5f14ee73de 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c | |||
@@ -548,6 +548,26 @@ asmlinkage long sparc64_personality(unsigned long personality) | |||
548 | return ret; | 548 | return ret; |
549 | } | 549 | } |
550 | 550 | ||
551 | int sparc64_mmap_check(unsigned long addr, unsigned long len, | ||
552 | unsigned long flags) | ||
553 | { | ||
554 | if (test_thread_flag(TIF_32BIT)) { | ||
555 | if (len >= STACK_TOP32) | ||
556 | return -EINVAL; | ||
557 | |||
558 | if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len) | ||
559 | return -EINVAL; | ||
560 | } else { | ||
561 | if (len >= VA_EXCLUDE_START) | ||
562 | return -EINVAL; | ||
563 | |||
564 | if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len)) | ||
565 | return -EINVAL; | ||
566 | } | ||
567 | |||
568 | return 0; | ||
569 | } | ||
570 | |||
551 | /* Linux version of mmap */ | 571 | /* Linux version of mmap */ |
552 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, | 572 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, |
553 | unsigned long prot, unsigned long flags, unsigned long fd, | 573 | unsigned long prot, unsigned long flags, unsigned long fd, |
@@ -563,27 +583,11 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, | |||
563 | } | 583 | } |
564 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | 584 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); |
565 | len = PAGE_ALIGN(len); | 585 | len = PAGE_ALIGN(len); |
566 | retval = -EINVAL; | ||
567 | |||
568 | if (test_thread_flag(TIF_32BIT)) { | ||
569 | if (len >= STACK_TOP32) | ||
570 | goto out_putf; | ||
571 | |||
572 | if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len) | ||
573 | goto out_putf; | ||
574 | } else { | ||
575 | if (len >= VA_EXCLUDE_START) | ||
576 | goto out_putf; | ||
577 | |||
578 | if ((flags & MAP_FIXED) && invalid_64bit_range(addr, len)) | ||
579 | goto out_putf; | ||
580 | } | ||
581 | 586 | ||
582 | down_write(¤t->mm->mmap_sem); | 587 | down_write(¤t->mm->mmap_sem); |
583 | retval = do_mmap(file, addr, len, prot, flags, off); | 588 | retval = do_mmap(file, addr, len, prot, flags, off); |
584 | up_write(¤t->mm->mmap_sem); | 589 | up_write(¤t->mm->mmap_sem); |
585 | 590 | ||
586 | out_putf: | ||
587 | if (file) | 591 | if (file) |
588 | fput(file); | 592 | fput(file); |
589 | out: | 593 | out: |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index c12f1b71e934..41b74b13a00c 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -376,6 +376,8 @@ static int proc_ide_read_media | |||
376 | break; | 376 | break; |
377 | case ide_floppy:media = "floppy\n"; | 377 | case ide_floppy:media = "floppy\n"; |
378 | break; | 378 | break; |
379 | case ide_optical:media = "optical\n"; | ||
380 | break; | ||
379 | default: media = "UNKNOWN\n"; | 381 | default: media = "UNKNOWN\n"; |
380 | break; | 382 | break; |
381 | } | 383 | } |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 8a6c23ac8cc1..f03196c5db37 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -86,6 +86,8 @@ static const struct { | |||
86 | u8 chipset_family; | 86 | u8 chipset_family; |
87 | u8 flags; | 87 | u8 flags; |
88 | } SiSHostChipInfo[] = { | 88 | } SiSHostChipInfo[] = { |
89 | { "SiS968", PCI_DEVICE_ID_SI_968, ATA_133 }, | ||
90 | { "SiS966", PCI_DEVICE_ID_SI_966, ATA_133 }, | ||
89 | { "SiS965", PCI_DEVICE_ID_SI_965, ATA_133 }, | 91 | { "SiS965", PCI_DEVICE_ID_SI_965, ATA_133 }, |
90 | { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, | 92 | { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, |
91 | { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, | 93 | { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index c5ee9f0691e3..0f0b1eadb98d 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -1009,11 +1009,14 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode, | |||
1009 | buffer_trace_init(&dummy.b_history); | 1009 | buffer_trace_init(&dummy.b_history); |
1010 | err = ext3_get_blocks_handle(handle, inode, block, 1, | 1010 | err = ext3_get_blocks_handle(handle, inode, block, 1, |
1011 | &dummy, create, 1); | 1011 | &dummy, create, 1); |
1012 | if (err == 1) { | 1012 | /* |
1013 | * ext3_get_blocks_handle() returns number of blocks | ||
1014 | * mapped. 0 in case of a HOLE. | ||
1015 | */ | ||
1016 | if (err > 0) { | ||
1017 | if (err > 1) | ||
1018 | WARN_ON(1); | ||
1013 | err = 0; | 1019 | err = 0; |
1014 | } else if (err >= 0) { | ||
1015 | WARN_ON(1); | ||
1016 | err = -EIO; | ||
1017 | } | 1020 | } |
1018 | *errp = err; | 1021 | *errp = err; |
1019 | if (!err && buffer_mapped(&dummy)) { | 1022 | if (!err && buffer_mapped(&dummy)) { |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index fecd3b095deb..76ca1cbc38f9 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -100,25 +100,6 @@ static inline int put_dreq(struct nfs_direct_req *dreq) | |||
100 | return atomic_dec_and_test(&dreq->io_count); | 100 | return atomic_dec_and_test(&dreq->io_count); |
101 | } | 101 | } |
102 | 102 | ||
103 | /* | ||
104 | * "size" is never larger than rsize or wsize. | ||
105 | */ | ||
106 | static inline int nfs_direct_count_pages(unsigned long user_addr, size_t size) | ||
107 | { | ||
108 | int page_count; | ||
109 | |||
110 | page_count = (user_addr + size + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
111 | page_count -= user_addr >> PAGE_SHIFT; | ||
112 | BUG_ON(page_count < 0); | ||
113 | |||
114 | return page_count; | ||
115 | } | ||
116 | |||
117 | static inline unsigned int nfs_max_pages(unsigned int size) | ||
118 | { | ||
119 | return (size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | ||
120 | } | ||
121 | |||
122 | /** | 103 | /** |
123 | * nfs_direct_IO - NFS address space operation for direct I/O | 104 | * nfs_direct_IO - NFS address space operation for direct I/O |
124 | * @rw: direction (read or write) | 105 | * @rw: direction (read or write) |
@@ -276,28 +257,24 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo | |||
276 | struct nfs_open_context *ctx = dreq->ctx; | 257 | struct nfs_open_context *ctx = dreq->ctx; |
277 | struct inode *inode = ctx->dentry->d_inode; | 258 | struct inode *inode = ctx->dentry->d_inode; |
278 | size_t rsize = NFS_SERVER(inode)->rsize; | 259 | size_t rsize = NFS_SERVER(inode)->rsize; |
279 | unsigned int rpages = nfs_max_pages(rsize); | ||
280 | unsigned int pgbase; | 260 | unsigned int pgbase; |
281 | int result; | 261 | int result; |
282 | ssize_t started = 0; | 262 | ssize_t started = 0; |
283 | 263 | ||
284 | get_dreq(dreq); | 264 | get_dreq(dreq); |
285 | 265 | ||
286 | pgbase = user_addr & ~PAGE_MASK; | ||
287 | do { | 266 | do { |
288 | struct nfs_read_data *data; | 267 | struct nfs_read_data *data; |
289 | size_t bytes; | 268 | size_t bytes; |
290 | 269 | ||
270 | pgbase = user_addr & ~PAGE_MASK; | ||
271 | bytes = min(rsize,count); | ||
272 | |||
291 | result = -ENOMEM; | 273 | result = -ENOMEM; |
292 | data = nfs_readdata_alloc(rpages); | 274 | data = nfs_readdata_alloc(pgbase + bytes); |
293 | if (unlikely(!data)) | 275 | if (unlikely(!data)) |
294 | break; | 276 | break; |
295 | 277 | ||
296 | bytes = rsize; | ||
297 | if (count < rsize) | ||
298 | bytes = count; | ||
299 | |||
300 | data->npages = nfs_direct_count_pages(user_addr, bytes); | ||
301 | down_read(¤t->mm->mmap_sem); | 278 | down_read(¤t->mm->mmap_sem); |
302 | result = get_user_pages(current, current->mm, user_addr, | 279 | result = get_user_pages(current, current->mm, user_addr, |
303 | data->npages, 1, 0, data->pagevec, NULL); | 280 | data->npages, 1, 0, data->pagevec, NULL); |
@@ -344,8 +321,10 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo | |||
344 | started += bytes; | 321 | started += bytes; |
345 | user_addr += bytes; | 322 | user_addr += bytes; |
346 | pos += bytes; | 323 | pos += bytes; |
324 | /* FIXME: Remove this unnecessary math from final patch */ | ||
347 | pgbase += bytes; | 325 | pgbase += bytes; |
348 | pgbase &= ~PAGE_MASK; | 326 | pgbase &= ~PAGE_MASK; |
327 | BUG_ON(pgbase != (user_addr & ~PAGE_MASK)); | ||
349 | 328 | ||
350 | count -= bytes; | 329 | count -= bytes; |
351 | } while (count != 0); | 330 | } while (count != 0); |
@@ -524,7 +503,7 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode | |||
524 | 503 | ||
525 | static void nfs_alloc_commit_data(struct nfs_direct_req *dreq) | 504 | static void nfs_alloc_commit_data(struct nfs_direct_req *dreq) |
526 | { | 505 | { |
527 | dreq->commit_data = nfs_commit_alloc(0); | 506 | dreq->commit_data = nfs_commit_alloc(); |
528 | if (dreq->commit_data != NULL) | 507 | if (dreq->commit_data != NULL) |
529 | dreq->commit_data->req = (struct nfs_page *) dreq; | 508 | dreq->commit_data->req = (struct nfs_page *) dreq; |
530 | } | 509 | } |
@@ -605,28 +584,24 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l | |||
605 | struct nfs_open_context *ctx = dreq->ctx; | 584 | struct nfs_open_context *ctx = dreq->ctx; |
606 | struct inode *inode = ctx->dentry->d_inode; | 585 | struct inode *inode = ctx->dentry->d_inode; |
607 | size_t wsize = NFS_SERVER(inode)->wsize; | 586 | size_t wsize = NFS_SERVER(inode)->wsize; |
608 | unsigned int wpages = nfs_max_pages(wsize); | ||
609 | unsigned int pgbase; | 587 | unsigned int pgbase; |
610 | int result; | 588 | int result; |
611 | ssize_t started = 0; | 589 | ssize_t started = 0; |
612 | 590 | ||
613 | get_dreq(dreq); | 591 | get_dreq(dreq); |
614 | 592 | ||
615 | pgbase = user_addr & ~PAGE_MASK; | ||
616 | do { | 593 | do { |
617 | struct nfs_write_data *data; | 594 | struct nfs_write_data *data; |
618 | size_t bytes; | 595 | size_t bytes; |
619 | 596 | ||
597 | pgbase = user_addr & ~PAGE_MASK; | ||
598 | bytes = min(wsize,count); | ||
599 | |||
620 | result = -ENOMEM; | 600 | result = -ENOMEM; |
621 | data = nfs_writedata_alloc(wpages); | 601 | data = nfs_writedata_alloc(pgbase + bytes); |
622 | if (unlikely(!data)) | 602 | if (unlikely(!data)) |
623 | break; | 603 | break; |
624 | 604 | ||
625 | bytes = wsize; | ||
626 | if (count < wsize) | ||
627 | bytes = count; | ||
628 | |||
629 | data->npages = nfs_direct_count_pages(user_addr, bytes); | ||
630 | down_read(¤t->mm->mmap_sem); | 605 | down_read(¤t->mm->mmap_sem); |
631 | result = get_user_pages(current, current->mm, user_addr, | 606 | result = get_user_pages(current, current->mm, user_addr, |
632 | data->npages, 0, 0, data->pagevec, NULL); | 607 | data->npages, 0, 0, data->pagevec, NULL); |
@@ -676,8 +651,11 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l | |||
676 | started += bytes; | 651 | started += bytes; |
677 | user_addr += bytes; | 652 | user_addr += bytes; |
678 | pos += bytes; | 653 | pos += bytes; |
654 | |||
655 | /* FIXME: Remove this useless math from the final patch */ | ||
679 | pgbase += bytes; | 656 | pgbase += bytes; |
680 | pgbase &= ~PAGE_MASK; | 657 | pgbase &= ~PAGE_MASK; |
658 | BUG_ON(pgbase != (user_addr & ~PAGE_MASK)); | ||
681 | 659 | ||
682 | count -= bytes; | 660 | count -= bytes; |
683 | } while (count != 0); | 661 | } while (count != 0); |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index da9cf11c326f..7a9ee00e0c61 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -43,13 +43,15 @@ static mempool_t *nfs_rdata_mempool; | |||
43 | 43 | ||
44 | #define MIN_POOL_READ (32) | 44 | #define MIN_POOL_READ (32) |
45 | 45 | ||
46 | struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount) | 46 | struct nfs_read_data *nfs_readdata_alloc(size_t len) |
47 | { | 47 | { |
48 | unsigned int pagecount = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
48 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); | 49 | struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); |
49 | 50 | ||
50 | if (p) { | 51 | if (p) { |
51 | memset(p, 0, sizeof(*p)); | 52 | memset(p, 0, sizeof(*p)); |
52 | INIT_LIST_HEAD(&p->pages); | 53 | INIT_LIST_HEAD(&p->pages); |
54 | p->npages = pagecount; | ||
53 | if (pagecount <= ARRAY_SIZE(p->page_array)) | 55 | if (pagecount <= ARRAY_SIZE(p->page_array)) |
54 | p->pagevec = p->page_array; | 56 | p->pagevec = p->page_array; |
55 | else { | 57 | else { |
@@ -140,7 +142,7 @@ static int nfs_readpage_sync(struct nfs_open_context *ctx, struct inode *inode, | |||
140 | int result; | 142 | int result; |
141 | struct nfs_read_data *rdata; | 143 | struct nfs_read_data *rdata; |
142 | 144 | ||
143 | rdata = nfs_readdata_alloc(1); | 145 | rdata = nfs_readdata_alloc(count); |
144 | if (!rdata) | 146 | if (!rdata) |
145 | return -ENOMEM; | 147 | return -ENOMEM; |
146 | 148 | ||
@@ -336,25 +338,25 @@ static int nfs_pagein_multi(struct list_head *head, struct inode *inode) | |||
336 | struct nfs_page *req = nfs_list_entry(head->next); | 338 | struct nfs_page *req = nfs_list_entry(head->next); |
337 | struct page *page = req->wb_page; | 339 | struct page *page = req->wb_page; |
338 | struct nfs_read_data *data; | 340 | struct nfs_read_data *data; |
339 | unsigned int rsize = NFS_SERVER(inode)->rsize; | 341 | size_t rsize = NFS_SERVER(inode)->rsize, nbytes; |
340 | unsigned int nbytes, offset; | 342 | unsigned int offset; |
341 | int requests = 0; | 343 | int requests = 0; |
342 | LIST_HEAD(list); | 344 | LIST_HEAD(list); |
343 | 345 | ||
344 | nfs_list_remove_request(req); | 346 | nfs_list_remove_request(req); |
345 | 347 | ||
346 | nbytes = req->wb_bytes; | 348 | nbytes = req->wb_bytes; |
347 | for(;;) { | 349 | do { |
348 | data = nfs_readdata_alloc(1); | 350 | size_t len = min(nbytes,rsize); |
351 | |||
352 | data = nfs_readdata_alloc(len); | ||
349 | if (!data) | 353 | if (!data) |
350 | goto out_bad; | 354 | goto out_bad; |
351 | INIT_LIST_HEAD(&data->pages); | 355 | INIT_LIST_HEAD(&data->pages); |
352 | list_add(&data->pages, &list); | 356 | list_add(&data->pages, &list); |
353 | requests++; | 357 | requests++; |
354 | if (nbytes <= rsize) | 358 | nbytes -= len; |
355 | break; | 359 | } while(nbytes != 0); |
356 | nbytes -= rsize; | ||
357 | } | ||
358 | atomic_set(&req->wb_complete, requests); | 360 | atomic_set(&req->wb_complete, requests); |
359 | 361 | ||
360 | ClearPageError(page); | 362 | ClearPageError(page); |
@@ -402,7 +404,7 @@ static int nfs_pagein_one(struct list_head *head, struct inode *inode) | |||
402 | if (NFS_SERVER(inode)->rsize < PAGE_CACHE_SIZE) | 404 | if (NFS_SERVER(inode)->rsize < PAGE_CACHE_SIZE) |
403 | return nfs_pagein_multi(head, inode); | 405 | return nfs_pagein_multi(head, inode); |
404 | 406 | ||
405 | data = nfs_readdata_alloc(NFS_SERVER(inode)->rpages); | 407 | data = nfs_readdata_alloc(NFS_SERVER(inode)->rsize); |
406 | if (!data) | 408 | if (!data) |
407 | goto out_bad; | 409 | goto out_bad; |
408 | 410 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 50774991f8d5..8ab3cf10d792 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -90,22 +90,13 @@ static mempool_t *nfs_commit_mempool; | |||
90 | 90 | ||
91 | static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion); | 91 | static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion); |
92 | 92 | ||
93 | struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount) | 93 | struct nfs_write_data *nfs_commit_alloc(void) |
94 | { | 94 | { |
95 | struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, SLAB_NOFS); | 95 | struct nfs_write_data *p = mempool_alloc(nfs_commit_mempool, SLAB_NOFS); |
96 | 96 | ||
97 | if (p) { | 97 | if (p) { |
98 | memset(p, 0, sizeof(*p)); | 98 | memset(p, 0, sizeof(*p)); |
99 | INIT_LIST_HEAD(&p->pages); | 99 | INIT_LIST_HEAD(&p->pages); |
100 | if (pagecount <= ARRAY_SIZE(p->page_array)) | ||
101 | p->pagevec = p->page_array; | ||
102 | else { | ||
103 | p->pagevec = kcalloc(pagecount, sizeof(struct page *), GFP_NOFS); | ||
104 | if (!p->pagevec) { | ||
105 | mempool_free(p, nfs_commit_mempool); | ||
106 | p = NULL; | ||
107 | } | ||
108 | } | ||
109 | } | 100 | } |
110 | return p; | 101 | return p; |
111 | } | 102 | } |
@@ -117,13 +108,15 @@ void nfs_commit_free(struct nfs_write_data *p) | |||
117 | mempool_free(p, nfs_commit_mempool); | 108 | mempool_free(p, nfs_commit_mempool); |
118 | } | 109 | } |
119 | 110 | ||
120 | struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount) | 111 | struct nfs_write_data *nfs_writedata_alloc(size_t len) |
121 | { | 112 | { |
113 | unsigned int pagecount = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
122 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); | 114 | struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); |
123 | 115 | ||
124 | if (p) { | 116 | if (p) { |
125 | memset(p, 0, sizeof(*p)); | 117 | memset(p, 0, sizeof(*p)); |
126 | INIT_LIST_HEAD(&p->pages); | 118 | INIT_LIST_HEAD(&p->pages); |
119 | p->npages = pagecount; | ||
127 | if (pagecount <= ARRAY_SIZE(p->page_array)) | 120 | if (pagecount <= ARRAY_SIZE(p->page_array)) |
128 | p->pagevec = p->page_array; | 121 | p->pagevec = p->page_array; |
129 | else { | 122 | else { |
@@ -208,7 +201,7 @@ static int nfs_writepage_sync(struct nfs_open_context *ctx, struct inode *inode, | |||
208 | int result, written = 0; | 201 | int result, written = 0; |
209 | struct nfs_write_data *wdata; | 202 | struct nfs_write_data *wdata; |
210 | 203 | ||
211 | wdata = nfs_writedata_alloc(1); | 204 | wdata = nfs_writedata_alloc(wsize); |
212 | if (!wdata) | 205 | if (!wdata) |
213 | return -ENOMEM; | 206 | return -ENOMEM; |
214 | 207 | ||
@@ -999,24 +992,24 @@ static int nfs_flush_multi(struct inode *inode, struct list_head *head, int how) | |||
999 | struct nfs_page *req = nfs_list_entry(head->next); | 992 | struct nfs_page *req = nfs_list_entry(head->next); |
1000 | struct page *page = req->wb_page; | 993 | struct page *page = req->wb_page; |
1001 | struct nfs_write_data *data; | 994 | struct nfs_write_data *data; |
1002 | unsigned int wsize = NFS_SERVER(inode)->wsize; | 995 | size_t wsize = NFS_SERVER(inode)->wsize, nbytes; |
1003 | unsigned int nbytes, offset; | 996 | unsigned int offset; |
1004 | int requests = 0; | 997 | int requests = 0; |
1005 | LIST_HEAD(list); | 998 | LIST_HEAD(list); |
1006 | 999 | ||
1007 | nfs_list_remove_request(req); | 1000 | nfs_list_remove_request(req); |
1008 | 1001 | ||
1009 | nbytes = req->wb_bytes; | 1002 | nbytes = req->wb_bytes; |
1010 | for (;;) { | 1003 | do { |
1011 | data = nfs_writedata_alloc(1); | 1004 | size_t len = min(nbytes, wsize); |
1005 | |||
1006 | data = nfs_writedata_alloc(len); | ||
1012 | if (!data) | 1007 | if (!data) |
1013 | goto out_bad; | 1008 | goto out_bad; |
1014 | list_add(&data->pages, &list); | 1009 | list_add(&data->pages, &list); |
1015 | requests++; | 1010 | requests++; |
1016 | if (nbytes <= wsize) | 1011 | nbytes -= len; |
1017 | break; | 1012 | } while (nbytes != 0); |
1018 | nbytes -= wsize; | ||
1019 | } | ||
1020 | atomic_set(&req->wb_complete, requests); | 1013 | atomic_set(&req->wb_complete, requests); |
1021 | 1014 | ||
1022 | ClearPageError(page); | 1015 | ClearPageError(page); |
@@ -1070,7 +1063,7 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, int how) | |||
1070 | struct nfs_write_data *data; | 1063 | struct nfs_write_data *data; |
1071 | unsigned int count; | 1064 | unsigned int count; |
1072 | 1065 | ||
1073 | data = nfs_writedata_alloc(NFS_SERVER(inode)->wpages); | 1066 | data = nfs_writedata_alloc(NFS_SERVER(inode)->wsize); |
1074 | if (!data) | 1067 | if (!data) |
1075 | goto out_bad; | 1068 | goto out_bad; |
1076 | 1069 | ||
@@ -1378,7 +1371,7 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how) | |||
1378 | struct nfs_write_data *data; | 1371 | struct nfs_write_data *data; |
1379 | struct nfs_page *req; | 1372 | struct nfs_page *req; |
1380 | 1373 | ||
1381 | data = nfs_commit_alloc(NFS_SERVER(inode)->wpages); | 1374 | data = nfs_commit_alloc(); |
1382 | 1375 | ||
1383 | if (!data) | 1376 | if (!data) |
1384 | goto out_bad; | 1377 | goto out_bad; |
diff --git a/fs/super.c b/fs/super.c index 6d4e8174b6db..5c4c94d5495e 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -49,6 +49,7 @@ DEFINE_SPINLOCK(sb_lock); | |||
49 | 49 | ||
50 | /** | 50 | /** |
51 | * alloc_super - create new superblock | 51 | * alloc_super - create new superblock |
52 | * @type: filesystem type superblock should belong to | ||
52 | * | 53 | * |
53 | * Allocates and initializes a new &struct super_block. alloc_super() | 54 | * Allocates and initializes a new &struct super_block. alloc_super() |
54 | * returns a pointer new superblock or %NULL if allocation had failed. | 55 | * returns a pointer new superblock or %NULL if allocation had failed. |
diff --git a/include/asm-i386/Kbuild b/include/asm-i386/Kbuild index c064a8e9170f..335b2fa4e066 100644 --- a/include/asm-i386/Kbuild +++ b/include/asm-i386/Kbuild | |||
@@ -1,5 +1,5 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | 2 | ||
3 | header-y += boot.h cpufeature.h debugreg.h ldt.h setup.h ucontext.h | 3 | header-y += boot.h debugreg.h ldt.h setup.h ucontext.h |
4 | 4 | ||
5 | unifdef-y += mtrr.h vm86.h | 5 | unifdef-y += mtrr.h vm86.h |
diff --git a/include/asm-ia64/mman.h b/include/asm-ia64/mman.h index 6ba179f12718..c73b87832a1e 100644 --- a/include/asm-ia64/mman.h +++ b/include/asm-ia64/mman.h | |||
@@ -22,4 +22,12 @@ | |||
22 | #define MCL_CURRENT 1 /* lock all current mappings */ | 22 | #define MCL_CURRENT 1 /* lock all current mappings */ |
23 | #define MCL_FUTURE 2 /* lock all future mappings */ | 23 | #define MCL_FUTURE 2 /* lock all future mappings */ |
24 | 24 | ||
25 | #ifdef __KERNEL__ | ||
26 | #ifndef __ASSEMBLY__ | ||
27 | #define arch_mmap_check ia64_mmap_check | ||
28 | int ia64_mmap_check(unsigned long addr, unsigned long len, | ||
29 | unsigned long flags); | ||
30 | #endif | ||
31 | #endif | ||
32 | |||
25 | #endif /* _ASM_IA64_MMAN_H */ | 33 | #endif /* _ASM_IA64_MMAN_H */ |
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h index bb0eb727dcd0..f581662c5ab8 100644 --- a/include/asm-ia64/unistd.h +++ b/include/asm-ia64/unistd.h | |||
@@ -286,8 +286,7 @@ | |||
286 | /* 1294, 1295 reserved for pselect/ppoll */ | 286 | /* 1294, 1295 reserved for pselect/ppoll */ |
287 | #define __NR_unshare 1296 | 287 | #define __NR_unshare 1296 |
288 | #define __NR_splice 1297 | 288 | #define __NR_splice 1297 |
289 | #define __NR_set_robust_list 1298 | 289 | /* 1298, 1299 reserved for set_robust_list/get_robust_list */ |
290 | #define __NR_get_robust_list 1299 | ||
291 | #define __NR_sync_file_range 1300 | 290 | #define __NR_sync_file_range 1300 |
292 | #define __NR_tee 1301 | 291 | #define __NR_tee 1301 |
293 | #define __NR_vmsplice 1302 | 292 | #define __NR_vmsplice 1302 |
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index a5559e38744e..5a057b00f19a 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h | |||
@@ -104,7 +104,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
104 | 104 | ||
105 | /* PFN start number, because of __MEMORY_START */ | 105 | /* PFN start number, because of __MEMORY_START */ |
106 | #define PFN_START (__MEMORY_START >> PAGE_SHIFT) | 106 | #define PFN_START (__MEMORY_START >> PAGE_SHIFT) |
107 | #define ARCH_PFN_OFFSET (FPN_START) | 107 | #define ARCH_PFN_OFFSET (PFN_START) |
108 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 108 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
109 | #define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr) | 109 | #define pfn_valid(pfn) (((pfn) - PFN_START) < max_mapnr) |
110 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 110 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/include/asm-sparc/mman.h b/include/asm-sparc/mman.h index 88d1886abf3b..b7dc40bc68f4 100644 --- a/include/asm-sparc/mman.h +++ b/include/asm-sparc/mman.h | |||
@@ -35,4 +35,12 @@ | |||
35 | 35 | ||
36 | #define MADV_FREE 0x5 /* (Solaris) contents can be freed */ | 36 | #define MADV_FREE 0x5 /* (Solaris) contents can be freed */ |
37 | 37 | ||
38 | #ifdef __KERNEL__ | ||
39 | #ifndef __ASSEMBLY__ | ||
40 | #define arch_mmap_check sparc_mmap_check | ||
41 | int sparc_mmap_check(unsigned long addr, unsigned long len, | ||
42 | unsigned long flags); | ||
43 | #endif | ||
44 | #endif | ||
45 | |||
38 | #endif /* __SPARC_MMAN_H__ */ | 46 | #endif /* __SPARC_MMAN_H__ */ |
diff --git a/include/asm-sparc64/mman.h b/include/asm-sparc64/mman.h index 6fd878e61435..8cc1860be630 100644 --- a/include/asm-sparc64/mman.h +++ b/include/asm-sparc64/mman.h | |||
@@ -35,4 +35,12 @@ | |||
35 | 35 | ||
36 | #define MADV_FREE 0x5 /* (Solaris) contents can be freed */ | 36 | #define MADV_FREE 0x5 /* (Solaris) contents can be freed */ |
37 | 37 | ||
38 | #ifdef __KERNEL__ | ||
39 | #ifndef __ASSEMBLY__ | ||
40 | #define arch_mmap_check sparc64_mmap_check | ||
41 | int sparc64_mmap_check(unsigned long addr, unsigned long len, | ||
42 | unsigned long flags); | ||
43 | #endif | ||
44 | #endif | ||
45 | |||
38 | #endif /* __SPARC64_MMAN_H__ */ | 46 | #endif /* __SPARC64_MMAN_H__ */ |
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index 41788a31c438..2096e5c72827 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h | |||
@@ -7,7 +7,6 @@ | |||
7 | #define LINUX_ATMDEV_H | 7 | #define LINUX_ATMDEV_H |
8 | 8 | ||
9 | 9 | ||
10 | #include <linux/device.h> | ||
11 | #include <linux/atmapi.h> | 10 | #include <linux/atmapi.h> |
12 | #include <linux/atm.h> | 11 | #include <linux/atm.h> |
13 | #include <linux/atmioc.h> | 12 | #include <linux/atmioc.h> |
@@ -210,6 +209,7 @@ struct atm_cirange { | |||
210 | 209 | ||
211 | #ifdef __KERNEL__ | 210 | #ifdef __KERNEL__ |
212 | 211 | ||
212 | #include <linux/device.h> | ||
213 | #include <linux/wait.h> /* wait_queue_head_t */ | 213 | #include <linux/wait.h> /* wait_queue_head_t */ |
214 | #include <linux/time.h> /* struct timeval */ | 214 | #include <linux/time.h> /* struct timeval */ |
215 | #include <linux/net.h> | 215 | #include <linux/net.h> |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index e4bccbcc2750..4fc379de6c2f 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -80,6 +80,7 @@ struct hrtimer_sleeper { | |||
80 | * @get_softirq_time: function to retrieve the current time from the softirq | 80 | * @get_softirq_time: function to retrieve the current time from the softirq |
81 | * @curr_timer: the timer which is executing a callback right now | 81 | * @curr_timer: the timer which is executing a callback right now |
82 | * @softirq_time: the time when running the hrtimer queue in the softirq | 82 | * @softirq_time: the time when running the hrtimer queue in the softirq |
83 | * @lock_key: the lock_class_key for use with lockdep | ||
83 | */ | 84 | */ |
84 | struct hrtimer_base { | 85 | struct hrtimer_base { |
85 | clockid_t index; | 86 | clockid_t index; |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index ed3396dcc4f7..84eeecd60a02 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -56,7 +56,8 @@ typedef union { | |||
56 | #endif | 56 | #endif |
57 | } ktime_t; | 57 | } ktime_t; |
58 | 58 | ||
59 | #define KTIME_MAX (~((u64)1 << 63)) | 59 | #define KTIME_MAX ((s64)~((u64)1 << 63)) |
60 | #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) | ||
60 | 61 | ||
61 | /* | 62 | /* |
62 | * ktime_t definitions when using the 64-bit scalar representation: | 63 | * ktime_t definitions when using the 64-bit scalar representation: |
@@ -73,6 +74,10 @@ typedef union { | |||
73 | */ | 74 | */ |
74 | static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) | 75 | static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) |
75 | { | 76 | { |
77 | #if (BITS_PER_LONG == 64) | ||
78 | if (unlikely(secs >= KTIME_SEC_MAX)) | ||
79 | return (ktime_t){ .tv64 = KTIME_MAX }; | ||
80 | #endif | ||
76 | return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; | 81 | return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; |
77 | } | 82 | } |
78 | 83 | ||
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 247434553ae8..530b1e6173b1 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -427,7 +427,7 @@ extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); | |||
427 | extern void nfs_writedata_release(void *); | 427 | extern void nfs_writedata_release(void *); |
428 | 428 | ||
429 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 429 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
430 | struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount); | 430 | struct nfs_write_data *nfs_commit_alloc(void); |
431 | void nfs_commit_free(struct nfs_write_data *p); | 431 | void nfs_commit_free(struct nfs_write_data *p); |
432 | #endif | 432 | #endif |
433 | 433 | ||
@@ -478,7 +478,7 @@ static inline int nfs_wb_page(struct inode *inode, struct page* page) | |||
478 | /* | 478 | /* |
479 | * Allocate nfs_write_data structures | 479 | * Allocate nfs_write_data structures |
480 | */ | 480 | */ |
481 | extern struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount); | 481 | extern struct nfs_write_data *nfs_writedata_alloc(size_t len); |
482 | 482 | ||
483 | /* | 483 | /* |
484 | * linux/fs/nfs/read.c | 484 | * linux/fs/nfs/read.c |
@@ -492,7 +492,7 @@ extern void nfs_readdata_release(void *data); | |||
492 | /* | 492 | /* |
493 | * Allocate nfs_read_data structures | 493 | * Allocate nfs_read_data structures |
494 | */ | 494 | */ |
495 | extern struct nfs_read_data *nfs_readdata_alloc(unsigned int pagecount); | 495 | extern struct nfs_read_data *nfs_readdata_alloc(size_t len); |
496 | 496 | ||
497 | /* | 497 | /* |
498 | * linux/fs/nfs3proc.c | 498 | * linux/fs/nfs3proc.c |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index db9cbf68e12b..41e5a19199e9 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -729,7 +729,7 @@ struct nfs_read_data { | |||
729 | struct list_head pages; /* Coalesced read requests */ | 729 | struct list_head pages; /* Coalesced read requests */ |
730 | struct nfs_page *req; /* multi ops per nfs_page */ | 730 | struct nfs_page *req; /* multi ops per nfs_page */ |
731 | struct page **pagevec; | 731 | struct page **pagevec; |
732 | unsigned int npages; /* active pages in pagevec */ | 732 | unsigned int npages; /* Max length of pagevec */ |
733 | struct nfs_readargs args; | 733 | struct nfs_readargs args; |
734 | struct nfs_readres res; | 734 | struct nfs_readres res; |
735 | #ifdef CONFIG_NFS_V4 | 735 | #ifdef CONFIG_NFS_V4 |
@@ -748,7 +748,7 @@ struct nfs_write_data { | |||
748 | struct list_head pages; /* Coalesced requests we wish to flush */ | 748 | struct list_head pages; /* Coalesced requests we wish to flush */ |
749 | struct nfs_page *req; /* multi ops per nfs_page */ | 749 | struct nfs_page *req; /* multi ops per nfs_page */ |
750 | struct page **pagevec; | 750 | struct page **pagevec; |
751 | unsigned int npages; /* active pages in pagevec */ | 751 | unsigned int npages; /* Max length of pagevec */ |
752 | struct nfs_writeargs args; /* argument struct */ | 752 | struct nfs_writeargs args; /* argument struct */ |
753 | struct nfs_writeres res; /* result struct */ | 753 | struct nfs_writeres res; /* result struct */ |
754 | #ifdef CONFIG_NFS_V4 | 754 | #ifdef CONFIG_NFS_V4 |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index c91164ea3dec..7a249155ee4e 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -648,6 +648,8 @@ | |||
648 | #define PCI_DEVICE_ID_SI_962 0x0962 | 648 | #define PCI_DEVICE_ID_SI_962 0x0962 |
649 | #define PCI_DEVICE_ID_SI_963 0x0963 | 649 | #define PCI_DEVICE_ID_SI_963 0x0963 |
650 | #define PCI_DEVICE_ID_SI_965 0x0965 | 650 | #define PCI_DEVICE_ID_SI_965 0x0965 |
651 | #define PCI_DEVICE_ID_SI_966 0x0966 | ||
652 | #define PCI_DEVICE_ID_SI_968 0x0968 | ||
651 | #define PCI_DEVICE_ID_SI_5511 0x5511 | 653 | #define PCI_DEVICE_ID_SI_5511 0x5511 |
652 | #define PCI_DEVICE_ID_SI_5513 0x5513 | 654 | #define PCI_DEVICE_ID_SI_5513 0x5513 |
653 | #define PCI_DEVICE_ID_SI_5517 0x5517 | 655 | #define PCI_DEVICE_ID_SI_5517 0x5517 |
diff --git a/kernel/futex.c b/kernel/futex.c index b9b8aea5389e..9d260e838cff 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -1120,9 +1120,10 @@ static int futex_wait(u32 __user *uaddr, u32 val, unsigned long time) | |||
1120 | * if there are waiters then it will block, it does PI, etc. (Due to | 1120 | * if there are waiters then it will block, it does PI, etc. (Due to |
1121 | * races the kernel might see a 0 value of the futex too.) | 1121 | * races the kernel might see a 0 value of the futex too.) |
1122 | */ | 1122 | */ |
1123 | static int do_futex_lock_pi(u32 __user *uaddr, int detect, int trylock, | 1123 | static int futex_lock_pi(u32 __user *uaddr, int detect, unsigned long sec, |
1124 | struct hrtimer_sleeper *to) | 1124 | long nsec, int trylock) |
1125 | { | 1125 | { |
1126 | struct hrtimer_sleeper timeout, *to = NULL; | ||
1126 | struct task_struct *curr = current; | 1127 | struct task_struct *curr = current; |
1127 | struct futex_hash_bucket *hb; | 1128 | struct futex_hash_bucket *hb; |
1128 | u32 uval, newval, curval; | 1129 | u32 uval, newval, curval; |
@@ -1132,6 +1133,13 @@ static int do_futex_lock_pi(u32 __user *uaddr, int detect, int trylock, | |||
1132 | if (refill_pi_state_cache()) | 1133 | if (refill_pi_state_cache()) |
1133 | return -ENOMEM; | 1134 | return -ENOMEM; |
1134 | 1135 | ||
1136 | if (sec != MAX_SCHEDULE_TIMEOUT) { | ||
1137 | to = &timeout; | ||
1138 | hrtimer_init(&to->timer, CLOCK_REALTIME, HRTIMER_ABS); | ||
1139 | hrtimer_init_sleeper(to, current); | ||
1140 | to->timer.expires = ktime_set(sec, nsec); | ||
1141 | } | ||
1142 | |||
1135 | q.pi_state = NULL; | 1143 | q.pi_state = NULL; |
1136 | retry: | 1144 | retry: |
1137 | down_read(&curr->mm->mmap_sem); | 1145 | down_read(&curr->mm->mmap_sem); |
@@ -1307,7 +1315,7 @@ static int do_futex_lock_pi(u32 __user *uaddr, int detect, int trylock, | |||
1307 | if (!detect && ret == -EDEADLK && 0) | 1315 | if (!detect && ret == -EDEADLK && 0) |
1308 | force_sig(SIGKILL, current); | 1316 | force_sig(SIGKILL, current); |
1309 | 1317 | ||
1310 | return ret; | 1318 | return ret != -EINTR ? ret : -ERESTARTNOINTR; |
1311 | 1319 | ||
1312 | out_unlock_release_sem: | 1320 | out_unlock_release_sem: |
1313 | queue_unlock(&q, hb); | 1321 | queue_unlock(&q, hb); |
@@ -1342,76 +1350,6 @@ static int do_futex_lock_pi(u32 __user *uaddr, int detect, int trylock, | |||
1342 | } | 1350 | } |
1343 | 1351 | ||
1344 | /* | 1352 | /* |
1345 | * Restart handler | ||
1346 | */ | ||
1347 | static long futex_lock_pi_restart(struct restart_block *restart) | ||
1348 | { | ||
1349 | struct hrtimer_sleeper timeout, *to = NULL; | ||
1350 | int ret; | ||
1351 | |||
1352 | restart->fn = do_no_restart_syscall; | ||
1353 | |||
1354 | if (restart->arg2 || restart->arg3) { | ||
1355 | to = &timeout; | ||
1356 | hrtimer_init(&to->timer, CLOCK_REALTIME, HRTIMER_ABS); | ||
1357 | hrtimer_init_sleeper(to, current); | ||
1358 | to->timer.expires.tv64 = ((u64)restart->arg1 << 32) | | ||
1359 | (u64) restart->arg0; | ||
1360 | } | ||
1361 | |||
1362 | pr_debug("lock_pi restart: %p, %d (%d)\n", | ||
1363 | (u32 __user *)restart->arg0, current->pid); | ||
1364 | |||
1365 | ret = do_futex_lock_pi((u32 __user *)restart->arg0, restart->arg1, | ||
1366 | 0, to); | ||
1367 | |||
1368 | if (ret != -EINTR) | ||
1369 | return ret; | ||
1370 | |||
1371 | restart->fn = futex_lock_pi_restart; | ||
1372 | |||
1373 | /* The other values are filled in */ | ||
1374 | return -ERESTART_RESTARTBLOCK; | ||
1375 | } | ||
1376 | |||
1377 | /* | ||
1378 | * Called from the syscall entry below. | ||
1379 | */ | ||
1380 | static int futex_lock_pi(u32 __user *uaddr, int detect, unsigned long sec, | ||
1381 | long nsec, int trylock) | ||
1382 | { | ||
1383 | struct hrtimer_sleeper timeout, *to = NULL; | ||
1384 | struct restart_block *restart; | ||
1385 | int ret; | ||
1386 | |||
1387 | if (sec != MAX_SCHEDULE_TIMEOUT) { | ||
1388 | to = &timeout; | ||
1389 | hrtimer_init(&to->timer, CLOCK_REALTIME, HRTIMER_ABS); | ||
1390 | hrtimer_init_sleeper(to, current); | ||
1391 | to->timer.expires = ktime_set(sec, nsec); | ||
1392 | } | ||
1393 | |||
1394 | ret = do_futex_lock_pi(uaddr, detect, trylock, to); | ||
1395 | |||
1396 | if (ret != -EINTR) | ||
1397 | return ret; | ||
1398 | |||
1399 | pr_debug("lock_pi interrupted: %p, %d (%d)\n", uaddr, current->pid); | ||
1400 | |||
1401 | restart = ¤t_thread_info()->restart_block; | ||
1402 | restart->fn = futex_lock_pi_restart; | ||
1403 | restart->arg0 = (unsigned long) uaddr; | ||
1404 | restart->arg1 = detect; | ||
1405 | if (to) { | ||
1406 | restart->arg2 = to->timer.expires.tv64 & 0xFFFFFFFF; | ||
1407 | restart->arg3 = to->timer.expires.tv64 >> 32; | ||
1408 | } else | ||
1409 | restart->arg2 = restart->arg3 = 0; | ||
1410 | |||
1411 | return -ERESTART_RESTARTBLOCK; | ||
1412 | } | ||
1413 | |||
1414 | /* | ||
1415 | * Userspace attempted a TID -> 0 atomic transition, and failed. | 1353 | * Userspace attempted a TID -> 0 atomic transition, and failed. |
1416 | * This is the in-kernel slowpath: we look up the PI state (if any), | 1354 | * This is the in-kernel slowpath: we look up the PI state (if any), |
1417 | * and do the rt-mutex unlock. | 1355 | * and do the rt-mutex unlock. |
diff --git a/kernel/panic.c b/kernel/panic.c index 9b8dcfd1ca93..8010b9b17aca 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -173,7 +173,7 @@ const char *print_tainted(void) | |||
173 | 173 | ||
174 | void add_taint(unsigned flag) | 174 | void add_taint(unsigned flag) |
175 | { | 175 | { |
176 | debug_locks_off(); /* can't trust the integrity of the kernel anymore */ | 176 | debug_locks = 0; /* can't trust the integrity of the kernel anymore */ |
177 | tainted |= flag; | 177 | tainted |= flag; |
178 | } | 178 | } |
179 | EXPORT_SYMBOL(add_taint); | 179 | EXPORT_SYMBOL(add_taint); |
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index ae44a70aae8a..619ecabf7c58 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -56,7 +56,7 @@ config PM_TRACE | |||
56 | 56 | ||
57 | config SOFTWARE_SUSPEND | 57 | config SOFTWARE_SUSPEND |
58 | bool "Software Suspend" | 58 | bool "Software Suspend" |
59 | depends on PM && SWAP && (X86 && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP) | 59 | depends on PM && SWAP && ((X86 && (!SMP || SUSPEND_SMP) && !X86_PAE) || ((FRV || PPC32) && !SMP)) |
60 | ---help--- | 60 | ---help--- |
61 | Enable the possibility of suspending the machine. | 61 | Enable the possibility of suspending the machine. |
62 | It doesn't need ACPI or APM. | 62 | It doesn't need ACPI or APM. |
@@ -78,6 +78,10 @@ config SOFTWARE_SUSPEND | |||
78 | 78 | ||
79 | For more information take a look at <file:Documentation/power/swsusp.txt>. | 79 | For more information take a look at <file:Documentation/power/swsusp.txt>. |
80 | 80 | ||
81 | (For now, swsusp is incompatible with PAE aka HIGHMEM_64G on i386. | ||
82 | we need identity mapping for resume to work, and that is trivial | ||
83 | to get with 4MB pages, but less than trivial on PAE). | ||
84 | |||
81 | config PM_STD_PARTITION | 85 | config PM_STD_PARTITION |
82 | string "Default resume partition" | 86 | string "Default resume partition" |
83 | depends on SOFTWARE_SUSPEND | 87 | depends on SOFTWARE_SUSPEND |
diff --git a/kernel/spinlock.c b/kernel/spinlock.c index bfd6ad9c0330..fb524b009eef 100644 --- a/kernel/spinlock.c +++ b/kernel/spinlock.c | |||
@@ -72,7 +72,7 @@ EXPORT_SYMBOL(_write_trylock); | |||
72 | * not re-enabled during lock-acquire (which the preempt-spin-ops do): | 72 | * not re-enabled during lock-acquire (which the preempt-spin-ops do): |
73 | */ | 73 | */ |
74 | #if !defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP) || \ | 74 | #if !defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP) || \ |
75 | defined(CONFIG_PROVE_LOCKING) | 75 | defined(CONFIG_DEBUG_LOCK_ALLOC) |
76 | 76 | ||
77 | void __lockfunc _read_lock(rwlock_t *lock) | 77 | void __lockfunc _read_lock(rwlock_t *lock) |
78 | { | 78 | { |
@@ -30,6 +30,10 @@ | |||
30 | #include <asm/cacheflush.h> | 30 | #include <asm/cacheflush.h> |
31 | #include <asm/tlb.h> | 31 | #include <asm/tlb.h> |
32 | 32 | ||
33 | #ifndef arch_mmap_check | ||
34 | #define arch_mmap_check(addr, len, flags) (0) | ||
35 | #endif | ||
36 | |||
33 | static void unmap_region(struct mm_struct *mm, | 37 | static void unmap_region(struct mm_struct *mm, |
34 | struct vm_area_struct *vma, struct vm_area_struct *prev, | 38 | struct vm_area_struct *vma, struct vm_area_struct *prev, |
35 | unsigned long start, unsigned long end); | 39 | unsigned long start, unsigned long end); |
@@ -913,6 +917,10 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, | |||
913 | if (!len) | 917 | if (!len) |
914 | return -EINVAL; | 918 | return -EINVAL; |
915 | 919 | ||
920 | error = arch_mmap_check(addr, len, flags); | ||
921 | if (error) | ||
922 | return error; | ||
923 | |||
916 | /* Careful about overflows.. */ | 924 | /* Careful about overflows.. */ |
917 | len = PAGE_ALIGN(len); | 925 | len = PAGE_ALIGN(len); |
918 | if (!len || len > TASK_SIZE) | 926 | if (!len || len > TASK_SIZE) |
@@ -1859,6 +1867,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len) | |||
1859 | unsigned long flags; | 1867 | unsigned long flags; |
1860 | struct rb_node ** rb_link, * rb_parent; | 1868 | struct rb_node ** rb_link, * rb_parent; |
1861 | pgoff_t pgoff = addr >> PAGE_SHIFT; | 1869 | pgoff_t pgoff = addr >> PAGE_SHIFT; |
1870 | int error; | ||
1862 | 1871 | ||
1863 | len = PAGE_ALIGN(len); | 1872 | len = PAGE_ALIGN(len); |
1864 | if (!len) | 1873 | if (!len) |
@@ -1867,6 +1876,12 @@ unsigned long do_brk(unsigned long addr, unsigned long len) | |||
1867 | if ((addr + len) > TASK_SIZE || (addr + len) < addr) | 1876 | if ((addr + len) > TASK_SIZE || (addr + len) < addr) |
1868 | return -EINVAL; | 1877 | return -EINVAL; |
1869 | 1878 | ||
1879 | flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; | ||
1880 | |||
1881 | error = arch_mmap_check(addr, len, flags); | ||
1882 | if (error) | ||
1883 | return error; | ||
1884 | |||
1870 | /* | 1885 | /* |
1871 | * mlock MCL_FUTURE? | 1886 | * mlock MCL_FUTURE? |
1872 | */ | 1887 | */ |
@@ -1907,8 +1922,6 @@ unsigned long do_brk(unsigned long addr, unsigned long len) | |||
1907 | if (security_vm_enough_memory(len >> PAGE_SHIFT)) | 1922 | if (security_vm_enough_memory(len >> PAGE_SHIFT)) |
1908 | return -ENOMEM; | 1923 | return -ENOMEM; |
1909 | 1924 | ||
1910 | flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; | ||
1911 | |||
1912 | /* Can we just expand an old private anonymous mapping? */ | 1925 | /* Can we just expand an old private anonymous mapping? */ |
1913 | if (vma_merge(mm, prev, addr, addr + len, flags, | 1926 | if (vma_merge(mm, prev, addr, addr + len, flags, |
1914 | NULL, NULL, pgoff, NULL)) | 1927 | NULL, NULL, pgoff, NULL)) |
diff --git a/mm/truncate.c b/mm/truncate.c index cf1b015df4a7..c6ab55ec6883 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -68,10 +68,10 @@ invalidate_complete_page(struct address_space *mapping, struct page *page) | |||
68 | return 0; | 68 | return 0; |
69 | 69 | ||
70 | write_lock_irq(&mapping->tree_lock); | 70 | write_lock_irq(&mapping->tree_lock); |
71 | if (PageDirty(page)) { | 71 | if (PageDirty(page)) |
72 | write_unlock_irq(&mapping->tree_lock); | 72 | goto failed; |
73 | return 0; | 73 | if (page_count(page) != 2) /* caller's ref + pagecache ref */ |
74 | } | 74 | goto failed; |
75 | 75 | ||
76 | BUG_ON(PagePrivate(page)); | 76 | BUG_ON(PagePrivate(page)); |
77 | __remove_from_page_cache(page); | 77 | __remove_from_page_cache(page); |
@@ -79,6 +79,9 @@ invalidate_complete_page(struct address_space *mapping, struct page *page) | |||
79 | ClearPageUptodate(page); | 79 | ClearPageUptodate(page); |
80 | page_cache_release(page); /* pagecache ref */ | 80 | page_cache_release(page); /* pagecache ref */ |
81 | return 1; | 81 | return 1; |
82 | failed: | ||
83 | write_unlock_irq(&mapping->tree_lock); | ||
84 | return 0; | ||
82 | } | 85 | } |
83 | 86 | ||
84 | /** | 87 | /** |