/[linux-patches]/genpatches-2.6/tags/3.0-30/1003_linux-3.0.4.patch
Gentoo

Contents of /genpatches-2.6/tags/3.0-30/1003_linux-3.0.4.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2206 - (show annotations) (download)
Mon Sep 17 18:58:14 2012 UTC (22 months ago) by mpagano
File size: 42089 byte(s)
3.0-30 release
1 diff --git a/Makefile b/Makefile
2 index c44d720..7d2192c 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 3
7 PATCHLEVEL = 0
8 -SUBLEVEL = 3
9 +SUBLEVEL = 4
10 EXTRAVERSION =
11 NAME = Sneaky Weasel
12
13 diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
14 index 64a619d..7ff4669 100644
15 --- a/arch/x86/include/asm/xen/page.h
16 +++ b/arch/x86/include/asm/xen/page.h
17 @@ -39,7 +39,7 @@ typedef struct xpaddr {
18 ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE))
19
20 extern unsigned long *machine_to_phys_mapping;
21 -extern unsigned int machine_to_phys_order;
22 +extern unsigned long machine_to_phys_nr;
23
24 extern unsigned long get_phys_to_machine(unsigned long pfn);
25 extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);
26 @@ -87,7 +87,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
27 if (xen_feature(XENFEAT_auto_translated_physmap))
28 return mfn;
29
30 - if (unlikely((mfn >> machine_to_phys_order) != 0)) {
31 + if (unlikely(mfn >= machine_to_phys_nr)) {
32 pfn = ~0;
33 goto try_override;
34 }
35 diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
36 index adc66c3..34b1859 100644
37 --- a/arch/x86/kernel/apic/x2apic_uv_x.c
38 +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
39 @@ -207,7 +207,6 @@ static int __cpuinit uv_wakeup_secondary(int phys_apicid, unsigned long start_ri
40 ((start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) |
41 APIC_DM_INIT;
42 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
43 - mdelay(10);
44
45 val = (1UL << UVH_IPI_INT_SEND_SHFT) |
46 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) |
47 diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
48 index da0d779..ed6086e 100644
49 --- a/arch/x86/kernel/cpu/intel.c
50 +++ b/arch/x86/kernel/cpu/intel.c
51 @@ -465,11 +465,11 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
52 u64 epb;
53
54 rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
55 - if ((epb & 0xF) == 0) {
56 - printk_once(KERN_WARNING, "x86: updated energy_perf_bias"
57 - " to 'normal' from 'performance'\n"
58 - "You can view and update epb via utility,"
59 - " such as x86_energy_perf_policy(8)\n");
60 + if ((epb & 0xF) == ENERGY_PERF_BIAS_PERFORMANCE) {
61 + printk_once(KERN_WARNING "ENERGY_PERF_BIAS:"
62 + " Set to 'normal', was 'performance'\n"
63 + "ENERGY_PERF_BIAS: View and update with"
64 + " x86_energy_perf_policy(8)\n");
65 epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;
66 wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
67 }
68 diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
69 index 929739a..3d17bc7 100644
70 --- a/arch/x86/kernel/cpu/mtrr/main.c
71 +++ b/arch/x86/kernel/cpu/mtrr/main.c
72 @@ -248,6 +248,25 @@ set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type typ
73 unsigned long flags;
74 int cpu;
75
76 +#ifdef CONFIG_SMP
77 + /*
78 + * If this cpu is not yet active, we are in the cpu online path. There
79 + * can be no stop_machine() in parallel, as stop machine ensures this
80 + * by using get_online_cpus(). We can skip taking the stop_cpus_mutex,
81 + * as we don't need it and also we can't afford to block while waiting
82 + * for the mutex.
83 + *
84 + * If this cpu is active, we need to prevent stop_machine() happening
85 + * in parallel by taking the stop cpus mutex.
86 + *
87 + * Also, this is called in the context of cpu online path or in the
88 + * context where cpu hotplug is prevented. So checking the active status
89 + * of the raw_smp_processor_id() is safe.
90 + */
91 + if (cpu_active(raw_smp_processor_id()))
92 + mutex_lock(&stop_cpus_mutex);
93 +#endif
94 +
95 preempt_disable();
96
97 data.smp_reg = reg;
98 @@ -330,6 +349,10 @@ set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type typ
99
100 local_irq_restore(flags);
101 preempt_enable();
102 +#ifdef CONFIG_SMP
103 + if (cpu_active(raw_smp_processor_id()))
104 + mutex_unlock(&stop_cpus_mutex);
105 +#endif
106 }
107
108 /**
109 diff --git a/arch/x86/platform/olpc/olpc.c b/arch/x86/platform/olpc/olpc.c
110 index 0060fd5..02e3934 100644
111 --- a/arch/x86/platform/olpc/olpc.c
112 +++ b/arch/x86/platform/olpc/olpc.c
113 @@ -157,13 +157,13 @@ restart:
114 if (inbuf && inlen) {
115 /* write data to EC */
116 for (i = 0; i < inlen; i++) {
117 + pr_devel("olpc-ec: sending cmd arg 0x%x\n", inbuf[i]);
118 + outb(inbuf[i], 0x68);
119 if (wait_on_ibf(0x6c, 0)) {
120 printk(KERN_ERR "olpc-ec: timeout waiting for"
121 " EC accept data!\n");
122 goto err;
123 }
124 - pr_devel("olpc-ec: sending cmd arg 0x%x\n", inbuf[i]);
125 - outb(inbuf[i], 0x68);
126 }
127 }
128 if (outbuf && outlen) {
129 diff --git a/arch/x86/vdso/vdso32/sysenter.S b/arch/x86/vdso/vdso32/sysenter.S
130 index e2800af..e354bce 100644
131 --- a/arch/x86/vdso/vdso32/sysenter.S
132 +++ b/arch/x86/vdso/vdso32/sysenter.S
133 @@ -43,7 +43,7 @@ __kernel_vsyscall:
134 .space 7,0x90
135
136 /* 14: System call restart point is here! (SYSENTER_RETURN-2) */
137 - jmp .Lenter_kernel
138 + int $0x80
139 /* 16: System call normal return point is here! */
140 VDSO32_SYSENTER_RETURN: /* Symbol used by sysenter.c via vdso32-syms.h */
141 pop %ebp
142 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
143 index 5325742..67d69f1 100644
144 --- a/arch/x86/xen/enlighten.c
145 +++ b/arch/x86/xen/enlighten.c
146 @@ -77,8 +77,8 @@ EXPORT_SYMBOL_GPL(xen_domain_type);
147
148 unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START;
149 EXPORT_SYMBOL(machine_to_phys_mapping);
150 -unsigned int machine_to_phys_order;
151 -EXPORT_SYMBOL(machine_to_phys_order);
152 +unsigned long machine_to_phys_nr;
153 +EXPORT_SYMBOL(machine_to_phys_nr);
154
155 struct start_info *xen_start_info;
156 EXPORT_SYMBOL_GPL(xen_start_info);
157 diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
158 index 0ccccb6..5f76c0a 100644
159 --- a/arch/x86/xen/mmu.c
160 +++ b/arch/x86/xen/mmu.c
161 @@ -1626,15 +1626,19 @@ static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
162 void __init xen_setup_machphys_mapping(void)
163 {
164 struct xen_machphys_mapping mapping;
165 - unsigned long machine_to_phys_nr_ents;
166
167 if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
168 machine_to_phys_mapping = (unsigned long *)mapping.v_start;
169 - machine_to_phys_nr_ents = mapping.max_mfn + 1;
170 + machine_to_phys_nr = mapping.max_mfn + 1;
171 } else {
172 - machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
173 + machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;
174 }
175 - machine_to_phys_order = fls(machine_to_phys_nr_ents - 1);
176 +#ifdef CONFIG_X86_32
177 + if ((machine_to_phys_mapping + machine_to_phys_nr)
178 + < machine_to_phys_mapping)
179 + machine_to_phys_nr = (unsigned long *)NULL
180 + - machine_to_phys_mapping;
181 +#endif
182 }
183
184 #ifdef CONFIG_X86_64
185 diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
186 index b4533a8..e79dbb9 100644
187 --- a/arch/x86/xen/smp.c
188 +++ b/arch/x86/xen/smp.c
189 @@ -521,8 +521,6 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
190 native_smp_prepare_cpus(max_cpus);
191 WARN_ON(xen_smp_intr_init(0));
192
193 - if (!xen_have_vector_callback)
194 - return;
195 xen_init_lock_cpu(0);
196 xen_init_spinlocks();
197 }
198 @@ -546,6 +544,8 @@ static void xen_hvm_cpu_die(unsigned int cpu)
199
200 void __init xen_hvm_smp_init(void)
201 {
202 + if (!xen_have_vector_callback)
203 + return;
204 smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
205 smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
206 smp_ops.cpu_up = xen_hvm_cpu_up;
207 diff --git a/drivers/block/loop.c b/drivers/block/loop.c
208 index 76c8da7..2ebacf0 100644
209 --- a/drivers/block/loop.c
210 +++ b/drivers/block/loop.c
211 @@ -750,10 +750,10 @@ static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf)
212 ssize_t ret;
213 char *p = NULL;
214
215 - mutex_lock(&lo->lo_ctl_mutex);
216 + spin_lock_irq(&lo->lo_lock);
217 if (lo->lo_backing_file)
218 p = d_path(&lo->lo_backing_file->f_path, buf, PAGE_SIZE - 1);
219 - mutex_unlock(&lo->lo_ctl_mutex);
220 + spin_unlock_irq(&lo->lo_lock);
221
222 if (IS_ERR_OR_NULL(p))
223 ret = PTR_ERR(p);
224 @@ -1007,7 +1007,9 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
225
226 kthread_stop(lo->lo_thread);
227
228 + spin_lock_irq(&lo->lo_lock);
229 lo->lo_backing_file = NULL;
230 + spin_unlock_irq(&lo->lo_lock);
231
232 loop_release_xfer(lo);
233 lo->transfer = NULL;
234 diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
235 index b536a9c..9ea8c25 100644
236 --- a/drivers/block/xen-blkfront.c
237 +++ b/drivers/block/xen-blkfront.c
238 @@ -123,8 +123,8 @@ static DEFINE_SPINLOCK(minor_lock);
239 #define BLKIF_MINOR_EXT(dev) ((dev)&(~EXTENDED))
240 #define EMULATED_HD_DISK_MINOR_OFFSET (0)
241 #define EMULATED_HD_DISK_NAME_OFFSET (EMULATED_HD_DISK_MINOR_OFFSET / 256)
242 -#define EMULATED_SD_DISK_MINOR_OFFSET (EMULATED_HD_DISK_MINOR_OFFSET + (4 * 16))
243 -#define EMULATED_SD_DISK_NAME_OFFSET (EMULATED_HD_DISK_NAME_OFFSET + 4)
244 +#define EMULATED_SD_DISK_MINOR_OFFSET (0)
245 +#define EMULATED_SD_DISK_NAME_OFFSET (EMULATED_SD_DISK_MINOR_OFFSET / 256)
246
247 #define DEV_NAME "xvd" /* name in /dev */
248
249 @@ -529,7 +529,7 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
250 minor = BLKIF_MINOR_EXT(info->vdevice);
251 nr_parts = PARTS_PER_EXT_DISK;
252 offset = minor / nr_parts;
253 - if (xen_hvm_domain() && offset <= EMULATED_HD_DISK_NAME_OFFSET + 4)
254 + if (xen_hvm_domain() && offset < EMULATED_HD_DISK_NAME_OFFSET + 4)
255 printk(KERN_WARNING "blkfront: vdevice 0x%x might conflict with "
256 "emulated IDE disks,\n\t choose an xvd device name"
257 "from xvde on\n", info->vdevice);
258 diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
259 index 04f1e7c..f6cf448 100644
260 --- a/drivers/edac/i7core_edac.c
261 +++ b/drivers/edac/i7core_edac.c
262 @@ -1670,7 +1670,7 @@ static void i7core_mce_output_error(struct mem_ctl_info *mci,
263 char *type, *optype, *err, *msg;
264 unsigned long error = m->status & 0x1ff0000l;
265 u32 optypenum = (m->status >> 4) & 0x07;
266 - u32 core_err_cnt = (m->status >> 38) && 0x7fff;
267 + u32 core_err_cnt = (m->status >> 38) & 0x7fff;
268 u32 dimm = (m->misc >> 16) & 0x3;
269 u32 channel = (m->misc >> 18) & 0x3;
270 u32 syndrome = m->misc >> 32;
271 diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
272 index 6ab6c41..d1b36f8 100644
273 --- a/drivers/gpu/drm/radeon/radeon_connectors.c
274 +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
275 @@ -466,6 +466,16 @@ static bool radeon_connector_needs_extended_probe(struct radeon_device *dev,
276 (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
277 return true;
278 }
279 + /* TOSHIBA Satellite L300D with ATI Mobility Radeon x1100
280 + * (RS690M) sends data to i2c bus for a HDMI connector that
281 + * is not implemented */
282 + if ((dev->pdev->device == 0x791f) &&
283 + (dev->pdev->subsystem_vendor == 0x1179) &&
284 + (dev->pdev->subsystem_device == 0xff68)) {
285 + if ((connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
286 + (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
287 + return true;
288 + }
289
290 /* Default: no EDID header probe required for DDC probing */
291 return false;
292 diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
293 index 2e618b5..b7f0726 100644
294 --- a/drivers/gpu/drm/ttm/ttm_bo.c
295 +++ b/drivers/gpu/drm/ttm/ttm_bo.c
296 @@ -353,8 +353,10 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
297
298 ret = ttm_tt_set_user(bo->ttm, current,
299 bo->buffer_start, bo->num_pages);
300 - if (unlikely(ret != 0))
301 + if (unlikely(ret != 0)) {
302 ttm_tt_destroy(bo->ttm);
303 + bo->ttm = NULL;
304 + }
305 break;
306 default:
307 printk(KERN_ERR TTM_PFX "Illegal buffer object type\n");
308 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
309 index 58d5436..6d3de08 100644
310 --- a/drivers/mmc/host/sdhci.c
311 +++ b/drivers/mmc/host/sdhci.c
312 @@ -1863,9 +1863,6 @@ static void sdhci_tasklet_finish(unsigned long param)
313
314 del_timer(&host->timer);
315
316 - if (host->version >= SDHCI_SPEC_300)
317 - del_timer(&host->tuning_timer);
318 -
319 mrq = host->mrq;
320
321 /*
322 diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
323 index 0f563c8..493e331 100644
324 --- a/drivers/net/igb/e1000_82575.c
325 +++ b/drivers/net/igb/e1000_82575.c
326 @@ -1735,6 +1735,7 @@ static s32 igb_reset_hw_82580(struct e1000_hw *hw)
327 ctrl |= E1000_CTRL_RST;
328
329 wr32(E1000_CTRL, ctrl);
330 + wrfl();
331
332 /* Add delay to insure DEV_RST has time to complete */
333 if (global_device_reset)
334 diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
335 index 8f90f62..241a099 100644
336 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c
337 +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
338 @@ -262,23 +262,20 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
339 struct queue_entry *entry = (struct queue_entry *)urb->context;
340 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
341
342 - if (!test_and_clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
343 + if (!test_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags))
344 return;
345 -
346 - if (rt2x00dev->ops->lib->tx_dma_done)
347 - rt2x00dev->ops->lib->tx_dma_done(entry);
348 -
349 - /*
350 - * Report the frame as DMA done
351 - */
352 - rt2x00lib_dmadone(entry);
353 -
354 /*
355 * Check if the frame was correctly uploaded
356 */
357 if (urb->status)
358 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
359 + /*
360 + * Report the frame as DMA done
361 + */
362 + rt2x00lib_dmadone(entry);
363
364 + if (rt2x00dev->ops->lib->tx_dma_done)
365 + rt2x00dev->ops->lib->tx_dma_done(entry);
366 /*
367 * Schedule the delayed work for reading the TX status
368 * from the device.
369 diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
370 index 54b8c28..720d885 100644
371 --- a/fs/befs/linuxvfs.c
372 +++ b/fs/befs/linuxvfs.c
373 @@ -474,17 +474,22 @@ befs_follow_link(struct dentry *dentry, struct nameidata *nd)
374 befs_data_stream *data = &befs_ino->i_data.ds;
375 befs_off_t len = data->size;
376
377 - befs_debug(sb, "Follow long symlink");
378 -
379 - link = kmalloc(len, GFP_NOFS);
380 - if (!link) {
381 - link = ERR_PTR(-ENOMEM);
382 - } else if (befs_read_lsymlink(sb, data, link, len) != len) {
383 - kfree(link);
384 - befs_error(sb, "Failed to read entire long symlink");
385 + if (len == 0) {
386 + befs_error(sb, "Long symlink with illegal length");
387 link = ERR_PTR(-EIO);
388 } else {
389 - link[len - 1] = '\0';
390 + befs_debug(sb, "Follow long symlink");
391 +
392 + link = kmalloc(len, GFP_NOFS);
393 + if (!link) {
394 + link = ERR_PTR(-ENOMEM);
395 + } else if (befs_read_lsymlink(sb, data, link, len) != len) {
396 + kfree(link);
397 + befs_error(sb, "Failed to read entire long symlink");
398 + link = ERR_PTR(-EIO);
399 + } else {
400 + link[len - 1] = '\0';
401 + }
402 }
403 } else {
404 link = befs_ino->i_data.symlink;
405 diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
406 index 71cd456..7e20a65 100644
407 --- a/fs/btrfs/extent-tree.c
408 +++ b/fs/btrfs/extent-tree.c
409 @@ -1784,6 +1784,9 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
410
411
412 for (i = 0; i < multi->num_stripes; i++, stripe++) {
413 + if (!stripe->dev->can_discard)
414 + continue;
415 +
416 ret = btrfs_issue_discard(stripe->dev->bdev,
417 stripe->physical,
418 stripe->length);
419 @@ -1791,11 +1794,16 @@ static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
420 discarded_bytes += stripe->length;
421 else if (ret != -EOPNOTSUPP)
422 break;
423 +
424 + /*
425 + * Just in case we get back EOPNOTSUPP for some reason,
426 + * just ignore the return value so we don't screw up
427 + * people calling discard_extent.
428 + */
429 + ret = 0;
430 }
431 kfree(multi);
432 }
433 - if (discarded_bytes && ret == -EOPNOTSUPP)
434 - ret = 0;
435
436 if (actual_bytes)
437 *actual_bytes = discarded_bytes;
438 diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
439 index 4ce8a9f..7fa128d 100644
440 --- a/fs/btrfs/tree-log.c
441 +++ b/fs/btrfs/tree-log.c
442 @@ -799,14 +799,15 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
443 struct extent_buffer *eb, int slot,
444 struct btrfs_key *key)
445 {
446 - struct inode *dir;
447 - int ret;
448 struct btrfs_inode_ref *ref;
449 + struct btrfs_dir_item *di;
450 + struct inode *dir;
451 struct inode *inode;
452 - char *name;
453 - int namelen;
454 unsigned long ref_ptr;
455 unsigned long ref_end;
456 + char *name;
457 + int namelen;
458 + int ret;
459 int search_done = 0;
460
461 /*
462 @@ -909,6 +910,25 @@ again:
463 }
464 btrfs_release_path(path);
465
466 + /* look for a conflicting sequence number */
467 + di = btrfs_lookup_dir_index_item(trans, root, path, btrfs_ino(dir),
468 + btrfs_inode_ref_index(eb, ref),
469 + name, namelen, 0);
470 + if (di && !IS_ERR(di)) {
471 + ret = drop_one_dir_item(trans, root, path, dir, di);
472 + BUG_ON(ret);
473 + }
474 + btrfs_release_path(path);
475 +
476 + /* look for a conflicing name */
477 + di = btrfs_lookup_dir_item(trans, root, path, btrfs_ino(dir),
478 + name, namelen, 0);
479 + if (di && !IS_ERR(di)) {
480 + ret = drop_one_dir_item(trans, root, path, dir, di);
481 + BUG_ON(ret);
482 + }
483 + btrfs_release_path(path);
484 +
485 insert:
486 /* insert our name */
487 ret = btrfs_add_link(trans, dir, inode, name, namelen, 0,
488 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
489 index 19450bc..43baaf0 100644
490 --- a/fs/btrfs/volumes.c
491 +++ b/fs/btrfs/volumes.c
492 @@ -500,6 +500,9 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
493 fs_devices->rw_devices--;
494 }
495
496 + if (device->can_discard)
497 + fs_devices->num_can_discard--;
498 +
499 new_device = kmalloc(sizeof(*new_device), GFP_NOFS);
500 BUG_ON(!new_device);
501 memcpy(new_device, device, sizeof(*new_device));
502 @@ -508,6 +511,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
503 new_device->bdev = NULL;
504 new_device->writeable = 0;
505 new_device->in_fs_metadata = 0;
506 + new_device->can_discard = 0;
507 list_replace_rcu(&device->dev_list, &new_device->dev_list);
508
509 call_rcu(&device->rcu, free_device);
510 @@ -547,6 +551,7 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
511 static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
512 fmode_t flags, void *holder)
513 {
514 + struct request_queue *q;
515 struct block_device *bdev;
516 struct list_head *head = &fs_devices->devices;
517 struct btrfs_device *device;
518 @@ -603,6 +608,12 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
519 seeding = 0;
520 }
521
522 + q = bdev_get_queue(bdev);
523 + if (blk_queue_discard(q)) {
524 + device->can_discard = 1;
525 + fs_devices->num_can_discard++;
526 + }
527 +
528 device->bdev = bdev;
529 device->in_fs_metadata = 0;
530 device->mode = flags;
531 @@ -1542,6 +1553,7 @@ error:
532
533 int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
534 {
535 + struct request_queue *q;
536 struct btrfs_trans_handle *trans;
537 struct btrfs_device *device;
538 struct block_device *bdev;
539 @@ -1611,6 +1623,9 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
540
541 lock_chunks(root);
542
543 + q = bdev_get_queue(bdev);
544 + if (blk_queue_discard(q))
545 + device->can_discard = 1;
546 device->writeable = 1;
547 device->work.func = pending_bios_fn;
548 generate_random_uuid(device->uuid);
549 @@ -1646,6 +1661,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
550 root->fs_info->fs_devices->num_devices++;
551 root->fs_info->fs_devices->open_devices++;
552 root->fs_info->fs_devices->rw_devices++;
553 + if (device->can_discard)
554 + root->fs_info->fs_devices->num_can_discard++;
555 root->fs_info->fs_devices->total_rw_bytes += device->total_bytes;
556
557 if (!blk_queue_nonrot(bdev_get_queue(bdev)))
558 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
559 index 7c12d61..6d866db 100644
560 --- a/fs/btrfs/volumes.h
561 +++ b/fs/btrfs/volumes.h
562 @@ -48,6 +48,7 @@ struct btrfs_device {
563 int writeable;
564 int in_fs_metadata;
565 int missing;
566 + int can_discard;
567
568 spinlock_t io_lock;
569
570 @@ -104,6 +105,7 @@ struct btrfs_fs_devices {
571 u64 rw_devices;
572 u64 missing_devices;
573 u64 total_rw_bytes;
574 + u64 num_can_discard;
575 struct block_device *latest_bdev;
576
577 /* all of the devices in the FS, protected by a mutex
578 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
579 index ccc1afa..e0ea721 100644
580 --- a/fs/cifs/connect.c
581 +++ b/fs/cifs/connect.c
582 @@ -2838,7 +2838,8 @@ cleanup_volume_info_contents(struct smb_vol *volume_info)
583 kfree(volume_info->username);
584 kzfree(volume_info->password);
585 kfree(volume_info->UNC);
586 - kfree(volume_info->UNCip);
587 + if (volume_info->UNCip != volume_info->UNC + 2)
588 + kfree(volume_info->UNCip);
589 kfree(volume_info->domainname);
590 kfree(volume_info->iocharset);
591 kfree(volume_info->prepath);
592 diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
593 index d8d26f3..16cdd6d 100644
594 --- a/fs/cifs/dir.c
595 +++ b/fs/cifs/dir.c
596 @@ -110,8 +110,8 @@ cifs_bp_rename_retry:
597 }
598 rcu_read_unlock();
599 if (namelen != dfsplen || read_seqretry(&rename_lock, seq)) {
600 - cERROR(1, "did not end path lookup where expected namelen is %d",
601 - namelen);
602 + cFYI(1, "did not end path lookup where expected. namelen=%d "
603 + "dfsplen=%d", namelen, dfsplen);
604 /* presumably this is only possible if racing with a rename
605 of one of the parent directories (we can not lock the dentries
606 above us to prevent this, but retrying should be harmless) */
607 diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
608 index bb85757..5802fa1 100644
609 --- a/fs/ext4/ext4_jbd2.h
610 +++ b/fs/ext4/ext4_jbd2.h
611 @@ -289,10 +289,10 @@ static inline int ext4_should_order_data(struct inode *inode)
612
613 static inline int ext4_should_writeback_data(struct inode *inode)
614 {
615 - if (!S_ISREG(inode->i_mode))
616 - return 0;
617 if (EXT4_JOURNAL(inode) == NULL)
618 return 1;
619 + if (!S_ISREG(inode->i_mode))
620 + return 0;
621 if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA))
622 return 0;
623 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)
624 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
625 index e3126c0..b864839 100644
626 --- a/fs/ext4/inode.c
627 +++ b/fs/ext4/inode.c
628 @@ -189,6 +189,12 @@ void ext4_evict_inode(struct inode *inode)
629 int err;
630
631 trace_ext4_evict_inode(inode);
632 +
633 + mutex_lock(&inode->i_mutex);
634 + ext4_flush_completed_IO(inode);
635 + mutex_unlock(&inode->i_mutex);
636 + ext4_ioend_wait(inode);
637 +
638 if (inode->i_nlink) {
639 truncate_inode_pages(&inode->i_data, 0);
640 goto no_delete;
641 @@ -1849,6 +1855,8 @@ static int ext4_journalled_write_end(struct file *file,
642 from = pos & (PAGE_CACHE_SIZE - 1);
643 to = from + len;
644
645 + BUG_ON(!ext4_handle_valid(handle));
646 +
647 if (copied < len) {
648 if (!PageUptodate(page))
649 copied = 0;
650 @@ -2148,7 +2156,12 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd,
651 else if (test_opt(inode->i_sb, MBLK_IO_SUBMIT))
652 err = ext4_bio_write_page(&io_submit, page,
653 len, mpd->wbc);
654 - else
655 + else if (buffer_uninit(page_bufs)) {
656 + ext4_set_bh_endio(page_bufs, inode);
657 + err = block_write_full_page_endio(page,
658 + noalloc_get_block_write,
659 + mpd->wbc, ext4_end_io_buffer_write);
660 + } else
661 err = block_write_full_page(page,
662 noalloc_get_block_write, mpd->wbc);
663
664 @@ -2564,6 +2577,8 @@ static int __ext4_journalled_writepage(struct page *page,
665 goto out;
666 }
667
668 + BUG_ON(!ext4_handle_valid(handle));
669 +
670 ret = walk_page_buffers(handle, page_bufs, 0, len, NULL,
671 do_journal_get_write_access);
672
673 @@ -3635,8 +3650,15 @@ static void ext4_end_io_buffer_write(struct buffer_head *bh, int uptodate)
674 goto out;
675 }
676
677 - io_end->flag = EXT4_IO_END_UNWRITTEN;
678 + /*
679 + * It may be over-defensive here to check EXT4_IO_END_UNWRITTEN now,
680 + * but being more careful is always safe for the future change.
681 + */
682 inode = io_end->inode;
683 + if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
684 + io_end->flag |= EXT4_IO_END_UNWRITTEN;
685 + atomic_inc(&EXT4_I(inode)->i_aiodio_unwritten);
686 + }
687
688 /* Add the io_end to per-inode completed io list*/
689 spin_lock_irqsave(&EXT4_I(inode)->i_completed_io_lock, flags);
690 diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
691 index 7bb8f76..97e5e98 100644
692 --- a/fs/ext4/page-io.c
693 +++ b/fs/ext4/page-io.c
694 @@ -338,8 +338,10 @@ submit_and_retry:
695 if ((io_end->num_io_pages >= MAX_IO_PAGES) &&
696 (io_end->pages[io_end->num_io_pages-1] != io_page))
697 goto submit_and_retry;
698 - if (buffer_uninit(bh))
699 - io->io_end->flag |= EXT4_IO_END_UNWRITTEN;
700 + if (buffer_uninit(bh) && !(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
701 + io_end->flag |= EXT4_IO_END_UNWRITTEN;
702 + atomic_inc(&EXT4_I(inode)->i_aiodio_unwritten);
703 + }
704 io->io_end->size += bh->b_size;
705 io->io_next_block++;
706 ret = bio_add_page(io->io_bio, bh->b_page, bh->b_size, bh_offset(bh));
707 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
708 index 9ea71aa..111ed9d 100644
709 --- a/fs/ext4/super.c
710 +++ b/fs/ext4/super.c
711 @@ -892,7 +892,6 @@ static void ext4_i_callback(struct rcu_head *head)
712
713 static void ext4_destroy_inode(struct inode *inode)
714 {
715 - ext4_ioend_wait(inode);
716 if (!list_empty(&(EXT4_I(inode)->i_orphan))) {
717 ext4_msg(inode->i_sb, KERN_ERR,
718 "Inode %lu (%p): orphan list check failed!",
719 diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
720 index 640fc22..168a80f 100644
721 --- a/fs/fuse/dev.c
722 +++ b/fs/fuse/dev.c
723 @@ -1358,6 +1358,10 @@ static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size,
724 if (outarg.namelen > FUSE_NAME_MAX)
725 goto err;
726
727 + err = -EINVAL;
728 + if (size != sizeof(outarg) + outarg.namelen + 1)
729 + goto err;
730 +
731 name.name = buf;
732 name.len = outarg.namelen;
733 err = fuse_copy_one(cs, buf, outarg.namelen + 1);
734 diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
735 index b257383..07df5f1 100644
736 --- a/fs/nfs/callback.h
737 +++ b/fs/nfs/callback.h
738 @@ -38,6 +38,7 @@ enum nfs4_callback_opnum {
739 struct cb_process_state {
740 __be32 drc_status;
741 struct nfs_client *clp;
742 + int slotid;
743 };
744
745 struct cb_compound_hdr_arg {
746 @@ -166,7 +167,6 @@ extern unsigned nfs4_callback_layoutrecall(
747 void *dummy, struct cb_process_state *cps);
748
749 extern void nfs4_check_drain_bc_complete(struct nfs4_session *ses);
750 -extern void nfs4_cb_take_slot(struct nfs_client *clp);
751
752 struct cb_devicenotifyitem {
753 uint32_t cbd_notify_type;
754 diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
755 index d4d1954..aaa09e9 100644
756 --- a/fs/nfs/callback_proc.c
757 +++ b/fs/nfs/callback_proc.c
758 @@ -333,7 +333,7 @@ validate_seqid(struct nfs4_slot_table *tbl, struct cb_sequenceargs * args)
759 /* Normal */
760 if (likely(args->csa_sequenceid == slot->seq_nr + 1)) {
761 slot->seq_nr++;
762 - return htonl(NFS4_OK);
763 + goto out_ok;
764 }
765
766 /* Replay */
767 @@ -352,11 +352,14 @@ validate_seqid(struct nfs4_slot_table *tbl, struct cb_sequenceargs * args)
768 /* Wraparound */
769 if (args->csa_sequenceid == 1 && (slot->seq_nr + 1) == 0) {
770 slot->seq_nr = 1;
771 - return htonl(NFS4_OK);
772 + goto out_ok;
773 }
774
775 /* Misordered request */
776 return htonl(NFS4ERR_SEQ_MISORDERED);
777 +out_ok:
778 + tbl->highest_used_slotid = args->csa_slotid;
779 + return htonl(NFS4_OK);
780 }
781
782 /*
783 @@ -418,26 +421,37 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
784 struct cb_sequenceres *res,
785 struct cb_process_state *cps)
786 {
787 + struct nfs4_slot_table *tbl;
788 struct nfs_client *clp;
789 int i;
790 __be32 status = htonl(NFS4ERR_BADSESSION);
791
792 - cps->clp = NULL;
793 -
794 clp = nfs4_find_client_sessionid(args->csa_addr, &args->csa_sessionid);
795 if (clp == NULL)
796 goto out;
797
798 + tbl = &clp->cl_session->bc_slot_table;
799 +
800 + spin_lock(&tbl->slot_tbl_lock);
801 /* state manager is resetting the session */
802 if (test_bit(NFS4_SESSION_DRAINING, &clp->cl_session->session_state)) {
803 - status = NFS4ERR_DELAY;
804 + spin_unlock(&tbl->slot_tbl_lock);
805 + status = htonl(NFS4ERR_DELAY);
806 + /* Return NFS4ERR_BADSESSION if we're draining the session
807 + * in order to reset it.
808 + */
809 + if (test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state))
810 + status = htonl(NFS4ERR_BADSESSION);
811 goto out;
812 }
813
814 status = validate_seqid(&clp->cl_session->bc_slot_table, args);
815 + spin_unlock(&tbl->slot_tbl_lock);
816 if (status)
817 goto out;
818
819 + cps->slotid = args->csa_slotid;
820 +
821 /*
822 * Check for pending referring calls. If a match is found, a
823 * related callback was received before the response to the original
824 @@ -454,7 +468,6 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
825 res->csr_slotid = args->csa_slotid;
826 res->csr_highestslotid = NFS41_BC_MAX_CALLBACKS - 1;
827 res->csr_target_highestslotid = NFS41_BC_MAX_CALLBACKS - 1;
828 - nfs4_cb_take_slot(clp);
829
830 out:
831 cps->clp = clp; /* put in nfs4_callback_compound */
832 diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
833 index c6c86a7..918ad64 100644
834 --- a/fs/nfs/callback_xdr.c
835 +++ b/fs/nfs/callback_xdr.c
836 @@ -754,26 +754,15 @@ static void nfs4_callback_free_slot(struct nfs4_session *session)
837 * Let the state manager know callback processing done.
838 * A single slot, so highest used slotid is either 0 or -1
839 */
840 - tbl->highest_used_slotid--;
841 + tbl->highest_used_slotid = -1;
842 nfs4_check_drain_bc_complete(session);
843 spin_unlock(&tbl->slot_tbl_lock);
844 }
845
846 -static void nfs4_cb_free_slot(struct nfs_client *clp)
847 +static void nfs4_cb_free_slot(struct cb_process_state *cps)
848 {
849 - if (clp && clp->cl_session)
850 - nfs4_callback_free_slot(clp->cl_session);
851 -}
852 -
853 -/* A single slot, so highest used slotid is either 0 or -1 */
854 -void nfs4_cb_take_slot(struct nfs_client *clp)
855 -{
856 - struct nfs4_slot_table *tbl = &clp->cl_session->bc_slot_table;
857 -
858 - spin_lock(&tbl->slot_tbl_lock);
859 - tbl->highest_used_slotid++;
860 - BUG_ON(tbl->highest_used_slotid != 0);
861 - spin_unlock(&tbl->slot_tbl_lock);
862 + if (cps->slotid != -1)
863 + nfs4_callback_free_slot(cps->clp->cl_session);
864 }
865
866 #else /* CONFIG_NFS_V4_1 */
867 @@ -784,7 +773,7 @@ preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)
868 return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
869 }
870
871 -static void nfs4_cb_free_slot(struct nfs_client *clp)
872 +static void nfs4_cb_free_slot(struct cb_process_state *cps)
873 {
874 }
875 #endif /* CONFIG_NFS_V4_1 */
876 @@ -866,6 +855,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
877 struct cb_process_state cps = {
878 .drc_status = 0,
879 .clp = NULL,
880 + .slotid = -1,
881 };
882 unsigned int nops = 0;
883
884 @@ -906,7 +896,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
885
886 *hdr_res.status = status;
887 *hdr_res.nops = htonl(nops);
888 - nfs4_cb_free_slot(cps.clp);
889 + nfs4_cb_free_slot(&cps);
890 nfs_put_client(cps.clp);
891 dprintk("%s: done, status = %u\n", __func__, ntohl(status));
892 return rpc_success;
893 diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
894 index 8ff2ea3..1d1dc1e 100644
895 --- a/fs/nfs/objlayout/objio_osd.c
896 +++ b/fs/nfs/objlayout/objio_osd.c
897 @@ -479,7 +479,6 @@ static int _io_check(struct objio_state *ios, bool is_write)
898 for (i = 0; i < ios->numdevs; i++) {
899 struct osd_sense_info osi;
900 struct osd_request *or = ios->per_dev[i].or;
901 - unsigned dev;
902 int ret;
903
904 if (!or)
905 @@ -500,9 +499,8 @@ static int _io_check(struct objio_state *ios, bool is_write)
906
907 continue; /* we recovered */
908 }
909 - dev = ios->per_dev[i].dev;
910 - objlayout_io_set_result(&ios->ol_state, dev,
911 - &ios->layout->comps[dev].oc_object_id,
912 + objlayout_io_set_result(&ios->ol_state, i,
913 + &ios->layout->comps[i].oc_object_id,
914 osd_pri_2_pnfs_err(osi.osd_err_pri),
915 ios->per_dev[i].offset,
916 ios->per_dev[i].length,
917 @@ -589,22 +587,19 @@ static void _calc_stripe_info(struct objio_state *ios, u64 file_offset,
918 }
919
920 static int _add_stripe_unit(struct objio_state *ios, unsigned *cur_pg,
921 - unsigned pgbase, struct _objio_per_comp *per_dev, int cur_len,
922 + unsigned pgbase, struct _objio_per_comp *per_dev, int len,
923 gfp_t gfp_flags)
924 {
925 unsigned pg = *cur_pg;
926 + int cur_len = len;
927 struct request_queue *q =
928 osd_request_queue(_io_od(ios, per_dev->dev));
929
930 - per_dev->length += cur_len;
931 -
932 if (per_dev->bio == NULL) {
933 - unsigned stripes = ios->layout->num_comps /
934 - ios->layout->mirrors_p1;
935 - unsigned pages_in_stripe = stripes *
936 + unsigned pages_in_stripe = ios->layout->group_width *
937 (ios->layout->stripe_unit / PAGE_SIZE);
938 unsigned bio_size = (ios->ol_state.nr_pages + pages_in_stripe) /
939 - stripes;
940 + ios->layout->group_width;
941
942 if (BIO_MAX_PAGES_KMALLOC < bio_size)
943 bio_size = BIO_MAX_PAGES_KMALLOC;
944 @@ -632,6 +627,7 @@ static int _add_stripe_unit(struct objio_state *ios, unsigned *cur_pg,
945 }
946 BUG_ON(cur_len);
947
948 + per_dev->length += len;
949 *cur_pg = pg;
950 return 0;
951 }
952 @@ -650,7 +646,7 @@ static int _prepare_one_group(struct objio_state *ios, u64 length,
953 int ret = 0;
954
955 while (length) {
956 - struct _objio_per_comp *per_dev = &ios->per_dev[dev];
957 + struct _objio_per_comp *per_dev = &ios->per_dev[dev - first_dev];
958 unsigned cur_len, page_off = 0;
959
960 if (!per_dev->length) {
961 @@ -670,8 +666,8 @@ static int _prepare_one_group(struct objio_state *ios, u64 length,
962 cur_len = stripe_unit;
963 }
964
965 - if (max_comp < dev)
966 - max_comp = dev;
967 + if (max_comp < dev - first_dev)
968 + max_comp = dev - first_dev;
969 } else {
970 cur_len = stripe_unit;
971 }
972 @@ -806,7 +802,7 @@ static int _read_mirrors(struct objio_state *ios, unsigned cur_comp)
973 struct _objio_per_comp *per_dev = &ios->per_dev[cur_comp];
974 unsigned dev = per_dev->dev;
975 struct pnfs_osd_object_cred *cred =
976 - &ios->layout->comps[dev];
977 + &ios->layout->comps[cur_comp];
978 struct osd_obj_id obj = {
979 .partition = cred->oc_object_id.oid_partition_id,
980 .id = cred->oc_object_id.oid_object_id,
981 @@ -904,7 +900,7 @@ static int _write_mirrors(struct objio_state *ios, unsigned cur_comp)
982 for (; cur_comp < last_comp; ++cur_comp, ++dev) {
983 struct osd_request *or = NULL;
984 struct pnfs_osd_object_cred *cred =
985 - &ios->layout->comps[dev];
986 + &ios->layout->comps[cur_comp];
987 struct osd_obj_id obj = {
988 .partition = cred->oc_object_id.oid_partition_id,
989 .id = cred->oc_object_id.oid_object_id,
990 diff --git a/fs/nfs/objlayout/pnfs_osd_xdr_cli.c b/fs/nfs/objlayout/pnfs_osd_xdr_cli.c
991 index 16fc758..b3918f7 100644
992 --- a/fs/nfs/objlayout/pnfs_osd_xdr_cli.c
993 +++ b/fs/nfs/objlayout/pnfs_osd_xdr_cli.c
994 @@ -170,6 +170,9 @@ int pnfs_osd_xdr_decode_layout_map(struct pnfs_osd_layout *layout,
995 p = _osd_xdr_decode_data_map(p, &layout->olo_map);
996 layout->olo_comps_index = be32_to_cpup(p++);
997 layout->olo_num_comps = be32_to_cpup(p++);
998 + dprintk("%s: olo_comps_index=%d olo_num_comps=%d\n", __func__,
999 + layout->olo_comps_index, layout->olo_num_comps);
1000 +
1001 iter->total_comps = layout->olo_num_comps;
1002 return 0;
1003 }
1004 diff --git a/include/linux/personality.h b/include/linux/personality.h
1005 index eec3bae..8fc7dd1a 100644
1006 --- a/include/linux/personality.h
1007 +++ b/include/linux/personality.h
1008 @@ -22,6 +22,7 @@ extern int __set_personality(unsigned int);
1009 * These occupy the top three bytes.
1010 */
1011 enum {
1012 + UNAME26 = 0x0020000,
1013 ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */
1014 FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors
1015 * (signal handling)
1016 diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
1017 index 092dc9b..14d3524 100644
1018 --- a/include/linux/stop_machine.h
1019 +++ b/include/linux/stop_machine.h
1020 @@ -27,6 +27,8 @@ struct cpu_stop_work {
1021 struct cpu_stop_done *done;
1022 };
1023
1024 +extern struct mutex stop_cpus_mutex;
1025 +
1026 int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
1027 void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
1028 struct cpu_stop_work *work_buf);
1029 diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
1030 index 3a2cab4..e38544d 100644
1031 --- a/kernel/irq/generic-chip.c
1032 +++ b/kernel/irq/generic-chip.c
1033 @@ -246,7 +246,7 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk,
1034 gc->mask_cache = irq_reg_readl(gc->reg_base + ct->regs.mask);
1035
1036 for (i = gc->irq_base; msk; msk >>= 1, i++) {
1037 - if (!msk & 0x01)
1038 + if (!(msk & 0x01))
1039 continue;
1040
1041 if (flags & IRQ_GC_INIT_NESTED_LOCK)
1042 @@ -301,7 +301,7 @@ void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk,
1043 raw_spin_unlock(&gc_lock);
1044
1045 for (; msk; msk >>= 1, i++) {
1046 - if (!msk & 0x01)
1047 + if (!(msk & 0x01))
1048 continue;
1049
1050 /* Remove handler first. That will mask the irq line */
1051 diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
1052 index e3516b2..0cae1cc 100644
1053 --- a/kernel/stop_machine.c
1054 +++ b/kernel/stop_machine.c
1055 @@ -132,8 +132,8 @@ void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
1056 cpu_stop_queue_work(&per_cpu(cpu_stopper, cpu), work_buf);
1057 }
1058
1059 +DEFINE_MUTEX(stop_cpus_mutex);
1060 /* static data for stop_cpus */
1061 -static DEFINE_MUTEX(stop_cpus_mutex);
1062 static DEFINE_PER_CPU(struct cpu_stop_work, stop_cpus_work);
1063
1064 int __stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg)
1065 diff --git a/kernel/sys.c b/kernel/sys.c
1066 index e4128b2..5c942cf 100644
1067 --- a/kernel/sys.c
1068 +++ b/kernel/sys.c
1069 @@ -38,6 +38,8 @@
1070 #include <linux/fs_struct.h>
1071 #include <linux/gfp.h>
1072 #include <linux/syscore_ops.h>
1073 +#include <linux/version.h>
1074 +#include <linux/ctype.h>
1075
1076 #include <linux/compat.h>
1077 #include <linux/syscalls.h>
1078 @@ -45,6 +47,8 @@
1079 #include <linux/user_namespace.h>
1080
1081 #include <linux/kmsg_dump.h>
1082 +/* Move somewhere else to avoid recompiling? */
1083 +#include <generated/utsrelease.h>
1084
1085 #include <asm/uaccess.h>
1086 #include <asm/io.h>
1087 @@ -1124,6 +1128,34 @@ DECLARE_RWSEM(uts_sem);
1088 #define override_architecture(name) 0
1089 #endif
1090
1091 +/*
1092 + * Work around broken programs that cannot handle "Linux 3.0".
1093 + * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40
1094 + */
1095 +static int override_release(char __user *release, int len)
1096 +{
1097 + int ret = 0;
1098 + char buf[len];
1099 +
1100 + if (current->personality & UNAME26) {
1101 + char *rest = UTS_RELEASE;
1102 + int ndots = 0;
1103 + unsigned v;
1104 +
1105 + while (*rest) {
1106 + if (*rest == '.' && ++ndots >= 3)
1107 + break;
1108 + if (!isdigit(*rest) && *rest != '.')
1109 + break;
1110 + rest++;
1111 + }
1112 + v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40;
1113 + snprintf(buf, len, "2.6.%u%s", v, rest);
1114 + ret = copy_to_user(release, buf, len);
1115 + }
1116 + return ret;
1117 +}
1118 +
1119 SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
1120 {
1121 int errno = 0;
1122 @@ -1133,6 +1165,8 @@ SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
1123 errno = -EFAULT;
1124 up_read(&uts_sem);
1125
1126 + if (!errno && override_release(name->release, sizeof(name->release)))
1127 + errno = -EFAULT;
1128 if (!errno && override_architecture(name))
1129 errno = -EFAULT;
1130 return errno;
1131 @@ -1154,6 +1188,8 @@ SYSCALL_DEFINE1(uname, struct old_utsname __user *, name)
1132 error = -EFAULT;
1133 up_read(&uts_sem);
1134
1135 + if (!error && override_release(name->release, sizeof(name->release)))
1136 + error = -EFAULT;
1137 if (!error && override_architecture(name))
1138 error = -EFAULT;
1139 return error;
1140 @@ -1188,6 +1224,8 @@ SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name)
1141
1142 if (!error && override_architecture(name))
1143 error = -EFAULT;
1144 + if (!error && override_release(name->release, sizeof(name->release)))
1145 + error = -EFAULT;
1146 return error ? -EFAULT : 0;
1147 }
1148 #endif
1149 diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
1150 index 200c9a1..a872d0a 100644
1151 --- a/sound/pci/ac97/ac97_patch.c
1152 +++ b/sound/pci/ac97/ac97_patch.c
1153 @@ -1909,6 +1909,7 @@ static unsigned int ad1981_jacks_whitelist[] = {
1154 0x103c0944, /* HP nc6220 */
1155 0x103c0934, /* HP nc8220 */
1156 0x103c006d, /* HP nx9105 */
1157 + 0x103c300d, /* HP Compaq dc5100 SFF(PT003AW) */
1158 0x17340088, /* FSC Scenic-W */
1159 0 /* end */
1160 };
1161 diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
1162 index aa52b3e..2cf87f5 100644
1163 --- a/sound/usb/caiaq/audio.c
1164 +++ b/sound/usb/caiaq/audio.c
1165 @@ -139,8 +139,12 @@ static void stream_stop(struct snd_usb_caiaqdev *dev)
1166
1167 for (i = 0; i < N_URBS; i++) {
1168 usb_kill_urb(dev->data_urbs_in[i]);
1169 - usb_kill_urb(dev->data_urbs_out[i]);
1170 +
1171 + if (test_bit(i, &dev->outurb_active_mask))
1172 + usb_kill_urb(dev->data_urbs_out[i]);
1173 }
1174 +
1175 + dev->outurb_active_mask = 0;
1176 }
1177
1178 static int snd_usb_caiaq_substream_open(struct snd_pcm_substream *substream)
1179 @@ -612,8 +616,8 @@ static void read_completed(struct urb *urb)
1180 {
1181 struct snd_usb_caiaq_cb_info *info = urb->context;
1182 struct snd_usb_caiaqdev *dev;
1183 - struct urb *out;
1184 - int frame, len, send_it = 0, outframe = 0;
1185 + struct urb *out = NULL;
1186 + int i, frame, len, send_it = 0, outframe = 0;
1187 size_t offset = 0;
1188
1189 if (urb->status || !info)
1190 @@ -624,7 +628,17 @@ static void read_completed(struct urb *urb)
1191 if (!dev->streaming)
1192 return;
1193
1194 - out = dev->data_urbs_out[info->index];
1195 + /* find an unused output urb that is unused */
1196 + for (i = 0; i < N_URBS; i++)
1197 + if (test_and_set_bit(i, &dev->outurb_active_mask) == 0) {
1198 + out = dev->data_urbs_out[i];
1199 + break;
1200 + }
1201 +
1202 + if (!out) {
1203 + log("Unable to find an output urb to use\n");
1204 + goto requeue;
1205 + }
1206
1207 /* read the recently received packet and send back one which has
1208 * the same layout */
1209 @@ -655,8 +669,12 @@ static void read_completed(struct urb *urb)
1210 out->number_of_packets = outframe;
1211 out->transfer_flags = URB_ISO_ASAP;
1212 usb_submit_urb(out, GFP_ATOMIC);
1213 + } else {
1214 + struct snd_usb_caiaq_cb_info *oinfo = out->context;
1215 + clear_bit(oinfo->index, &dev->outurb_active_mask);
1216 }
1217
1218 +requeue:
1219 /* re-submit inbound urb */
1220 for (frame = 0; frame < FRAMES_PER_URB; frame++) {
1221 urb->iso_frame_desc[frame].offset = BYTES_PER_FRAME * frame;
1222 @@ -678,6 +696,8 @@ static void write_completed(struct urb *urb)
1223 dev->output_running = 1;
1224 wake_up(&dev->prepare_wait_queue);
1225 }
1226 +
1227 + clear_bit(info->index, &dev->outurb_active_mask);
1228 }
1229
1230 static struct urb **alloc_urbs(struct snd_usb_caiaqdev *dev, int dir, int *ret)
1231 @@ -829,6 +849,9 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev)
1232 if (!dev->data_cb_info)
1233 return -ENOMEM;
1234
1235 + dev->outurb_active_mask = 0;
1236 + BUILD_BUG_ON(N_URBS > (sizeof(dev->outurb_active_mask) * 8));
1237 +
1238 for (i = 0; i < N_URBS; i++) {
1239 dev->data_cb_info[i].dev = dev;
1240 dev->data_cb_info[i].index = i;
1241 diff --git a/sound/usb/caiaq/device.h b/sound/usb/caiaq/device.h
1242 index b2b3101..3f9c633 100644
1243 --- a/sound/usb/caiaq/device.h
1244 +++ b/sound/usb/caiaq/device.h
1245 @@ -96,6 +96,7 @@ struct snd_usb_caiaqdev {
1246 int input_panic, output_panic, warned;
1247 char *audio_in_buf, *audio_out_buf;
1248 unsigned int samplerates, bpp;
1249 + unsigned long outurb_active_mask;
1250
1251 struct snd_pcm_substream *sub_playback[MAX_STREAMS];
1252 struct snd_pcm_substream *sub_capture[MAX_STREAMS];
1253 diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
1254 index c04d7c7..cdd19d7 100644
1255 --- a/sound/usb/mixer.c
1256 +++ b/sound/usb/mixer.c
1257 @@ -152,6 +152,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
1258 if (p && p->dB) {
1259 cval->dBmin = p->dB->min;
1260 cval->dBmax = p->dB->max;
1261 + cval->initialized = 1;
1262 }
1263 }
1264
1265 @@ -1092,7 +1093,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1266 " Switch" : " Volume");
1267 if (control == UAC_FU_VOLUME) {
1268 check_mapped_dB(map, cval);
1269 - if (cval->dBmin < cval->dBmax) {
1270 + if (cval->dBmin < cval->dBmax || !cval->initialized) {
1271 kctl->tlv.c = mixer_vol_tlv;
1272 kctl->vd[0].access |=
1273 SNDRV_CTL_ELEM_ACCESS_TLV_READ |

  ViewVC Help
Powered by ViewVC 1.1.20