diff options
49 files changed, 307 insertions, 414 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index b7befe758429..1ecfde109667 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1738,6 +1738,7 @@ F: include/uapi/linux/bfs_fs.h | |||
| 1738 | BLACKFIN ARCHITECTURE | 1738 | BLACKFIN ARCHITECTURE |
| 1739 | M: Steven Miao <realmz6@gmail.com> | 1739 | M: Steven Miao <realmz6@gmail.com> |
| 1740 | L: adi-buildroot-devel@lists.sourceforge.net | 1740 | L: adi-buildroot-devel@lists.sourceforge.net |
| 1741 | T: git git://git.code.sf.net/p/adi-linux/code | ||
| 1741 | W: http://blackfin.uclinux.org | 1742 | W: http://blackfin.uclinux.org |
| 1742 | S: Supported | 1743 | S: Supported |
| 1743 | F: arch/blackfin/ | 1744 | F: arch/blackfin/ |
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h index 184066ceb1f6..053c17b36559 100644 --- a/arch/cris/include/asm/bitops.h +++ b/arch/cris/include/asm/bitops.h | |||
| @@ -144,7 +144,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) | |||
| 144 | * definition, which doesn't have the same semantics. We don't want to | 144 | * definition, which doesn't have the same semantics. We don't want to |
| 145 | * use -fno-builtin, so just hide the name ffs. | 145 | * use -fno-builtin, so just hide the name ffs. |
| 146 | */ | 146 | */ |
| 147 | #define ffs kernel_ffs | 147 | #define ffs(x) kernel_ffs(x) |
| 148 | 148 | ||
| 149 | #include <asm-generic/bitops/fls.h> | 149 | #include <asm-generic/bitops/fls.h> |
| 150 | #include <asm-generic/bitops/__fls.h> | 150 | #include <asm-generic/bitops/__fls.h> |
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c index a96bcf83a735..20e8a9b21d75 100644 --- a/arch/ia64/kernel/uncached.c +++ b/arch/ia64/kernel/uncached.c | |||
| @@ -98,7 +98,7 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid) | |||
| 98 | /* attempt to allocate a granule's worth of cached memory pages */ | 98 | /* attempt to allocate a granule's worth of cached memory pages */ |
| 99 | 99 | ||
| 100 | page = alloc_pages_exact_node(nid, | 100 | page = alloc_pages_exact_node(nid, |
| 101 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 101 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
| 102 | IA64_GRANULE_SHIFT-PAGE_SHIFT); | 102 | IA64_GRANULE_SHIFT-PAGE_SHIFT); |
| 103 | if (!page) { | 103 | if (!page) { |
| 104 | mutex_unlock(&uc_pool->add_chunk_mutex); | 104 | mutex_unlock(&uc_pool->add_chunk_mutex); |
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c index 5ec1e47a0d77..e865d748179b 100644 --- a/arch/powerpc/platforms/cell/ras.c +++ b/arch/powerpc/platforms/cell/ras.c | |||
| @@ -123,7 +123,8 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order) | |||
| 123 | 123 | ||
| 124 | area->nid = nid; | 124 | area->nid = nid; |
| 125 | area->order = order; | 125 | area->order = order; |
| 126 | area->pages = alloc_pages_exact_node(area->nid, GFP_KERNEL|GFP_THISNODE, | 126 | area->pages = alloc_pages_exact_node(area->nid, |
| 127 | GFP_KERNEL|__GFP_THISNODE, | ||
| 127 | area->order); | 128 | area->order); |
| 128 | 129 | ||
| 129 | if (!area->pages) { | 130 | if (!area->pages) { |
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index c026cca5602c..f3aaf231b4e5 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
| @@ -341,10 +341,6 @@ config X86_USE_3DNOW | |||
| 341 | def_bool y | 341 | def_bool y |
| 342 | depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML | 342 | depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML |
| 343 | 343 | ||
| 344 | config X86_OOSTORE | ||
| 345 | def_bool y | ||
| 346 | depends on (MWINCHIP3D || MWINCHIPC6) && MTRR | ||
| 347 | |||
| 348 | # | 344 | # |
| 349 | # P6_NOPs are a relatively minor optimization that require a family >= | 345 | # P6_NOPs are a relatively minor optimization that require a family >= |
| 350 | # 6 processor, except that it is broken on certain VIA chips. | 346 | # 6 processor, except that it is broken on certain VIA chips. |
diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h index 04a48903b2eb..69bbb4845020 100644 --- a/arch/x86/include/asm/barrier.h +++ b/arch/x86/include/asm/barrier.h | |||
| @@ -85,11 +85,7 @@ | |||
| 85 | #else | 85 | #else |
| 86 | # define smp_rmb() barrier() | 86 | # define smp_rmb() barrier() |
| 87 | #endif | 87 | #endif |
| 88 | #ifdef CONFIG_X86_OOSTORE | 88 | #define smp_wmb() barrier() |
| 89 | # define smp_wmb() wmb() | ||
| 90 | #else | ||
| 91 | # define smp_wmb() barrier() | ||
| 92 | #endif | ||
| 93 | #define smp_read_barrier_depends() read_barrier_depends() | 89 | #define smp_read_barrier_depends() read_barrier_depends() |
| 94 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | 90 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) |
| 95 | #else /* !SMP */ | 91 | #else /* !SMP */ |
| @@ -100,7 +96,7 @@ | |||
| 100 | #define set_mb(var, value) do { var = value; barrier(); } while (0) | 96 | #define set_mb(var, value) do { var = value; barrier(); } while (0) |
| 101 | #endif /* SMP */ | 97 | #endif /* SMP */ |
| 102 | 98 | ||
| 103 | #if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE) | 99 | #if defined(CONFIG_X86_PPRO_FENCE) |
| 104 | 100 | ||
| 105 | /* | 101 | /* |
| 106 | * For either of these options x86 doesn't have a strong TSO memory | 102 | * For either of these options x86 doesn't have a strong TSO memory |
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 34f69cb9350a..91d9c69a629e 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h | |||
| @@ -237,7 +237,7 @@ memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) | |||
| 237 | 237 | ||
| 238 | static inline void flush_write_buffers(void) | 238 | static inline void flush_write_buffers(void) |
| 239 | { | 239 | { |
| 240 | #if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE) | 240 | #if defined(CONFIG_X86_PPRO_FENCE) |
| 241 | asm volatile("lock; addl $0,0(%%esp)": : :"memory"); | 241 | asm volatile("lock; addl $0,0(%%esp)": : :"memory"); |
| 242 | #endif | 242 | #endif |
| 243 | } | 243 | } |
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index bf156ded74b5..0f62f5482d91 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h | |||
| @@ -26,10 +26,9 @@ | |||
| 26 | # define LOCK_PTR_REG "D" | 26 | # define LOCK_PTR_REG "D" |
| 27 | #endif | 27 | #endif |
| 28 | 28 | ||
| 29 | #if defined(CONFIG_X86_32) && \ | 29 | #if defined(CONFIG_X86_32) && (defined(CONFIG_X86_PPRO_FENCE)) |
| 30 | (defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE)) | ||
| 31 | /* | 30 | /* |
| 32 | * On PPro SMP or if we are using OOSTORE, we use a locked operation to unlock | 31 | * On PPro SMP, we use a locked operation to unlock |
| 33 | * (PPro errata 66, 92) | 32 | * (PPro errata 66, 92) |
| 34 | */ | 33 | */ |
| 35 | # define UNLOCK_LOCK_PREFIX LOCK_PREFIX | 34 | # define UNLOCK_LOCK_PREFIX LOCK_PREFIX |
diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c index 8779edab684e..d8fba5c15fbd 100644 --- a/arch/x86/kernel/cpu/centaur.c +++ b/arch/x86/kernel/cpu/centaur.c | |||
| @@ -8,236 +8,6 @@ | |||
| 8 | 8 | ||
| 9 | #include "cpu.h" | 9 | #include "cpu.h" |
| 10 | 10 | ||
| 11 | #ifdef CONFIG_X86_OOSTORE | ||
| 12 | |||
| 13 | static u32 power2(u32 x) | ||
| 14 | { | ||
| 15 | u32 s = 1; | ||
| 16 | |||
| 17 | while (s <= x) | ||
| 18 | s <<= 1; | ||
| 19 | |||
| 20 | return s >>= 1; | ||
| 21 | } | ||
| 22 | |||
| 23 | |||
| 24 | /* | ||
| 25 | * Set up an actual MCR | ||
| 26 | */ | ||
| 27 | static void centaur_mcr_insert(int reg, u32 base, u32 size, int key) | ||
| 28 | { | ||
| 29 | u32 lo, hi; | ||
| 30 | |||
| 31 | hi = base & ~0xFFF; | ||
| 32 | lo = ~(size-1); /* Size is a power of 2 so this makes a mask */ | ||
| 33 | lo &= ~0xFFF; /* Remove the ctrl value bits */ | ||
| 34 | lo |= key; /* Attribute we wish to set */ | ||
| 35 | wrmsr(reg+MSR_IDT_MCR0, lo, hi); | ||
| 36 | mtrr_centaur_report_mcr(reg, lo, hi); /* Tell the mtrr driver */ | ||
| 37 | } | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Figure what we can cover with MCR's | ||
| 41 | * | ||
| 42 | * Shortcut: We know you can't put 4Gig of RAM on a winchip | ||
| 43 | */ | ||
| 44 | static u32 ramtop(void) | ||
| 45 | { | ||
| 46 | u32 clip = 0xFFFFFFFFUL; | ||
| 47 | u32 top = 0; | ||
| 48 | int i; | ||
| 49 | |||
| 50 | for (i = 0; i < e820.nr_map; i++) { | ||
| 51 | unsigned long start, end; | ||
| 52 | |||
| 53 | if (e820.map[i].addr > 0xFFFFFFFFUL) | ||
| 54 | continue; | ||
| 55 | /* | ||
| 56 | * Don't MCR over reserved space. Ignore the ISA hole | ||
| 57 | * we frob around that catastrophe already | ||
| 58 | */ | ||
| 59 | if (e820.map[i].type == E820_RESERVED) { | ||
| 60 | if (e820.map[i].addr >= 0x100000UL && | ||
| 61 | e820.map[i].addr < clip) | ||
| 62 | clip = e820.map[i].addr; | ||
| 63 | continue; | ||
| 64 | } | ||
| 65 | start = e820.map[i].addr; | ||
| 66 | end = e820.map[i].addr + e820.map[i].size; | ||
| 67 | if (start >= end) | ||
| 68 | continue; | ||
| 69 | if (end > top) | ||
| 70 | top = end; | ||
| 71 | } | ||
| 72 | /* | ||
| 73 | * Everything below 'top' should be RAM except for the ISA hole. | ||
| 74 | * Because of the limited MCR's we want to map NV/ACPI into our | ||
| 75 | * MCR range for gunk in RAM | ||
| 76 | * | ||
| 77 | * Clip might cause us to MCR insufficient RAM but that is an | ||
| 78 | * acceptable failure mode and should only bite obscure boxes with | ||
| 79 | * a VESA hole at 15Mb | ||
| 80 | * | ||
| 81 | * The second case Clip sometimes kicks in is when the EBDA is marked | ||
| 82 | * as reserved. Again we fail safe with reasonable results | ||
| 83 | */ | ||
| 84 | if (top > clip) | ||
| 85 | top = clip; | ||
| 86 | |||
| 87 | return top; | ||
| 88 | } | ||
| 89 | |||
| 90 | /* | ||
| 91 | * Compute a set of MCR's to give maximum coverage | ||
| 92 | */ | ||
| 93 | static int centaur_mcr_compute(int nr, int key) | ||
| 94 | { | ||
| 95 | u32 mem = ramtop(); | ||
| 96 | u32 root = power2(mem); | ||
| 97 | u32 base = root; | ||
| 98 | u32 top = root; | ||
| 99 | u32 floor = 0; | ||
| 100 | int ct = 0; | ||
| 101 | |||
| 102 | while (ct < nr) { | ||
| 103 | u32 fspace = 0; | ||
| 104 | u32 high; | ||
| 105 | u32 low; | ||
| 106 | |||
| 107 | /* | ||
| 108 | * Find the largest block we will fill going upwards | ||
| 109 | */ | ||
| 110 | high = power2(mem-top); | ||
| 111 | |||
| 112 | /* | ||
| 113 | * Find the largest block we will fill going downwards | ||
| 114 | */ | ||
| 115 | low = base/2; | ||
| 116 | |||
| 117 | /* | ||
| 118 | * Don't fill below 1Mb going downwards as there | ||
| 119 | * is an ISA hole in the way. | ||
| 120 | */ | ||
| 121 | if (base <= 1024*1024) | ||
| 122 | low = 0; | ||
| 123 | |||
| 124 | /* | ||
| 125 | * See how much space we could cover by filling below | ||
| 126 | * the ISA hole | ||
| 127 | */ | ||
| 128 | |||
| 129 | if (floor == 0) | ||
| 130 | fspace = 512*1024; | ||
| 131 | else if (floor == 512*1024) | ||
| 132 | fspace = 128*1024; | ||
| 133 | |||
| 134 | /* And forget ROM space */ | ||
| 135 | |||
| 136 | /* | ||
| 137 | * Now install the largest coverage we get | ||
| 138 | */ | ||
| 139 | if (fspace > high && fspace > low) { | ||
| 140 | centaur_mcr_insert(ct, floor, fspace, key); | ||
| 141 | floor += fspace; | ||
| 142 | } else if (high > low) { | ||
| 143 | centaur_mcr_insert(ct, top, high, key); | ||
| 144 | top += high; | ||
| 145 | } else if (low > 0) { | ||
| 146 | base -= low; | ||
| 147 | centaur_mcr_insert(ct, base, low, key); | ||
| 148 | } else | ||
| 149 | break; | ||
| 150 | ct++; | ||
| 151 | } | ||
| 152 | /* | ||
| 153 | * We loaded ct values. We now need to set the mask. The caller | ||
| 154 | * must do this bit. | ||
| 155 | */ | ||
| 156 | return ct; | ||
| 157 | } | ||
| 158 | |||
| 159 | static void centaur_create_optimal_mcr(void) | ||
| 160 | { | ||
| 161 | int used; | ||
| 162 | int i; | ||
| 163 | |||
| 164 | /* | ||
| 165 | * Allocate up to 6 mcrs to mark as much of ram as possible | ||
| 166 | * as write combining and weak write ordered. | ||
| 167 | * | ||
| 168 | * To experiment with: Linux never uses stack operations for | ||
| 169 | * mmio spaces so we could globally enable stack operation wc | ||
| 170 | * | ||
| 171 | * Load the registers with type 31 - full write combining, all | ||
| 172 | * writes weakly ordered. | ||
| 173 | */ | ||
| 174 | used = centaur_mcr_compute(6, 31); | ||
| 175 | |||
| 176 | /* | ||
| 177 | * Wipe unused MCRs | ||
| 178 | */ | ||
| 179 | for (i = used; i < 8; i++) | ||
| 180 | wrmsr(MSR_IDT_MCR0+i, 0, 0); | ||
| 181 | } | ||
| 182 | |||
| 183 | static void winchip2_create_optimal_mcr(void) | ||
| 184 | { | ||
| 185 | u32 lo, hi; | ||
| 186 | int used; | ||
| 187 | int i; | ||
| 188 | |||
| 189 | /* | ||
| 190 | * Allocate up to 6 mcrs to mark as much of ram as possible | ||
| 191 | * as write combining, weak store ordered. | ||
| 192 | * | ||
| 193 | * Load the registers with type 25 | ||
| 194 | * 8 - weak write ordering | ||
| 195 | * 16 - weak read ordering | ||
| 196 | * 1 - write combining | ||
| 197 | */ | ||
| 198 | used = centaur_mcr_compute(6, 25); | ||
| 199 | |||
| 200 | /* | ||
| 201 | * Mark the registers we are using. | ||
| 202 | */ | ||
| 203 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 204 | for (i = 0; i < used; i++) | ||
| 205 | lo |= 1<<(9+i); | ||
| 206 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 207 | |||
| 208 | /* | ||
| 209 | * Wipe unused MCRs | ||
| 210 | */ | ||
| 211 | |||
| 212 | for (i = used; i < 8; i++) | ||
| 213 | wrmsr(MSR_IDT_MCR0+i, 0, 0); | ||
| 214 | } | ||
| 215 | |||
| 216 | /* | ||
| 217 | * Handle the MCR key on the Winchip 2. | ||
| 218 | */ | ||
| 219 | static void winchip2_unprotect_mcr(void) | ||
| 220 | { | ||
| 221 | u32 lo, hi; | ||
| 222 | u32 key; | ||
| 223 | |||
| 224 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 225 | lo &= ~0x1C0; /* blank bits 8-6 */ | ||
| 226 | key = (lo>>17) & 7; | ||
| 227 | lo |= key<<6; /* replace with unlock key */ | ||
| 228 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 229 | } | ||
| 230 | |||
| 231 | static void winchip2_protect_mcr(void) | ||
| 232 | { | ||
| 233 | u32 lo, hi; | ||
| 234 | |||
| 235 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 236 | lo &= ~0x1C0; /* blank bits 8-6 */ | ||
| 237 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 238 | } | ||
| 239 | #endif /* CONFIG_X86_OOSTORE */ | ||
| 240 | |||
| 241 | #define ACE_PRESENT (1 << 6) | 11 | #define ACE_PRESENT (1 << 6) |
| 242 | #define ACE_ENABLED (1 << 7) | 12 | #define ACE_ENABLED (1 << 7) |
| 243 | #define ACE_FCR (1 << 28) /* MSR_VIA_FCR */ | 13 | #define ACE_FCR (1 << 28) /* MSR_VIA_FCR */ |
| @@ -362,20 +132,6 @@ static void init_centaur(struct cpuinfo_x86 *c) | |||
| 362 | fcr_clr = DPDC; | 132 | fcr_clr = DPDC; |
| 363 | printk(KERN_NOTICE "Disabling bugged TSC.\n"); | 133 | printk(KERN_NOTICE "Disabling bugged TSC.\n"); |
| 364 | clear_cpu_cap(c, X86_FEATURE_TSC); | 134 | clear_cpu_cap(c, X86_FEATURE_TSC); |
| 365 | #ifdef CONFIG_X86_OOSTORE | ||
| 366 | centaur_create_optimal_mcr(); | ||
| 367 | /* | ||
| 368 | * Enable: | ||
| 369 | * write combining on non-stack, non-string | ||
| 370 | * write combining on string, all types | ||
| 371 | * weak write ordering | ||
| 372 | * | ||
| 373 | * The C6 original lacks weak read order | ||
| 374 | * | ||
| 375 | * Note 0x120 is write only on Winchip 1 | ||
| 376 | */ | ||
| 377 | wrmsr(MSR_IDT_MCR_CTRL, 0x01F0001F, 0); | ||
| 378 | #endif | ||
| 379 | break; | 135 | break; |
| 380 | case 8: | 136 | case 8: |
| 381 | switch (c->x86_mask) { | 137 | switch (c->x86_mask) { |
| @@ -392,40 +148,12 @@ static void init_centaur(struct cpuinfo_x86 *c) | |||
| 392 | fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| | 148 | fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| |
| 393 | E2MMX|EAMD3D; | 149 | E2MMX|EAMD3D; |
| 394 | fcr_clr = DPDC; | 150 | fcr_clr = DPDC; |
| 395 | #ifdef CONFIG_X86_OOSTORE | ||
| 396 | winchip2_unprotect_mcr(); | ||
| 397 | winchip2_create_optimal_mcr(); | ||
| 398 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 399 | /* | ||
| 400 | * Enable: | ||
| 401 | * write combining on non-stack, non-string | ||
| 402 | * write combining on string, all types | ||
| 403 | * weak write ordering | ||
| 404 | */ | ||
| 405 | lo |= 31; | ||
| 406 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 407 | winchip2_protect_mcr(); | ||
| 408 | #endif | ||
| 409 | break; | 151 | break; |
| 410 | case 9: | 152 | case 9: |
| 411 | name = "3"; | 153 | name = "3"; |
| 412 | fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| | 154 | fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| |
| 413 | E2MMX|EAMD3D; | 155 | E2MMX|EAMD3D; |
| 414 | fcr_clr = DPDC; | 156 | fcr_clr = DPDC; |
| 415 | #ifdef CONFIG_X86_OOSTORE | ||
| 416 | winchip2_unprotect_mcr(); | ||
| 417 | winchip2_create_optimal_mcr(); | ||
| 418 | rdmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 419 | /* | ||
| 420 | * Enable: | ||
| 421 | * write combining on non-stack, non-string | ||
| 422 | * write combining on string, all types | ||
| 423 | * weak write ordering | ||
| 424 | */ | ||
| 425 | lo |= 31; | ||
| 426 | wrmsr(MSR_IDT_MCR_CTRL, lo, hi); | ||
| 427 | winchip2_protect_mcr(); | ||
| 428 | #endif | ||
| 429 | break; | 157 | break; |
| 430 | default: | 158 | default: |
| 431 | name = "??"; | 159 | name = "??"; |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index e81df8fce027..2de1bc09a8d4 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
| @@ -3002,10 +3002,8 @@ static int cr8_write_interception(struct vcpu_svm *svm) | |||
| 3002 | u8 cr8_prev = kvm_get_cr8(&svm->vcpu); | 3002 | u8 cr8_prev = kvm_get_cr8(&svm->vcpu); |
| 3003 | /* instruction emulation calls kvm_set_cr8() */ | 3003 | /* instruction emulation calls kvm_set_cr8() */ |
| 3004 | r = cr_interception(svm); | 3004 | r = cr_interception(svm); |
| 3005 | if (irqchip_in_kernel(svm->vcpu.kvm)) { | 3005 | if (irqchip_in_kernel(svm->vcpu.kvm)) |
| 3006 | clr_cr_intercept(svm, INTERCEPT_CR8_WRITE); | ||
| 3007 | return r; | 3006 | return r; |
| 3008 | } | ||
| 3009 | if (cr8_prev <= kvm_get_cr8(&svm->vcpu)) | 3007 | if (cr8_prev <= kvm_get_cr8(&svm->vcpu)) |
| 3010 | return r; | 3008 | return r; |
| 3011 | kvm_run->exit_reason = KVM_EXIT_SET_TPR; | 3009 | kvm_run->exit_reason = KVM_EXIT_SET_TPR; |
| @@ -3567,6 +3565,8 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr) | |||
| 3567 | if (is_guest_mode(vcpu) && (vcpu->arch.hflags & HF_VINTR_MASK)) | 3565 | if (is_guest_mode(vcpu) && (vcpu->arch.hflags & HF_VINTR_MASK)) |
| 3568 | return; | 3566 | return; |
| 3569 | 3567 | ||
| 3568 | clr_cr_intercept(svm, INTERCEPT_CR8_WRITE); | ||
| 3569 | |||
| 3570 | if (irr == -1) | 3570 | if (irr == -1) |
| 3571 | return; | 3571 | return; |
| 3572 | 3572 | ||
diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h index 7d01b8c56c00..cc04e67bfd05 100644 --- a/arch/x86/um/asm/barrier.h +++ b/arch/x86/um/asm/barrier.h | |||
| @@ -40,11 +40,7 @@ | |||
| 40 | #define smp_rmb() barrier() | 40 | #define smp_rmb() barrier() |
| 41 | #endif /* CONFIG_X86_PPRO_FENCE */ | 41 | #endif /* CONFIG_X86_PPRO_FENCE */ |
| 42 | 42 | ||
| 43 | #ifdef CONFIG_X86_OOSTORE | ||
| 44 | #define smp_wmb() wmb() | ||
| 45 | #else /* CONFIG_X86_OOSTORE */ | ||
| 46 | #define smp_wmb() barrier() | 43 | #define smp_wmb() barrier() |
| 47 | #endif /* CONFIG_X86_OOSTORE */ | ||
| 48 | 44 | ||
| 49 | #define smp_read_barrier_depends() read_barrier_depends() | 45 | #define smp_read_barrier_depends() read_barrier_depends() |
| 50 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) | 46 | #define set_mb(var, value) do { (void)xchg(&var, value); } while (0) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 65d3f1b5966c..8cb2522d592a 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4225,8 +4225,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 4225 | 4225 | ||
| 4226 | /* devices that don't properly handle queued TRIM commands */ | 4226 | /* devices that don't properly handle queued TRIM commands */ |
| 4227 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4227 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
| 4228 | { "Crucial_CT???M500SSD1", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4228 | { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, |
| 4229 | { "Crucial_CT???M500SSD3", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
| 4230 | 4229 | ||
| 4231 | /* | 4230 | /* |
| 4232 | * Some WD SATA-I drives spin up and down erratically when the link | 4231 | * Some WD SATA-I drives spin up and down erratically when the link |
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index b9e2000969f0..95c894482fdd 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
| @@ -240,7 +240,7 @@ xpc_create_gru_mq_uv(unsigned int mq_size, int cpu, char *irq_name, | |||
| 240 | 240 | ||
| 241 | nid = cpu_to_node(cpu); | 241 | nid = cpu_to_node(cpu); |
| 242 | page = alloc_pages_exact_node(nid, | 242 | page = alloc_pages_exact_node(nid, |
| 243 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 243 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
| 244 | pg_order); | 244 | pg_order); |
| 245 | if (page == NULL) { | 245 | if (page == NULL) { |
| 246 | dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to alloc %d " | 246 | dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to alloc %d " |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index cf32f0393369..c0f3718b77a8 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
| @@ -513,7 +513,7 @@ struct cifs_mnt_data { | |||
| 513 | static inline unsigned int | 513 | static inline unsigned int |
| 514 | get_rfc1002_length(void *buf) | 514 | get_rfc1002_length(void *buf) |
| 515 | { | 515 | { |
| 516 | return be32_to_cpu(*((__be32 *)buf)); | 516 | return be32_to_cpu(*((__be32 *)buf)) & 0xffffff; |
| 517 | } | 517 | } |
| 518 | 518 | ||
| 519 | static inline void | 519 | static inline void |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 53c15074bb36..834fce759d80 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
| @@ -2579,31 +2579,19 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov, | |||
| 2579 | struct cifsInodeInfo *cinode = CIFS_I(inode); | 2579 | struct cifsInodeInfo *cinode = CIFS_I(inode); |
| 2580 | struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; | 2580 | struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; |
| 2581 | ssize_t rc = -EACCES; | 2581 | ssize_t rc = -EACCES; |
| 2582 | loff_t lock_pos = pos; | ||
| 2582 | 2583 | ||
| 2583 | BUG_ON(iocb->ki_pos != pos); | 2584 | if (file->f_flags & O_APPEND) |
| 2584 | 2585 | lock_pos = i_size_read(inode); | |
| 2585 | /* | 2586 | /* |
| 2586 | * We need to hold the sem to be sure nobody modifies lock list | 2587 | * We need to hold the sem to be sure nobody modifies lock list |
| 2587 | * with a brlock that prevents writing. | 2588 | * with a brlock that prevents writing. |
| 2588 | */ | 2589 | */ |
| 2589 | down_read(&cinode->lock_sem); | 2590 | down_read(&cinode->lock_sem); |
| 2590 | if (!cifs_find_lock_conflict(cfile, pos, iov_length(iov, nr_segs), | 2591 | if (!cifs_find_lock_conflict(cfile, lock_pos, iov_length(iov, nr_segs), |
| 2591 | server->vals->exclusive_lock_type, NULL, | 2592 | server->vals->exclusive_lock_type, NULL, |
| 2592 | CIFS_WRITE_OP)) { | 2593 | CIFS_WRITE_OP)) |
| 2593 | mutex_lock(&inode->i_mutex); | 2594 | rc = generic_file_aio_write(iocb, iov, nr_segs, pos); |
| 2594 | rc = __generic_file_aio_write(iocb, iov, nr_segs, | ||
| 2595 | &iocb->ki_pos); | ||
| 2596 | mutex_unlock(&inode->i_mutex); | ||
| 2597 | } | ||
| 2598 | |||
| 2599 | if (rc > 0) { | ||
| 2600 | ssize_t err; | ||
| 2601 | |||
| 2602 | err = generic_write_sync(file, iocb->ki_pos - rc, rc); | ||
| 2603 | if (err < 0) | ||
| 2604 | rc = err; | ||
| 2605 | } | ||
| 2606 | |||
| 2607 | up_read(&cinode->lock_sem); | 2595 | up_read(&cinode->lock_sem); |
| 2608 | return rc; | 2596 | return rc; |
| 2609 | } | 2597 | } |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index b37570952846..18cd5650a5fc 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
| @@ -270,6 +270,26 @@ cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx, | |||
| 270 | iov->iov_len = rqst->rq_pagesz; | 270 | iov->iov_len = rqst->rq_pagesz; |
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | static unsigned long | ||
| 274 | rqst_len(struct smb_rqst *rqst) | ||
| 275 | { | ||
| 276 | unsigned int i; | ||
| 277 | struct kvec *iov = rqst->rq_iov; | ||
| 278 | unsigned long buflen = 0; | ||
| 279 | |||
| 280 | /* total up iov array first */ | ||
| 281 | for (i = 0; i < rqst->rq_nvec; i++) | ||
| 282 | buflen += iov[i].iov_len; | ||
| 283 | |||
| 284 | /* add in the page array if there is one */ | ||
| 285 | if (rqst->rq_npages) { | ||
| 286 | buflen += rqst->rq_pagesz * (rqst->rq_npages - 1); | ||
| 287 | buflen += rqst->rq_tailsz; | ||
| 288 | } | ||
| 289 | |||
| 290 | return buflen; | ||
| 291 | } | ||
| 292 | |||
| 273 | static int | 293 | static int |
| 274 | smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) | 294 | smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) |
| 275 | { | 295 | { |
| @@ -277,6 +297,7 @@ smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) | |||
| 277 | struct kvec *iov = rqst->rq_iov; | 297 | struct kvec *iov = rqst->rq_iov; |
| 278 | int n_vec = rqst->rq_nvec; | 298 | int n_vec = rqst->rq_nvec; |
| 279 | unsigned int smb_buf_length = get_rfc1002_length(iov[0].iov_base); | 299 | unsigned int smb_buf_length = get_rfc1002_length(iov[0].iov_base); |
| 300 | unsigned long send_length; | ||
| 280 | unsigned int i; | 301 | unsigned int i; |
| 281 | size_t total_len = 0, sent; | 302 | size_t total_len = 0, sent; |
| 282 | struct socket *ssocket = server->ssocket; | 303 | struct socket *ssocket = server->ssocket; |
| @@ -285,6 +306,14 @@ smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) | |||
| 285 | if (ssocket == NULL) | 306 | if (ssocket == NULL) |
| 286 | return -ENOTSOCK; | 307 | return -ENOTSOCK; |
| 287 | 308 | ||
| 309 | /* sanity check send length */ | ||
| 310 | send_length = rqst_len(rqst); | ||
| 311 | if (send_length != smb_buf_length + 4) { | ||
| 312 | WARN(1, "Send length mismatch(send_length=%lu smb_buf_length=%u)\n", | ||
| 313 | send_length, smb_buf_length); | ||
| 314 | return -EIO; | ||
| 315 | } | ||
| 316 | |||
| 288 | cifs_dbg(FYI, "Sending smb: smb_len=%u\n", smb_buf_length); | 317 | cifs_dbg(FYI, "Sending smb: smb_len=%u\n", smb_buf_length); |
| 289 | dump_smb(iov[0].iov_base, iov[0].iov_len); | 318 | dump_smb(iov[0].iov_base, iov[0].iov_len); |
| 290 | 319 | ||
| @@ -683,35 +683,65 @@ EXPORT_SYMBOL(fget_raw); | |||
| 683 | * The fput_needed flag returned by fget_light should be passed to the | 683 | * The fput_needed flag returned by fget_light should be passed to the |
| 684 | * corresponding fput_light. | 684 | * corresponding fput_light. |
| 685 | */ | 685 | */ |
| 686 | struct file *__fget_light(unsigned int fd, fmode_t mask, int *fput_needed) | 686 | static unsigned long __fget_light(unsigned int fd, fmode_t mask) |
| 687 | { | 687 | { |
| 688 | struct files_struct *files = current->files; | 688 | struct files_struct *files = current->files; |
| 689 | struct file *file; | 689 | struct file *file; |
| 690 | 690 | ||
| 691 | *fput_needed = 0; | ||
| 692 | if (atomic_read(&files->count) == 1) { | 691 | if (atomic_read(&files->count) == 1) { |
| 693 | file = __fcheck_files(files, fd); | 692 | file = __fcheck_files(files, fd); |
| 694 | if (file && (file->f_mode & mask)) | 693 | if (!file || unlikely(file->f_mode & mask)) |
| 695 | file = NULL; | 694 | return 0; |
| 695 | return (unsigned long)file; | ||
| 696 | } else { | 696 | } else { |
| 697 | file = __fget(fd, mask); | 697 | file = __fget(fd, mask); |
| 698 | if (file) | 698 | if (!file) |
| 699 | *fput_needed = 1; | 699 | return 0; |
| 700 | return FDPUT_FPUT | (unsigned long)file; | ||
| 700 | } | 701 | } |
| 701 | |||
| 702 | return file; | ||
| 703 | } | 702 | } |
| 704 | struct file *fget_light(unsigned int fd, int *fput_needed) | 703 | unsigned long __fdget(unsigned int fd) |
| 705 | { | 704 | { |
| 706 | return __fget_light(fd, FMODE_PATH, fput_needed); | 705 | return __fget_light(fd, FMODE_PATH); |
| 707 | } | 706 | } |
| 708 | EXPORT_SYMBOL(fget_light); | 707 | EXPORT_SYMBOL(__fdget); |
| 709 | 708 | ||
| 710 | struct file *fget_raw_light(unsigned int fd, int *fput_needed) | 709 | unsigned long __fdget_raw(unsigned int fd) |
| 711 | { | 710 | { |
| 712 | return __fget_light(fd, 0, fput_needed); | 711 | return __fget_light(fd, 0); |
| 712 | } | ||
| 713 | |||
| 714 | unsigned long __fdget_pos(unsigned int fd) | ||
| 715 | { | ||
| 716 | struct files_struct *files = current->files; | ||
| 717 | struct file *file; | ||
| 718 | unsigned long v; | ||
| 719 | |||
| 720 | if (atomic_read(&files->count) == 1) { | ||
| 721 | file = __fcheck_files(files, fd); | ||
| 722 | v = 0; | ||
| 723 | } else { | ||
| 724 | file = __fget(fd, 0); | ||
| 725 | v = FDPUT_FPUT; | ||
| 726 | } | ||
| 727 | if (!file) | ||
| 728 | return 0; | ||
| 729 | |||
| 730 | if (file->f_mode & FMODE_ATOMIC_POS) { | ||
| 731 | if (file_count(file) > 1) { | ||
| 732 | v |= FDPUT_POS_UNLOCK; | ||
| 733 | mutex_lock(&file->f_pos_lock); | ||
| 734 | } | ||
| 735 | } | ||
| 736 | return v | (unsigned long)file; | ||
| 713 | } | 737 | } |
| 714 | 738 | ||
| 739 | /* | ||
| 740 | * We only lock f_pos if we have threads or if the file might be | ||
| 741 | * shared with another process. In both cases we'll have an elevated | ||
| 742 | * file count (done either by fdget() or by fork()). | ||
| 743 | */ | ||
| 744 | |||
| 715 | void set_close_on_exec(unsigned int fd, int flag) | 745 | void set_close_on_exec(unsigned int fd, int flag) |
| 716 | { | 746 | { |
| 717 | struct files_struct *files = current->files; | 747 | struct files_struct *files = current->files; |
diff --git a/fs/file_table.c b/fs/file_table.c index 5fff9030be34..5b24008ea4f6 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
| @@ -135,6 +135,7 @@ struct file *get_empty_filp(void) | |||
| 135 | atomic_long_set(&f->f_count, 1); | 135 | atomic_long_set(&f->f_count, 1); |
| 136 | rwlock_init(&f->f_owner.lock); | 136 | rwlock_init(&f->f_owner.lock); |
| 137 | spin_lock_init(&f->f_lock); | 137 | spin_lock_init(&f->f_lock); |
| 138 | mutex_init(&f->f_pos_lock); | ||
| 138 | eventpoll_init_file(f); | 139 | eventpoll_init_file(f); |
| 139 | /* f->f_version: 0 */ | 140 | /* f->f_version: 0 */ |
| 140 | return f; | 141 | return f; |
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index 968ce411db53..32602c667b4a 100644 --- a/fs/hfsplus/catalog.c +++ b/fs/hfsplus/catalog.c | |||
| @@ -103,6 +103,8 @@ static int hfsplus_cat_build_record(hfsplus_cat_entry *entry, | |||
| 103 | folder = &entry->folder; | 103 | folder = &entry->folder; |
| 104 | memset(folder, 0, sizeof(*folder)); | 104 | memset(folder, 0, sizeof(*folder)); |
| 105 | folder->type = cpu_to_be16(HFSPLUS_FOLDER); | 105 | folder->type = cpu_to_be16(HFSPLUS_FOLDER); |
| 106 | if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags)) | ||
| 107 | folder->flags |= cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT); | ||
| 106 | folder->id = cpu_to_be32(inode->i_ino); | 108 | folder->id = cpu_to_be32(inode->i_ino); |
| 107 | HFSPLUS_I(inode)->create_date = | 109 | HFSPLUS_I(inode)->create_date = |
| 108 | folder->create_date = | 110 | folder->create_date = |
| @@ -203,6 +205,36 @@ int hfsplus_find_cat(struct super_block *sb, u32 cnid, | |||
| 203 | return hfs_brec_find(fd, hfs_find_rec_by_key); | 205 | return hfs_brec_find(fd, hfs_find_rec_by_key); |
| 204 | } | 206 | } |
| 205 | 207 | ||
| 208 | static void hfsplus_subfolders_inc(struct inode *dir) | ||
| 209 | { | ||
| 210 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | ||
| 211 | |||
| 212 | if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags)) { | ||
| 213 | /* | ||
| 214 | * Increment subfolder count. Note, the value is only meaningful | ||
| 215 | * for folders with HFSPLUS_HAS_FOLDER_COUNT flag set. | ||
| 216 | */ | ||
| 217 | HFSPLUS_I(dir)->subfolders++; | ||
| 218 | } | ||
| 219 | } | ||
| 220 | |||
| 221 | static void hfsplus_subfolders_dec(struct inode *dir) | ||
| 222 | { | ||
| 223 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | ||
| 224 | |||
| 225 | if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags)) { | ||
| 226 | /* | ||
| 227 | * Decrement subfolder count. Note, the value is only meaningful | ||
| 228 | * for folders with HFSPLUS_HAS_FOLDER_COUNT flag set. | ||
| 229 | * | ||
| 230 | * Check for zero. Some subfolders may have been created | ||
| 231 | * by an implementation ignorant of this counter. | ||
| 232 | */ | ||
| 233 | if (HFSPLUS_I(dir)->subfolders) | ||
| 234 | HFSPLUS_I(dir)->subfolders--; | ||
| 235 | } | ||
| 236 | } | ||
| 237 | |||
| 206 | int hfsplus_create_cat(u32 cnid, struct inode *dir, | 238 | int hfsplus_create_cat(u32 cnid, struct inode *dir, |
| 207 | struct qstr *str, struct inode *inode) | 239 | struct qstr *str, struct inode *inode) |
| 208 | { | 240 | { |
| @@ -247,6 +279,8 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir, | |||
| 247 | goto err1; | 279 | goto err1; |
| 248 | 280 | ||
| 249 | dir->i_size++; | 281 | dir->i_size++; |
| 282 | if (S_ISDIR(inode->i_mode)) | ||
| 283 | hfsplus_subfolders_inc(dir); | ||
| 250 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; | 284 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; |
| 251 | hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); | 285 | hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); |
| 252 | 286 | ||
| @@ -336,6 +370,8 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str) | |||
| 336 | goto out; | 370 | goto out; |
| 337 | 371 | ||
| 338 | dir->i_size--; | 372 | dir->i_size--; |
| 373 | if (type == HFSPLUS_FOLDER) | ||
| 374 | hfsplus_subfolders_dec(dir); | ||
| 339 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; | 375 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; |
| 340 | hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); | 376 | hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); |
| 341 | 377 | ||
| @@ -380,6 +416,7 @@ int hfsplus_rename_cat(u32 cnid, | |||
| 380 | 416 | ||
| 381 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, | 417 | hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset, |
| 382 | src_fd.entrylength); | 418 | src_fd.entrylength); |
| 419 | type = be16_to_cpu(entry.type); | ||
| 383 | 420 | ||
| 384 | /* create new dir entry with the data from the old entry */ | 421 | /* create new dir entry with the data from the old entry */ |
| 385 | hfsplus_cat_build_key(sb, dst_fd.search_key, dst_dir->i_ino, dst_name); | 422 | hfsplus_cat_build_key(sb, dst_fd.search_key, dst_dir->i_ino, dst_name); |
| @@ -394,6 +431,8 @@ int hfsplus_rename_cat(u32 cnid, | |||
| 394 | if (err) | 431 | if (err) |
| 395 | goto out; | 432 | goto out; |
| 396 | dst_dir->i_size++; | 433 | dst_dir->i_size++; |
| 434 | if (type == HFSPLUS_FOLDER) | ||
| 435 | hfsplus_subfolders_inc(dst_dir); | ||
| 397 | dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC; | 436 | dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC; |
| 398 | 437 | ||
| 399 | /* finally remove the old entry */ | 438 | /* finally remove the old entry */ |
| @@ -405,6 +444,8 @@ int hfsplus_rename_cat(u32 cnid, | |||
| 405 | if (err) | 444 | if (err) |
| 406 | goto out; | 445 | goto out; |
| 407 | src_dir->i_size--; | 446 | src_dir->i_size--; |
| 447 | if (type == HFSPLUS_FOLDER) | ||
| 448 | hfsplus_subfolders_dec(src_dir); | ||
| 408 | src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC; | 449 | src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC; |
| 409 | 450 | ||
| 410 | /* remove old thread entry */ | 451 | /* remove old thread entry */ |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 08846425b67f..62d571eb69ba 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
| @@ -242,6 +242,7 @@ struct hfsplus_inode_info { | |||
| 242 | */ | 242 | */ |
| 243 | sector_t fs_blocks; | 243 | sector_t fs_blocks; |
| 244 | u8 userflags; /* BSD user file flags */ | 244 | u8 userflags; /* BSD user file flags */ |
| 245 | u32 subfolders; /* Subfolder count (HFSX only) */ | ||
| 245 | struct list_head open_dir_list; | 246 | struct list_head open_dir_list; |
| 246 | loff_t phys_size; | 247 | loff_t phys_size; |
| 247 | 248 | ||
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h index 8ffb3a8ffe75..5a126828d85e 100644 --- a/fs/hfsplus/hfsplus_raw.h +++ b/fs/hfsplus/hfsplus_raw.h | |||
| @@ -261,7 +261,7 @@ struct hfsplus_cat_folder { | |||
| 261 | struct DInfo user_info; | 261 | struct DInfo user_info; |
| 262 | struct DXInfo finder_info; | 262 | struct DXInfo finder_info; |
| 263 | __be32 text_encoding; | 263 | __be32 text_encoding; |
| 264 | u32 reserved; | 264 | __be32 subfolders; /* Subfolder count in HFSX. Reserved in HFS+. */ |
| 265 | } __packed; | 265 | } __packed; |
| 266 | 266 | ||
| 267 | /* HFS file info (stolen from hfs.h) */ | 267 | /* HFS file info (stolen from hfs.h) */ |
| @@ -301,11 +301,13 @@ struct hfsplus_cat_file { | |||
| 301 | struct hfsplus_fork_raw rsrc_fork; | 301 | struct hfsplus_fork_raw rsrc_fork; |
| 302 | } __packed; | 302 | } __packed; |
| 303 | 303 | ||
| 304 | /* File attribute bits */ | 304 | /* File and folder flag bits */ |
| 305 | #define HFSPLUS_FILE_LOCKED 0x0001 | 305 | #define HFSPLUS_FILE_LOCKED 0x0001 |
| 306 | #define HFSPLUS_FILE_THREAD_EXISTS 0x0002 | 306 | #define HFSPLUS_FILE_THREAD_EXISTS 0x0002 |
| 307 | #define HFSPLUS_XATTR_EXISTS 0x0004 | 307 | #define HFSPLUS_XATTR_EXISTS 0x0004 |
| 308 | #define HFSPLUS_ACL_EXISTS 0x0008 | 308 | #define HFSPLUS_ACL_EXISTS 0x0008 |
| 309 | #define HFSPLUS_HAS_FOLDER_COUNT 0x0010 /* Folder has subfolder count | ||
| 310 | * (HFSX only) */ | ||
| 309 | 311 | ||
| 310 | /* HFS+ catalog thread (part of a cat_entry) */ | 312 | /* HFS+ catalog thread (part of a cat_entry) */ |
| 311 | struct hfsplus_cat_thread { | 313 | struct hfsplus_cat_thread { |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index fa929f325f87..a4f45bd88a63 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
| @@ -375,6 +375,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, umode_t mode) | |||
| 375 | hip->extent_state = 0; | 375 | hip->extent_state = 0; |
| 376 | hip->flags = 0; | 376 | hip->flags = 0; |
| 377 | hip->userflags = 0; | 377 | hip->userflags = 0; |
| 378 | hip->subfolders = 0; | ||
| 378 | memset(hip->first_extents, 0, sizeof(hfsplus_extent_rec)); | 379 | memset(hip->first_extents, 0, sizeof(hfsplus_extent_rec)); |
| 379 | memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); | 380 | memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); |
| 380 | hip->alloc_blocks = 0; | 381 | hip->alloc_blocks = 0; |
| @@ -494,6 +495,10 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd) | |||
| 494 | inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date); | 495 | inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date); |
| 495 | HFSPLUS_I(inode)->create_date = folder->create_date; | 496 | HFSPLUS_I(inode)->create_date = folder->create_date; |
| 496 | HFSPLUS_I(inode)->fs_blocks = 0; | 497 | HFSPLUS_I(inode)->fs_blocks = 0; |
| 498 | if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { | ||
| 499 | HFSPLUS_I(inode)->subfolders = | ||
| 500 | be32_to_cpu(folder->subfolders); | ||
| 501 | } | ||
| 497 | inode->i_op = &hfsplus_dir_inode_operations; | 502 | inode->i_op = &hfsplus_dir_inode_operations; |
| 498 | inode->i_fop = &hfsplus_dir_operations; | 503 | inode->i_fop = &hfsplus_dir_operations; |
| 499 | } else if (type == HFSPLUS_FILE) { | 504 | } else if (type == HFSPLUS_FILE) { |
| @@ -566,6 +571,10 @@ int hfsplus_cat_write_inode(struct inode *inode) | |||
| 566 | folder->content_mod_date = hfsp_ut2mt(inode->i_mtime); | 571 | folder->content_mod_date = hfsp_ut2mt(inode->i_mtime); |
| 567 | folder->attribute_mod_date = hfsp_ut2mt(inode->i_ctime); | 572 | folder->attribute_mod_date = hfsp_ut2mt(inode->i_ctime); |
| 568 | folder->valence = cpu_to_be32(inode->i_size - 2); | 573 | folder->valence = cpu_to_be32(inode->i_size - 2); |
| 574 | if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { | ||
| 575 | folder->subfolders = | ||
| 576 | cpu_to_be32(HFSPLUS_I(inode)->subfolders); | ||
| 577 | } | ||
| 569 | hfs_bnode_write(fd.bnode, &entry, fd.entryoffset, | 578 | hfs_bnode_write(fd.bnode, &entry, fd.entryoffset, |
| 570 | sizeof(struct hfsplus_cat_folder)); | 579 | sizeof(struct hfsplus_cat_folder)); |
| 571 | } else if (HFSPLUS_IS_RSRC(inode)) { | 580 | } else if (HFSPLUS_IS_RSRC(inode)) { |
diff --git a/fs/namei.c b/fs/namei.c index 385f7817bfcc..2f730ef9b4b3 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -1884,7 +1884,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, | |||
| 1884 | 1884 | ||
| 1885 | nd->path = f.file->f_path; | 1885 | nd->path = f.file->f_path; |
| 1886 | if (flags & LOOKUP_RCU) { | 1886 | if (flags & LOOKUP_RCU) { |
| 1887 | if (f.need_put) | 1887 | if (f.flags & FDPUT_FPUT) |
| 1888 | *fp = f.file; | 1888 | *fp = f.file; |
| 1889 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); | 1889 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); |
| 1890 | rcu_read_lock(); | 1890 | rcu_read_lock(); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 8450262bcf2a..51632c40e896 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
| @@ -2393,8 +2393,8 @@ out_dio: | |||
| 2393 | 2393 | ||
| 2394 | if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || | 2394 | if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || |
| 2395 | ((file->f_flags & O_DIRECT) && !direct_io)) { | 2395 | ((file->f_flags & O_DIRECT) && !direct_io)) { |
| 2396 | ret = filemap_fdatawrite_range(file->f_mapping, pos, | 2396 | ret = filemap_fdatawrite_range(file->f_mapping, *ppos, |
| 2397 | pos + count - 1); | 2397 | *ppos + count - 1); |
| 2398 | if (ret < 0) | 2398 | if (ret < 0) |
| 2399 | written = ret; | 2399 | written = ret; |
| 2400 | 2400 | ||
| @@ -2407,8 +2407,8 @@ out_dio: | |||
| 2407 | } | 2407 | } |
| 2408 | 2408 | ||
| 2409 | if (!ret) | 2409 | if (!ret) |
| 2410 | ret = filemap_fdatawait_range(file->f_mapping, pos, | 2410 | ret = filemap_fdatawait_range(file->f_mapping, *ppos, |
| 2411 | pos + count - 1); | 2411 | *ppos + count - 1); |
| 2412 | } | 2412 | } |
| 2413 | 2413 | ||
| 2414 | /* | 2414 | /* |
| @@ -705,6 +705,10 @@ static int do_dentry_open(struct file *f, | |||
| 705 | return 0; | 705 | return 0; |
| 706 | } | 706 | } |
| 707 | 707 | ||
| 708 | /* POSIX.1-2008/SUSv4 Section XSI 2.9.7 */ | ||
| 709 | if (S_ISREG(inode->i_mode)) | ||
| 710 | f->f_mode |= FMODE_ATOMIC_POS; | ||
| 711 | |||
| 708 | f->f_op = fops_get(inode->i_fop); | 712 | f->f_op = fops_get(inode->i_fop); |
| 709 | if (unlikely(WARN_ON(!f->f_op))) { | 713 | if (unlikely(WARN_ON(!f->f_op))) { |
| 710 | error = -ENODEV; | 714 | error = -ENODEV; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 51507065263b..b9760628e1fd 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
| @@ -1824,6 +1824,7 @@ static int proc_map_files_get_link(struct dentry *dentry, struct path *path) | |||
| 1824 | if (rc) | 1824 | if (rc) |
| 1825 | goto out_mmput; | 1825 | goto out_mmput; |
| 1826 | 1826 | ||
| 1827 | rc = -ENOENT; | ||
| 1827 | down_read(&mm->mmap_sem); | 1828 | down_read(&mm->mmap_sem); |
| 1828 | vma = find_exact_vma(mm, vm_start, vm_end); | 1829 | vma = find_exact_vma(mm, vm_start, vm_end); |
| 1829 | if (vma && vma->vm_file) { | 1830 | if (vma && vma->vm_file) { |
diff --git a/fs/read_write.c b/fs/read_write.c index edc5746a902a..54e19b9392dc 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
| @@ -264,10 +264,22 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int whence) | |||
| 264 | } | 264 | } |
| 265 | EXPORT_SYMBOL(vfs_llseek); | 265 | EXPORT_SYMBOL(vfs_llseek); |
| 266 | 266 | ||
| 267 | static inline struct fd fdget_pos(int fd) | ||
| 268 | { | ||
| 269 | return __to_fd(__fdget_pos(fd)); | ||
| 270 | } | ||
| 271 | |||
| 272 | static inline void fdput_pos(struct fd f) | ||
| 273 | { | ||
| 274 | if (f.flags & FDPUT_POS_UNLOCK) | ||
| 275 | mutex_unlock(&f.file->f_pos_lock); | ||
| 276 | fdput(f); | ||
| 277 | } | ||
| 278 | |||
| 267 | SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence) | 279 | SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence) |
| 268 | { | 280 | { |
| 269 | off_t retval; | 281 | off_t retval; |
| 270 | struct fd f = fdget(fd); | 282 | struct fd f = fdget_pos(fd); |
| 271 | if (!f.file) | 283 | if (!f.file) |
| 272 | return -EBADF; | 284 | return -EBADF; |
| 273 | 285 | ||
| @@ -278,7 +290,7 @@ SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence) | |||
| 278 | if (res != (loff_t)retval) | 290 | if (res != (loff_t)retval) |
| 279 | retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */ | 291 | retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */ |
| 280 | } | 292 | } |
| 281 | fdput(f); | 293 | fdput_pos(f); |
| 282 | return retval; | 294 | return retval; |
| 283 | } | 295 | } |
| 284 | 296 | ||
| @@ -498,7 +510,7 @@ static inline void file_pos_write(struct file *file, loff_t pos) | |||
| 498 | 510 | ||
| 499 | SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) | 511 | SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) |
| 500 | { | 512 | { |
| 501 | struct fd f = fdget(fd); | 513 | struct fd f = fdget_pos(fd); |
| 502 | ssize_t ret = -EBADF; | 514 | ssize_t ret = -EBADF; |
| 503 | 515 | ||
| 504 | if (f.file) { | 516 | if (f.file) { |
| @@ -506,7 +518,7 @@ SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) | |||
| 506 | ret = vfs_read(f.file, buf, count, &pos); | 518 | ret = vfs_read(f.file, buf, count, &pos); |
| 507 | if (ret >= 0) | 519 | if (ret >= 0) |
| 508 | file_pos_write(f.file, pos); | 520 | file_pos_write(f.file, pos); |
| 509 | fdput(f); | 521 | fdput_pos(f); |
| 510 | } | 522 | } |
| 511 | return ret; | 523 | return ret; |
| 512 | } | 524 | } |
| @@ -514,7 +526,7 @@ SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) | |||
| 514 | SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, | 526 | SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, |
| 515 | size_t, count) | 527 | size_t, count) |
| 516 | { | 528 | { |
| 517 | struct fd f = fdget(fd); | 529 | struct fd f = fdget_pos(fd); |
| 518 | ssize_t ret = -EBADF; | 530 | ssize_t ret = -EBADF; |
| 519 | 531 | ||
| 520 | if (f.file) { | 532 | if (f.file) { |
| @@ -522,7 +534,7 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, | |||
| 522 | ret = vfs_write(f.file, buf, count, &pos); | 534 | ret = vfs_write(f.file, buf, count, &pos); |
| 523 | if (ret >= 0) | 535 | if (ret >= 0) |
| 524 | file_pos_write(f.file, pos); | 536 | file_pos_write(f.file, pos); |
| 525 | fdput(f); | 537 | fdput_pos(f); |
| 526 | } | 538 | } |
| 527 | 539 | ||
| 528 | return ret; | 540 | return ret; |
| @@ -797,7 +809,7 @@ EXPORT_SYMBOL(vfs_writev); | |||
| 797 | SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec, | 809 | SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec, |
| 798 | unsigned long, vlen) | 810 | unsigned long, vlen) |
| 799 | { | 811 | { |
| 800 | struct fd f = fdget(fd); | 812 | struct fd f = fdget_pos(fd); |
| 801 | ssize_t ret = -EBADF; | 813 | ssize_t ret = -EBADF; |
| 802 | 814 | ||
| 803 | if (f.file) { | 815 | if (f.file) { |
| @@ -805,7 +817,7 @@ SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec, | |||
| 805 | ret = vfs_readv(f.file, vec, vlen, &pos); | 817 | ret = vfs_readv(f.file, vec, vlen, &pos); |
| 806 | if (ret >= 0) | 818 | if (ret >= 0) |
| 807 | file_pos_write(f.file, pos); | 819 | file_pos_write(f.file, pos); |
| 808 | fdput(f); | 820 | fdput_pos(f); |
| 809 | } | 821 | } |
| 810 | 822 | ||
| 811 | if (ret > 0) | 823 | if (ret > 0) |
| @@ -817,7 +829,7 @@ SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec, | |||
| 817 | SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec, | 829 | SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec, |
| 818 | unsigned long, vlen) | 830 | unsigned long, vlen) |
| 819 | { | 831 | { |
| 820 | struct fd f = fdget(fd); | 832 | struct fd f = fdget_pos(fd); |
| 821 | ssize_t ret = -EBADF; | 833 | ssize_t ret = -EBADF; |
| 822 | 834 | ||
| 823 | if (f.file) { | 835 | if (f.file) { |
| @@ -825,7 +837,7 @@ SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec, | |||
| 825 | ret = vfs_writev(f.file, vec, vlen, &pos); | 837 | ret = vfs_writev(f.file, vec, vlen, &pos); |
| 826 | if (ret >= 0) | 838 | if (ret >= 0) |
| 827 | file_pos_write(f.file, pos); | 839 | file_pos_write(f.file, pos); |
| 828 | fdput(f); | 840 | fdput_pos(f); |
| 829 | } | 841 | } |
| 830 | 842 | ||
| 831 | if (ret > 0) | 843 | if (ret > 0) |
| @@ -968,7 +980,7 @@ COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd, | |||
| 968 | const struct compat_iovec __user *,vec, | 980 | const struct compat_iovec __user *,vec, |
| 969 | compat_ulong_t, vlen) | 981 | compat_ulong_t, vlen) |
| 970 | { | 982 | { |
| 971 | struct fd f = fdget(fd); | 983 | struct fd f = fdget_pos(fd); |
| 972 | ssize_t ret; | 984 | ssize_t ret; |
| 973 | loff_t pos; | 985 | loff_t pos; |
| 974 | 986 | ||
| @@ -978,7 +990,7 @@ COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd, | |||
| 978 | ret = compat_readv(f.file, vec, vlen, &pos); | 990 | ret = compat_readv(f.file, vec, vlen, &pos); |
| 979 | if (ret >= 0) | 991 | if (ret >= 0) |
| 980 | f.file->f_pos = pos; | 992 | f.file->f_pos = pos; |
| 981 | fdput(f); | 993 | fdput_pos(f); |
| 982 | return ret; | 994 | return ret; |
| 983 | } | 995 | } |
| 984 | 996 | ||
| @@ -1035,7 +1047,7 @@ COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd, | |||
| 1035 | const struct compat_iovec __user *, vec, | 1047 | const struct compat_iovec __user *, vec, |
| 1036 | compat_ulong_t, vlen) | 1048 | compat_ulong_t, vlen) |
| 1037 | { | 1049 | { |
| 1038 | struct fd f = fdget(fd); | 1050 | struct fd f = fdget_pos(fd); |
| 1039 | ssize_t ret; | 1051 | ssize_t ret; |
| 1040 | loff_t pos; | 1052 | loff_t pos; |
| 1041 | 1053 | ||
| @@ -1045,7 +1057,7 @@ COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd, | |||
| 1045 | ret = compat_writev(f.file, vec, vlen, &pos); | 1057 | ret = compat_writev(f.file, vec, vlen, &pos); |
| 1046 | if (ret >= 0) | 1058 | if (ret >= 0) |
| 1047 | f.file->f_pos = pos; | 1059 | f.file->f_pos = pos; |
| 1048 | fdput(f); | 1060 | fdput_pos(f); |
| 1049 | return ret; | 1061 | return ret; |
| 1050 | } | 1062 | } |
| 1051 | 1063 | ||
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index be85127bfed3..f27000f55a83 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h | |||
| @@ -171,6 +171,11 @@ static inline int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 add | |||
| 171 | return 0; | 171 | return 0; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | static inline int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write) | ||
| 175 | { | ||
| 176 | return -ENXIO; | ||
| 177 | } | ||
| 178 | |||
| 174 | static inline int kvm_vgic_init(struct kvm *kvm) | 179 | static inline int kvm_vgic_init(struct kvm *kvm) |
| 175 | { | 180 | { |
| 176 | return 0; | 181 | return 0; |
diff --git a/include/linux/audit.h b/include/linux/audit.h index aa865a9a4c4f..ec1464df4c60 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -43,6 +43,7 @@ struct mq_attr; | |||
| 43 | struct mqstat; | 43 | struct mqstat; |
| 44 | struct audit_watch; | 44 | struct audit_watch; |
| 45 | struct audit_tree; | 45 | struct audit_tree; |
| 46 | struct sk_buff; | ||
| 46 | 47 | ||
| 47 | struct audit_krule { | 48 | struct audit_krule { |
| 48 | int vers_ops; | 49 | int vers_ops; |
| @@ -463,7 +464,7 @@ extern int audit_filter_user(int type); | |||
| 463 | extern int audit_filter_type(int type); | 464 | extern int audit_filter_type(int type); |
| 464 | extern int audit_rule_change(int type, __u32 portid, int seq, | 465 | extern int audit_rule_change(int type, __u32 portid, int seq, |
| 465 | void *data, size_t datasz); | 466 | void *data, size_t datasz); |
| 466 | extern int audit_list_rules_send(__u32 portid, int seq); | 467 | extern int audit_list_rules_send(struct sk_buff *request_skb, int seq); |
| 467 | 468 | ||
| 468 | extern u32 audit_enabled; | 469 | extern u32 audit_enabled; |
| 469 | #else /* CONFIG_AUDIT */ | 470 | #else /* CONFIG_AUDIT */ |
diff --git a/include/linux/file.h b/include/linux/file.h index cbacf4faf447..4d69123377a2 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -28,33 +28,36 @@ static inline void fput_light(struct file *file, int fput_needed) | |||
| 28 | 28 | ||
| 29 | struct fd { | 29 | struct fd { |
| 30 | struct file *file; | 30 | struct file *file; |
| 31 | int need_put; | 31 | unsigned int flags; |
| 32 | }; | 32 | }; |
| 33 | #define FDPUT_FPUT 1 | ||
| 34 | #define FDPUT_POS_UNLOCK 2 | ||
| 33 | 35 | ||
| 34 | static inline void fdput(struct fd fd) | 36 | static inline void fdput(struct fd fd) |
| 35 | { | 37 | { |
| 36 | if (fd.need_put) | 38 | if (fd.flags & FDPUT_FPUT) |
| 37 | fput(fd.file); | 39 | fput(fd.file); |
| 38 | } | 40 | } |
| 39 | 41 | ||
| 40 | extern struct file *fget(unsigned int fd); | 42 | extern struct file *fget(unsigned int fd); |
| 41 | extern struct file *fget_light(unsigned int fd, int *fput_needed); | 43 | extern struct file *fget_raw(unsigned int fd); |
| 44 | extern unsigned long __fdget(unsigned int fd); | ||
| 45 | extern unsigned long __fdget_raw(unsigned int fd); | ||
| 46 | extern unsigned long __fdget_pos(unsigned int fd); | ||
| 42 | 47 | ||
| 43 | static inline struct fd fdget(unsigned int fd) | 48 | static inline struct fd __to_fd(unsigned long v) |
| 44 | { | 49 | { |
| 45 | int b; | 50 | return (struct fd){(struct file *)(v & ~3),v & 3}; |
| 46 | struct file *f = fget_light(fd, &b); | ||
| 47 | return (struct fd){f,b}; | ||
| 48 | } | 51 | } |
| 49 | 52 | ||
| 50 | extern struct file *fget_raw(unsigned int fd); | 53 | static inline struct fd fdget(unsigned int fd) |
| 51 | extern struct file *fget_raw_light(unsigned int fd, int *fput_needed); | 54 | { |
| 55 | return __to_fd(__fdget(fd)); | ||
| 56 | } | ||
| 52 | 57 | ||
| 53 | static inline struct fd fdget_raw(unsigned int fd) | 58 | static inline struct fd fdget_raw(unsigned int fd) |
| 54 | { | 59 | { |
| 55 | int b; | 60 | return __to_fd(__fdget_raw(fd)); |
| 56 | struct file *f = fget_raw_light(fd, &b); | ||
| 57 | return (struct fd){f,b}; | ||
| 58 | } | 61 | } |
| 59 | 62 | ||
| 60 | extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); | 63 | extern int f_dupfd(unsigned int from, struct file *file, unsigned flags); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 60829565e552..23b2a35d712e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -123,6 +123,9 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, | |||
| 123 | /* File is opened with O_PATH; almost nothing can be done with it */ | 123 | /* File is opened with O_PATH; almost nothing can be done with it */ |
| 124 | #define FMODE_PATH ((__force fmode_t)0x4000) | 124 | #define FMODE_PATH ((__force fmode_t)0x4000) |
| 125 | 125 | ||
| 126 | /* File needs atomic accesses to f_pos */ | ||
| 127 | #define FMODE_ATOMIC_POS ((__force fmode_t)0x8000) | ||
| 128 | |||
| 126 | /* File was opened by fanotify and shouldn't generate fanotify events */ | 129 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
| 127 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) | 130 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) |
| 128 | 131 | ||
| @@ -780,13 +783,14 @@ struct file { | |||
| 780 | const struct file_operations *f_op; | 783 | const struct file_operations *f_op; |
| 781 | 784 | ||
| 782 | /* | 785 | /* |
| 783 | * Protects f_ep_links, f_flags, f_pos vs i_size in lseek SEEK_CUR. | 786 | * Protects f_ep_links, f_flags. |
| 784 | * Must not be taken from IRQ context. | 787 | * Must not be taken from IRQ context. |
| 785 | */ | 788 | */ |
| 786 | spinlock_t f_lock; | 789 | spinlock_t f_lock; |
| 787 | atomic_long_t f_count; | 790 | atomic_long_t f_count; |
| 788 | unsigned int f_flags; | 791 | unsigned int f_flags; |
| 789 | fmode_t f_mode; | 792 | fmode_t f_mode; |
| 793 | struct mutex f_pos_lock; | ||
| 790 | loff_t f_pos; | 794 | loff_t f_pos; |
| 791 | struct fown_struct f_owner; | 795 | struct fown_struct f_owner; |
| 792 | const struct cred *f_cred; | 796 | const struct cred *f_cred; |
| @@ -808,7 +812,7 @@ struct file { | |||
| 808 | #ifdef CONFIG_DEBUG_WRITECOUNT | 812 | #ifdef CONFIG_DEBUG_WRITECOUNT |
| 809 | unsigned long f_mnt_write_state; | 813 | unsigned long f_mnt_write_state; |
| 810 | #endif | 814 | #endif |
| 811 | }; | 815 | } __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ |
| 812 | 816 | ||
| 813 | struct file_handle { | 817 | struct file_handle { |
| 814 | __u32 handle_bytes; | 818 | __u32 handle_bytes; |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 0437439bc047..39b81dc7d01a 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
| @@ -123,6 +123,10 @@ struct vm_area_struct; | |||
| 123 | __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ | 123 | __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ |
| 124 | __GFP_NO_KSWAPD) | 124 | __GFP_NO_KSWAPD) |
| 125 | 125 | ||
| 126 | /* | ||
| 127 | * GFP_THISNODE does not perform any reclaim, you most likely want to | ||
| 128 | * use __GFP_THISNODE to allocate from a given node without fallback! | ||
| 129 | */ | ||
| 126 | #ifdef CONFIG_NUMA | 130 | #ifdef CONFIG_NUMA |
| 127 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) | 131 | #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) |
| 128 | #else | 132 | #else |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 5f2052c83154..9b61b9bf81ac 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
| @@ -590,10 +590,10 @@ static inline bool zone_is_empty(struct zone *zone) | |||
| 590 | 590 | ||
| 591 | /* | 591 | /* |
| 592 | * The NUMA zonelists are doubled because we need zonelists that restrict the | 592 | * The NUMA zonelists are doubled because we need zonelists that restrict the |
| 593 | * allocations to a single node for GFP_THISNODE. | 593 | * allocations to a single node for __GFP_THISNODE. |
| 594 | * | 594 | * |
| 595 | * [0] : Zonelist with fallback | 595 | * [0] : Zonelist with fallback |
| 596 | * [1] : No fallback (GFP_THISNODE) | 596 | * [1] : No fallback (__GFP_THISNODE) |
| 597 | */ | 597 | */ |
| 598 | #define MAX_ZONELISTS 2 | 598 | #define MAX_ZONELISTS 2 |
| 599 | 599 | ||
diff --git a/include/linux/slab.h b/include/linux/slab.h index 9260abdd67df..b5b2df60299e 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -410,7 +410,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) | |||
| 410 | * | 410 | * |
| 411 | * %GFP_NOWAIT - Allocation will not sleep. | 411 | * %GFP_NOWAIT - Allocation will not sleep. |
| 412 | * | 412 | * |
| 413 | * %GFP_THISNODE - Allocate node-local memory only. | 413 | * %__GFP_THISNODE - Allocate node-local memory only. |
| 414 | * | 414 | * |
| 415 | * %GFP_DMA - Allocation suitable for DMA. | 415 | * %GFP_DMA - Allocation suitable for DMA. |
| 416 | * Should only be used for kmalloc() caches. Otherwise, use a | 416 | * Should only be used for kmalloc() caches. Otherwise, use a |
diff --git a/kernel/audit.c b/kernel/audit.c index 34c5a2310fbf..3392d3e0254a 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
| @@ -182,7 +182,7 @@ struct audit_buffer { | |||
| 182 | 182 | ||
| 183 | struct audit_reply { | 183 | struct audit_reply { |
| 184 | __u32 portid; | 184 | __u32 portid; |
| 185 | pid_t pid; | 185 | struct net *net; |
| 186 | struct sk_buff *skb; | 186 | struct sk_buff *skb; |
| 187 | }; | 187 | }; |
| 188 | 188 | ||
| @@ -500,7 +500,7 @@ int audit_send_list(void *_dest) | |||
| 500 | { | 500 | { |
| 501 | struct audit_netlink_list *dest = _dest; | 501 | struct audit_netlink_list *dest = _dest; |
| 502 | struct sk_buff *skb; | 502 | struct sk_buff *skb; |
| 503 | struct net *net = get_net_ns_by_pid(dest->pid); | 503 | struct net *net = dest->net; |
| 504 | struct audit_net *aunet = net_generic(net, audit_net_id); | 504 | struct audit_net *aunet = net_generic(net, audit_net_id); |
| 505 | 505 | ||
| 506 | /* wait for parent to finish and send an ACK */ | 506 | /* wait for parent to finish and send an ACK */ |
| @@ -510,6 +510,7 @@ int audit_send_list(void *_dest) | |||
| 510 | while ((skb = __skb_dequeue(&dest->q)) != NULL) | 510 | while ((skb = __skb_dequeue(&dest->q)) != NULL) |
| 511 | netlink_unicast(aunet->nlsk, skb, dest->portid, 0); | 511 | netlink_unicast(aunet->nlsk, skb, dest->portid, 0); |
| 512 | 512 | ||
| 513 | put_net(net); | ||
| 513 | kfree(dest); | 514 | kfree(dest); |
| 514 | 515 | ||
| 515 | return 0; | 516 | return 0; |
| @@ -543,7 +544,7 @@ out_kfree_skb: | |||
| 543 | static int audit_send_reply_thread(void *arg) | 544 | static int audit_send_reply_thread(void *arg) |
| 544 | { | 545 | { |
| 545 | struct audit_reply *reply = (struct audit_reply *)arg; | 546 | struct audit_reply *reply = (struct audit_reply *)arg; |
| 546 | struct net *net = get_net_ns_by_pid(reply->pid); | 547 | struct net *net = reply->net; |
| 547 | struct audit_net *aunet = net_generic(net, audit_net_id); | 548 | struct audit_net *aunet = net_generic(net, audit_net_id); |
| 548 | 549 | ||
| 549 | mutex_lock(&audit_cmd_mutex); | 550 | mutex_lock(&audit_cmd_mutex); |
| @@ -552,12 +553,13 @@ static int audit_send_reply_thread(void *arg) | |||
| 552 | /* Ignore failure. It'll only happen if the sender goes away, | 553 | /* Ignore failure. It'll only happen if the sender goes away, |
| 553 | because our timeout is set to infinite. */ | 554 | because our timeout is set to infinite. */ |
| 554 | netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0); | 555 | netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0); |
| 556 | put_net(net); | ||
| 555 | kfree(reply); | 557 | kfree(reply); |
| 556 | return 0; | 558 | return 0; |
| 557 | } | 559 | } |
| 558 | /** | 560 | /** |
| 559 | * audit_send_reply - send an audit reply message via netlink | 561 | * audit_send_reply - send an audit reply message via netlink |
| 560 | * @portid: netlink port to which to send reply | 562 | * @request_skb: skb of request we are replying to (used to target the reply) |
| 561 | * @seq: sequence number | 563 | * @seq: sequence number |
| 562 | * @type: audit message type | 564 | * @type: audit message type |
| 563 | * @done: done (last) flag | 565 | * @done: done (last) flag |
| @@ -568,9 +570,11 @@ static int audit_send_reply_thread(void *arg) | |||
| 568 | * Allocates an skb, builds the netlink message, and sends it to the port id. | 570 | * Allocates an skb, builds the netlink message, and sends it to the port id. |
| 569 | * No failure notifications. | 571 | * No failure notifications. |
| 570 | */ | 572 | */ |
| 571 | static void audit_send_reply(__u32 portid, int seq, int type, int done, | 573 | static void audit_send_reply(struct sk_buff *request_skb, int seq, int type, int done, |
| 572 | int multi, const void *payload, int size) | 574 | int multi, const void *payload, int size) |
| 573 | { | 575 | { |
| 576 | u32 portid = NETLINK_CB(request_skb).portid; | ||
| 577 | struct net *net = sock_net(NETLINK_CB(request_skb).sk); | ||
| 574 | struct sk_buff *skb; | 578 | struct sk_buff *skb; |
| 575 | struct task_struct *tsk; | 579 | struct task_struct *tsk; |
| 576 | struct audit_reply *reply = kmalloc(sizeof(struct audit_reply), | 580 | struct audit_reply *reply = kmalloc(sizeof(struct audit_reply), |
| @@ -583,8 +587,8 @@ static void audit_send_reply(__u32 portid, int seq, int type, int done, | |||
| 583 | if (!skb) | 587 | if (!skb) |
| 584 | goto out; | 588 | goto out; |
| 585 | 589 | ||
| 590 | reply->net = get_net(net); | ||
| 586 | reply->portid = portid; | 591 | reply->portid = portid; |
| 587 | reply->pid = task_pid_vnr(current); | ||
| 588 | reply->skb = skb; | 592 | reply->skb = skb; |
| 589 | 593 | ||
| 590 | tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply"); | 594 | tsk = kthread_run(audit_send_reply_thread, reply, "audit_send_reply"); |
| @@ -673,8 +677,7 @@ static int audit_get_feature(struct sk_buff *skb) | |||
| 673 | 677 | ||
| 674 | seq = nlmsg_hdr(skb)->nlmsg_seq; | 678 | seq = nlmsg_hdr(skb)->nlmsg_seq; |
| 675 | 679 | ||
| 676 | audit_send_reply(NETLINK_CB(skb).portid, seq, AUDIT_GET, 0, 0, | 680 | audit_send_reply(skb, seq, AUDIT_GET, 0, 0, &af, sizeof(af)); |
| 677 | &af, sizeof(af)); | ||
| 678 | 681 | ||
| 679 | return 0; | 682 | return 0; |
| 680 | } | 683 | } |
| @@ -794,8 +797,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 794 | s.backlog = skb_queue_len(&audit_skb_queue); | 797 | s.backlog = skb_queue_len(&audit_skb_queue); |
| 795 | s.version = AUDIT_VERSION_LATEST; | 798 | s.version = AUDIT_VERSION_LATEST; |
| 796 | s.backlog_wait_time = audit_backlog_wait_time; | 799 | s.backlog_wait_time = audit_backlog_wait_time; |
| 797 | audit_send_reply(NETLINK_CB(skb).portid, seq, AUDIT_GET, 0, 0, | 800 | audit_send_reply(skb, seq, AUDIT_GET, 0, 0, &s, sizeof(s)); |
| 798 | &s, sizeof(s)); | ||
| 799 | break; | 801 | break; |
| 800 | } | 802 | } |
| 801 | case AUDIT_SET: { | 803 | case AUDIT_SET: { |
| @@ -905,7 +907,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 905 | seq, data, nlmsg_len(nlh)); | 907 | seq, data, nlmsg_len(nlh)); |
| 906 | break; | 908 | break; |
| 907 | case AUDIT_LIST_RULES: | 909 | case AUDIT_LIST_RULES: |
| 908 | err = audit_list_rules_send(NETLINK_CB(skb).portid, seq); | 910 | err = audit_list_rules_send(skb, seq); |
| 909 | break; | 911 | break; |
| 910 | case AUDIT_TRIM: | 912 | case AUDIT_TRIM: |
| 911 | audit_trim_trees(); | 913 | audit_trim_trees(); |
| @@ -970,8 +972,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 970 | memcpy(sig_data->ctx, ctx, len); | 972 | memcpy(sig_data->ctx, ctx, len); |
| 971 | security_release_secctx(ctx, len); | 973 | security_release_secctx(ctx, len); |
| 972 | } | 974 | } |
| 973 | audit_send_reply(NETLINK_CB(skb).portid, seq, AUDIT_SIGNAL_INFO, | 975 | audit_send_reply(skb, seq, AUDIT_SIGNAL_INFO, 0, 0, |
| 974 | 0, 0, sig_data, sizeof(*sig_data) + len); | 976 | sig_data, sizeof(*sig_data) + len); |
| 975 | kfree(sig_data); | 977 | kfree(sig_data); |
| 976 | break; | 978 | break; |
| 977 | case AUDIT_TTY_GET: { | 979 | case AUDIT_TTY_GET: { |
| @@ -983,8 +985,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
| 983 | s.log_passwd = tsk->signal->audit_tty_log_passwd; | 985 | s.log_passwd = tsk->signal->audit_tty_log_passwd; |
| 984 | spin_unlock(&tsk->sighand->siglock); | 986 | spin_unlock(&tsk->sighand->siglock); |
| 985 | 987 | ||
| 986 | audit_send_reply(NETLINK_CB(skb).portid, seq, | 988 | audit_send_reply(skb, seq, AUDIT_TTY_GET, 0, 0, &s, sizeof(s)); |
| 987 | AUDIT_TTY_GET, 0, 0, &s, sizeof(s)); | ||
| 988 | break; | 989 | break; |
| 989 | } | 990 | } |
| 990 | case AUDIT_TTY_SET: { | 991 | case AUDIT_TTY_SET: { |
diff --git a/kernel/audit.h b/kernel/audit.h index 57cc64d67718..8df132214606 100644 --- a/kernel/audit.h +++ b/kernel/audit.h | |||
| @@ -247,7 +247,7 @@ extern void audit_panic(const char *message); | |||
| 247 | 247 | ||
| 248 | struct audit_netlink_list { | 248 | struct audit_netlink_list { |
| 249 | __u32 portid; | 249 | __u32 portid; |
| 250 | pid_t pid; | 250 | struct net *net; |
| 251 | struct sk_buff_head q; | 251 | struct sk_buff_head q; |
| 252 | }; | 252 | }; |
| 253 | 253 | ||
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 14a78cca384e..92062fd6cc8c 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
| @@ -29,6 +29,8 @@ | |||
| 29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
| 30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
| 31 | #include <linux/security.h> | 31 | #include <linux/security.h> |
| 32 | #include <net/net_namespace.h> | ||
| 33 | #include <net/sock.h> | ||
| 32 | #include "audit.h" | 34 | #include "audit.h" |
| 33 | 35 | ||
| 34 | /* | 36 | /* |
| @@ -1065,11 +1067,13 @@ int audit_rule_change(int type, __u32 portid, int seq, void *data, | |||
| 1065 | 1067 | ||
| 1066 | /** | 1068 | /** |
| 1067 | * audit_list_rules_send - list the audit rules | 1069 | * audit_list_rules_send - list the audit rules |
| 1068 | * @portid: target portid for netlink audit messages | 1070 | * @request_skb: skb of request we are replying to (used to target the reply) |
| 1069 | * @seq: netlink audit message sequence (serial) number | 1071 | * @seq: netlink audit message sequence (serial) number |
| 1070 | */ | 1072 | */ |
| 1071 | int audit_list_rules_send(__u32 portid, int seq) | 1073 | int audit_list_rules_send(struct sk_buff *request_skb, int seq) |
| 1072 | { | 1074 | { |
| 1075 | u32 portid = NETLINK_CB(request_skb).portid; | ||
| 1076 | struct net *net = sock_net(NETLINK_CB(request_skb).sk); | ||
| 1073 | struct task_struct *tsk; | 1077 | struct task_struct *tsk; |
| 1074 | struct audit_netlink_list *dest; | 1078 | struct audit_netlink_list *dest; |
| 1075 | int err = 0; | 1079 | int err = 0; |
| @@ -1083,8 +1087,8 @@ int audit_list_rules_send(__u32 portid, int seq) | |||
| 1083 | dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL); | 1087 | dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL); |
| 1084 | if (!dest) | 1088 | if (!dest) |
| 1085 | return -ENOMEM; | 1089 | return -ENOMEM; |
| 1090 | dest->net = get_net(net); | ||
| 1086 | dest->portid = portid; | 1091 | dest->portid = portid; |
| 1087 | dest->pid = task_pid_vnr(current); | ||
| 1088 | skb_queue_head_init(&dest->q); | 1092 | skb_queue_head_init(&dest->q); |
| 1089 | 1093 | ||
| 1090 | mutex_lock(&audit_filter_mutex); | 1094 | mutex_lock(&audit_filter_mutex); |
diff --git a/kernel/profile.c b/kernel/profile.c index 6631e1ef55ab..ebdd9c1a86b4 100644 --- a/kernel/profile.c +++ b/kernel/profile.c | |||
| @@ -549,14 +549,14 @@ static int create_hash_tables(void) | |||
| 549 | struct page *page; | 549 | struct page *page; |
| 550 | 550 | ||
| 551 | page = alloc_pages_exact_node(node, | 551 | page = alloc_pages_exact_node(node, |
| 552 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 552 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
| 553 | 0); | 553 | 0); |
| 554 | if (!page) | 554 | if (!page) |
| 555 | goto out_cleanup; | 555 | goto out_cleanup; |
| 556 | per_cpu(cpu_profile_hits, cpu)[1] | 556 | per_cpu(cpu_profile_hits, cpu)[1] |
| 557 | = (struct profile_hit *)page_address(page); | 557 | = (struct profile_hit *)page_address(page); |
| 558 | page = alloc_pages_exact_node(node, | 558 | page = alloc_pages_exact_node(node, |
| 559 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 559 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
| 560 | 0); | 560 | 0); |
| 561 | if (!page) | 561 | if (!page) |
| 562 | goto out_cleanup; | 562 | goto out_cleanup; |
diff --git a/mm/Kconfig b/mm/Kconfig index 2d9f1504d75e..2888024e0b0a 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
| @@ -575,5 +575,5 @@ config PGTABLE_MAPPING | |||
| 575 | then you should select this. This causes zsmalloc to use page table | 575 | then you should select this. This causes zsmalloc to use page table |
| 576 | mapping rather than copying for object mapping. | 576 | mapping rather than copying for object mapping. |
| 577 | 577 | ||
| 578 | You can check speed with zsmalloc benchmark[1]. | 578 | You can check speed with zsmalloc benchmark: |
| 579 | [1] https://github.com/spartacus06/zsmalloc | 579 | https://github.com/spartacus06/zsmapbench |
diff --git a/mm/compaction.c b/mm/compaction.c index b48c5259ea33..918577595ea8 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
| @@ -251,7 +251,6 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
| 251 | { | 251 | { |
| 252 | int nr_scanned = 0, total_isolated = 0; | 252 | int nr_scanned = 0, total_isolated = 0; |
| 253 | struct page *cursor, *valid_page = NULL; | 253 | struct page *cursor, *valid_page = NULL; |
| 254 | unsigned long nr_strict_required = end_pfn - blockpfn; | ||
| 255 | unsigned long flags; | 254 | unsigned long flags; |
| 256 | bool locked = false; | 255 | bool locked = false; |
| 257 | 256 | ||
| @@ -264,11 +263,12 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
| 264 | 263 | ||
| 265 | nr_scanned++; | 264 | nr_scanned++; |
| 266 | if (!pfn_valid_within(blockpfn)) | 265 | if (!pfn_valid_within(blockpfn)) |
| 267 | continue; | 266 | goto isolate_fail; |
| 267 | |||
| 268 | if (!valid_page) | 268 | if (!valid_page) |
| 269 | valid_page = page; | 269 | valid_page = page; |
| 270 | if (!PageBuddy(page)) | 270 | if (!PageBuddy(page)) |
| 271 | continue; | 271 | goto isolate_fail; |
| 272 | 272 | ||
| 273 | /* | 273 | /* |
| 274 | * The zone lock must be held to isolate freepages. | 274 | * The zone lock must be held to isolate freepages. |
| @@ -289,12 +289,10 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
| 289 | 289 | ||
| 290 | /* Recheck this is a buddy page under lock */ | 290 | /* Recheck this is a buddy page under lock */ |
| 291 | if (!PageBuddy(page)) | 291 | if (!PageBuddy(page)) |
| 292 | continue; | 292 | goto isolate_fail; |
| 293 | 293 | ||
| 294 | /* Found a free page, break it into order-0 pages */ | 294 | /* Found a free page, break it into order-0 pages */ |
| 295 | isolated = split_free_page(page); | 295 | isolated = split_free_page(page); |
| 296 | if (!isolated && strict) | ||
| 297 | break; | ||
| 298 | total_isolated += isolated; | 296 | total_isolated += isolated; |
| 299 | for (i = 0; i < isolated; i++) { | 297 | for (i = 0; i < isolated; i++) { |
| 300 | list_add(&page->lru, freelist); | 298 | list_add(&page->lru, freelist); |
| @@ -305,7 +303,15 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
| 305 | if (isolated) { | 303 | if (isolated) { |
| 306 | blockpfn += isolated - 1; | 304 | blockpfn += isolated - 1; |
| 307 | cursor += isolated - 1; | 305 | cursor += isolated - 1; |
| 306 | continue; | ||
| 308 | } | 307 | } |
| 308 | |||
| 309 | isolate_fail: | ||
| 310 | if (strict) | ||
| 311 | break; | ||
| 312 | else | ||
| 313 | continue; | ||
| 314 | |||
| 309 | } | 315 | } |
| 310 | 316 | ||
| 311 | trace_mm_compaction_isolate_freepages(nr_scanned, total_isolated); | 317 | trace_mm_compaction_isolate_freepages(nr_scanned, total_isolated); |
| @@ -315,7 +321,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
| 315 | * pages requested were isolated. If there were any failures, 0 is | 321 | * pages requested were isolated. If there were any failures, 0 is |
| 316 | * returned and CMA will fail. | 322 | * returned and CMA will fail. |
| 317 | */ | 323 | */ |
| 318 | if (strict && nr_strict_required > total_isolated) | 324 | if (strict && blockpfn < end_pfn) |
| 319 | total_isolated = 0; | 325 | total_isolated = 0; |
| 320 | 326 | ||
| 321 | if (locked) | 327 | if (locked) |
diff --git a/mm/migrate.c b/mm/migrate.c index 482a33d89134..b494fdb9a636 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
| @@ -1158,7 +1158,7 @@ static struct page *new_page_node(struct page *p, unsigned long private, | |||
| 1158 | pm->node); | 1158 | pm->node); |
| 1159 | else | 1159 | else |
| 1160 | return alloc_pages_exact_node(pm->node, | 1160 | return alloc_pages_exact_node(pm->node, |
| 1161 | GFP_HIGHUSER_MOVABLE | GFP_THISNODE, 0); | 1161 | GFP_HIGHUSER_MOVABLE | __GFP_THISNODE, 0); |
| 1162 | } | 1162 | } |
| 1163 | 1163 | ||
| 1164 | /* | 1164 | /* |
| @@ -1544,9 +1544,9 @@ static struct page *alloc_misplaced_dst_page(struct page *page, | |||
| 1544 | struct page *newpage; | 1544 | struct page *newpage; |
| 1545 | 1545 | ||
| 1546 | newpage = alloc_pages_exact_node(nid, | 1546 | newpage = alloc_pages_exact_node(nid, |
| 1547 | (GFP_HIGHUSER_MOVABLE | GFP_THISNODE | | 1547 | (GFP_HIGHUSER_MOVABLE | |
| 1548 | __GFP_NOMEMALLOC | __GFP_NORETRY | | 1548 | __GFP_THISNODE | __GFP_NOMEMALLOC | |
| 1549 | __GFP_NOWARN) & | 1549 | __GFP_NORETRY | __GFP_NOWARN) & |
| 1550 | ~GFP_IOFS, 0); | 1550 | ~GFP_IOFS, 0); |
| 1551 | 1551 | ||
| 1552 | return newpage; | 1552 | return newpage; |
| @@ -1747,7 +1747,8 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, | |||
| 1747 | goto out_dropref; | 1747 | goto out_dropref; |
| 1748 | 1748 | ||
| 1749 | new_page = alloc_pages_node(node, | 1749 | new_page = alloc_pages_node(node, |
| 1750 | (GFP_TRANSHUGE | GFP_THISNODE) & ~__GFP_WAIT, HPAGE_PMD_ORDER); | 1750 | (GFP_TRANSHUGE | __GFP_THISNODE) & ~__GFP_WAIT, |
| 1751 | HPAGE_PMD_ORDER); | ||
| 1751 | if (!new_page) | 1752 | if (!new_page) |
| 1752 | goto out_fail; | 1753 | goto out_fail; |
| 1753 | 1754 | ||
diff --git a/net/socket.c b/net/socket.c index 879933aaed4c..fd8d86e06f95 100644 --- a/net/socket.c +++ b/net/socket.c | |||
| @@ -450,16 +450,17 @@ EXPORT_SYMBOL(sockfd_lookup); | |||
| 450 | 450 | ||
| 451 | static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) | 451 | static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) |
| 452 | { | 452 | { |
| 453 | struct file *file; | 453 | struct fd f = fdget(fd); |
| 454 | struct socket *sock; | 454 | struct socket *sock; |
| 455 | 455 | ||
| 456 | *err = -EBADF; | 456 | *err = -EBADF; |
| 457 | file = fget_light(fd, fput_needed); | 457 | if (f.file) { |
| 458 | if (file) { | 458 | sock = sock_from_file(f.file, err); |
| 459 | sock = sock_from_file(file, err); | 459 | if (likely(sock)) { |
| 460 | if (sock) | 460 | *fput_needed = f.flags; |
| 461 | return sock; | 461 | return sock; |
| 462 | fput_light(file, *fput_needed); | 462 | } |
| 463 | fdput(f); | ||
| 463 | } | 464 | } |
| 464 | return NULL; | 465 | return NULL; |
| 465 | } | 466 | } |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 276e84b8a8e5..10085de886fe 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
| @@ -330,7 +330,8 @@ static void write_src(void) | |||
| 330 | printf("\tPTR\t_text + %#llx\n", | 330 | printf("\tPTR\t_text + %#llx\n", |
| 331 | table[i].addr - _text); | 331 | table[i].addr - _text); |
| 332 | else | 332 | else |
| 333 | printf("\tPTR\t%#llx\n", table[i].addr); | 333 | printf("\tPTR\t_text - %#llx\n", |
| 334 | _text - table[i].addr); | ||
| 334 | } else { | 335 | } else { |
| 335 | printf("\tPTR\t%#llx\n", table[i].addr); | 336 | printf("\tPTR\t%#llx\n", table[i].addr); |
| 336 | } | 337 | } |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 850296a1e0ff..8d0a84436674 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -3616,6 +3616,19 @@ static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, | |||
| 3616 | } | 3616 | } |
| 3617 | } | 3617 | } |
| 3618 | 3618 | ||
| 3619 | static void alc_no_shutup(struct hda_codec *codec) | ||
| 3620 | { | ||
| 3621 | } | ||
| 3622 | |||
| 3623 | static void alc_fixup_no_shutup(struct hda_codec *codec, | ||
| 3624 | const struct hda_fixup *fix, int action) | ||
| 3625 | { | ||
| 3626 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
| 3627 | struct alc_spec *spec = codec->spec; | ||
| 3628 | spec->shutup = alc_no_shutup; | ||
| 3629 | } | ||
| 3630 | } | ||
| 3631 | |||
| 3619 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, | 3632 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, |
| 3620 | const struct hda_fixup *fix, int action) | 3633 | const struct hda_fixup *fix, int action) |
| 3621 | { | 3634 | { |
| @@ -3844,6 +3857,7 @@ enum { | |||
| 3844 | ALC269_FIXUP_HP_GPIO_LED, | 3857 | ALC269_FIXUP_HP_GPIO_LED, |
| 3845 | ALC269_FIXUP_INV_DMIC, | 3858 | ALC269_FIXUP_INV_DMIC, |
| 3846 | ALC269_FIXUP_LENOVO_DOCK, | 3859 | ALC269_FIXUP_LENOVO_DOCK, |
| 3860 | ALC269_FIXUP_NO_SHUTUP, | ||
| 3847 | ALC286_FIXUP_SONY_MIC_NO_PRESENCE, | 3861 | ALC286_FIXUP_SONY_MIC_NO_PRESENCE, |
| 3848 | ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, | 3862 | ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, |
| 3849 | ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | 3863 | ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
| @@ -4020,6 +4034,10 @@ static const struct hda_fixup alc269_fixups[] = { | |||
| 4020 | .type = HDA_FIXUP_FUNC, | 4034 | .type = HDA_FIXUP_FUNC, |
| 4021 | .v.func = alc_fixup_inv_dmic_0x12, | 4035 | .v.func = alc_fixup_inv_dmic_0x12, |
| 4022 | }, | 4036 | }, |
| 4037 | [ALC269_FIXUP_NO_SHUTUP] = { | ||
| 4038 | .type = HDA_FIXUP_FUNC, | ||
| 4039 | .v.func = alc_fixup_no_shutup, | ||
| 4040 | }, | ||
| 4023 | [ALC269_FIXUP_LENOVO_DOCK] = { | 4041 | [ALC269_FIXUP_LENOVO_DOCK] = { |
| 4024 | .type = HDA_FIXUP_PINS, | 4042 | .type = HDA_FIXUP_PINS, |
| 4025 | .v.pins = (const struct hda_pintbl[]) { | 4043 | .v.pins = (const struct hda_pintbl[]) { |
| @@ -4405,6 +4423,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
| 4405 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4423 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 4406 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4424 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 4407 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4425 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 4426 | SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), | ||
| 4408 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4427 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 4409 | SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), | 4428 | SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), |
| 4410 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4429 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 75d0ad5d2dcb..647a72cda005 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c | |||
| @@ -1328,6 +1328,9 @@ static int pm860x_probe(struct snd_soc_codec *codec) | |||
| 1328 | pm860x->codec = codec; | 1328 | pm860x->codec = codec; |
| 1329 | 1329 | ||
| 1330 | codec->control_data = pm860x->regmap; | 1330 | codec->control_data = pm860x->regmap; |
| 1331 | ret = snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); | ||
| 1332 | if (ret) | ||
| 1333 | return ret; | ||
| 1331 | 1334 | ||
| 1332 | for (i = 0; i < 4; i++) { | 1335 | for (i = 0; i < 4; i++) { |
| 1333 | ret = request_threaded_irq(pm860x->irq[i], NULL, | 1336 | ret = request_threaded_irq(pm860x->irq[i], NULL, |
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c index 52e7cb08434b..fa2b8e07f420 100644 --- a/sound/soc/codecs/si476x.c +++ b/sound/soc/codecs/si476x.c | |||
| @@ -210,7 +210,7 @@ out: | |||
| 210 | static int si476x_codec_probe(struct snd_soc_codec *codec) | 210 | static int si476x_codec_probe(struct snd_soc_codec *codec) |
| 211 | { | 211 | { |
| 212 | codec->control_data = dev_get_regmap(codec->dev->parent, NULL); | 212 | codec->control_data = dev_get_regmap(codec->dev->parent, NULL); |
| 213 | return 0; | 213 | return snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | static struct snd_soc_dai_ops si476x_dai_ops = { | 216 | static struct snd_soc_dai_ops si476x_dai_ops = { |
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index 3fde9e402710..d163e18d85d4 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c | |||
| @@ -305,7 +305,9 @@ static int __init n810_soc_init(void) | |||
| 305 | int err; | 305 | int err; |
| 306 | struct device *dev; | 306 | struct device *dev; |
| 307 | 307 | ||
| 308 | if (!(machine_is_nokia_n810() || machine_is_nokia_n810_wimax())) | 308 | if (!of_have_populated_dt() || |
| 309 | (!of_machine_is_compatible("nokia,n810") && | ||
| 310 | !of_machine_is_compatible("nokia,n810-wimax"))) | ||
| 309 | return -ENODEV; | 311 | return -ENODEV; |
| 310 | 312 | ||
| 311 | n810_snd_device = platform_device_alloc("soc-audio", -1); | 313 | n810_snd_device = platform_device_alloc("soc-audio", -1); |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 47e1ce771e65..28522bd03b8e 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
| @@ -1989,6 +1989,7 @@ int soc_dpcm_runtime_update(struct snd_soc_card *card) | |||
| 1989 | 1989 | ||
| 1990 | paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list); | 1990 | paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list); |
| 1991 | if (paths < 0) { | 1991 | if (paths < 0) { |
| 1992 | dpcm_path_put(&list); | ||
| 1992 | dev_warn(fe->dev, "ASoC: %s no valid %s path\n", | 1993 | dev_warn(fe->dev, "ASoC: %s no valid %s path\n", |
| 1993 | fe->dai_link->name, "playback"); | 1994 | fe->dai_link->name, "playback"); |
| 1994 | mutex_unlock(&card->mutex); | 1995 | mutex_unlock(&card->mutex); |
| @@ -2018,6 +2019,7 @@ capture: | |||
| 2018 | 2019 | ||
| 2019 | paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list); | 2020 | paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list); |
| 2020 | if (paths < 0) { | 2021 | if (paths < 0) { |
| 2022 | dpcm_path_put(&list); | ||
| 2021 | dev_warn(fe->dev, "ASoC: %s no valid %s path\n", | 2023 | dev_warn(fe->dev, "ASoC: %s no valid %s path\n", |
| 2022 | fe->dai_link->name, "capture"); | 2024 | fe->dai_link->name, "capture"); |
| 2023 | mutex_unlock(&card->mutex); | 2025 | mutex_unlock(&card->mutex); |
| @@ -2082,6 +2084,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream) | |||
| 2082 | fe->dpcm[stream].runtime = fe_substream->runtime; | 2084 | fe->dpcm[stream].runtime = fe_substream->runtime; |
| 2083 | 2085 | ||
| 2084 | if (dpcm_path_get(fe, stream, &list) <= 0) { | 2086 | if (dpcm_path_get(fe, stream, &list) <= 0) { |
| 2087 | dpcm_path_put(&list); | ||
| 2085 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", | 2088 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", |
| 2086 | fe->dai_link->name, stream ? "capture" : "playback"); | 2089 | fe->dai_link->name, stream ? "capture" : "playback"); |
| 2087 | } | 2090 | } |
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index d66418237d21..aa290c0de6f5 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c | |||
| @@ -201,6 +201,7 @@ int main(int argc, char **argv) | |||
| 201 | 201 | ||
| 202 | msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666); | 202 | msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666); |
| 203 | if (msgque.msq_id == -1) { | 203 | if (msgque.msq_id == -1) { |
| 204 | err = -errno; | ||
| 204 | printf("Can't create queue\n"); | 205 | printf("Can't create queue\n"); |
| 205 | goto err_out; | 206 | goto err_out; |
| 206 | } | 207 | } |
