aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c9
-rw-r--r--arch/x86/kernel/head_32.S2
-rw-r--r--drivers/leds/led-class.c8
-rw-r--r--drivers/leds/led-core.c4
-rw-r--r--drivers/leds/led-triggers.c8
-rw-r--r--drivers/leds/leds-locomo.c2
-rw-r--r--drivers/leds/leds.h3
-rw-r--r--drivers/scsi/scsi.c20
-rw-r--r--drivers/scsi/scsi_error.c1
-rw-r--r--drivers/scsi/scsi_lib.c16
-rw-r--r--drivers/scsi/scsi_priv.h4
-rw-r--r--drivers/scsi/scsi_sysfs.c17
-rw-r--r--drivers/scsi/sd.c28
-rw-r--r--drivers/scsi/sr.c21
-rw-r--r--fs/nfs/nfs4proc.c34
-rw-r--r--fs/nfs/nfs4renewd.c2
-rw-r--r--fs/nfs/super.c12
-rw-r--r--fs/proc/base.c20
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/proc_misc.c4
-rw-r--r--fs/proc/task_mmu.c3
-rw-r--r--fs/proc/task_nommu.c4
-rw-r--r--include/asm-x86/byteorder.h4
-rw-r--r--include/asm-x86/msr.h74
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/slab.h5
-rw-r--r--include/linux/slab_def.h3
-rw-r--r--include/scsi/scsi_cmnd.h2
-rw-r--r--include/scsi/scsi_driver.h1
-rw-r--r--include/scsi/sd.h13
-rw-r--r--init/Kconfig6
-rw-r--r--kernel/ptrace.c6
-rw-r--r--mm/slab.c2
-rw-r--r--mm/slub.c112
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c2
35 files changed, 307 insertions, 148 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 6e2a45e60261..9ad53e637aee 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -192,15 +192,6 @@ void do_notify_spus_active(void)
192 mutex_unlock(&cbe_spu_info[node].list_mutex); 192 mutex_unlock(&cbe_spu_info[node].list_mutex);
193 } 193 }
194} 194}
195EXPORT_SYMBOL_GPL(do_notify_spus_active);
196
197#ifndef MODULE
198void notify_spus_active(void)
199{
200 do_notify_spus_active();
201}
202EXPORT_SYMBOL_GPL(notify_spus_active);
203#endif
204 195
205/** 196/**
206 * spu_bind_context - bind spu context to physical spu 197 * spu_bind_context - bind spu context to physical spu
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index ac0637a6d71c..fbad51fce672 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -196,7 +196,7 @@ default_entry:
196 /* Do an early initialization of the fixmap area */ 196 /* Do an early initialization of the fixmap area */
197 movl $(swapper_pg_dir - __PAGE_OFFSET), %edx 197 movl $(swapper_pg_dir - __PAGE_OFFSET), %edx
198 movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax 198 movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax
199 addl $0x007, %eax /* 0x007 = PRESENT+RW+USER */ 199 addl $0x67, %eax /* 0x67 == _PAGE_TABLE */
200 movl %eax, 4092(%edx) 200 movl %eax, 4092(%edx)
201 201
202 xorl %ebx,%ebx /* This is the boot CPU (BSP) */ 202 xorl %ebx,%ebx /* This is the boot CPU (BSP) */
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index ba8b04b03b9f..64c66b3769c9 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -106,9 +106,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
106 goto err_out; 106 goto err_out;
107 107
108 /* add to the list of leds */ 108 /* add to the list of leds */
109 write_lock(&leds_list_lock); 109 down_write(&leds_list_lock);
110 list_add_tail(&led_cdev->node, &leds_list); 110 list_add_tail(&led_cdev->node, &leds_list);
111 write_unlock(&leds_list_lock); 111 up_write(&leds_list_lock);
112 112
113#ifdef CONFIG_LEDS_TRIGGERS 113#ifdef CONFIG_LEDS_TRIGGERS
114 init_rwsem(&led_cdev->trigger_lock); 114 init_rwsem(&led_cdev->trigger_lock);
@@ -155,9 +155,9 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
155 155
156 device_unregister(led_cdev->dev); 156 device_unregister(led_cdev->dev);
157 157
158 write_lock(&leds_list_lock); 158 down_write(&leds_list_lock);
159 list_del(&led_cdev->node); 159 list_del(&led_cdev->node);
160 write_unlock(&leds_list_lock); 160 up_write(&leds_list_lock);
161} 161}
162EXPORT_SYMBOL_GPL(led_classdev_unregister); 162EXPORT_SYMBOL_GPL(led_classdev_unregister);
163 163
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 9b015f9af351..5d1ca10524b6 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -14,11 +14,11 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/spinlock.h> 17#include <linux/rwsem.h>
18#include <linux/leds.h> 18#include <linux/leds.h>
19#include "leds.h" 19#include "leds.h"
20 20
21DEFINE_RWLOCK(leds_list_lock); 21DECLARE_RWSEM(leds_list_lock);
22LIST_HEAD(leds_list); 22LIST_HEAD(leds_list);
23 23
24EXPORT_SYMBOL_GPL(leds_list); 24EXPORT_SYMBOL_GPL(leds_list);
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 0bdb786210b1..13c9026d68af 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -169,7 +169,7 @@ int led_trigger_register(struct led_trigger *trigger)
169 up_write(&triggers_list_lock); 169 up_write(&triggers_list_lock);
170 170
171 /* Register with any LEDs that have this as a default trigger */ 171 /* Register with any LEDs that have this as a default trigger */
172 read_lock(&leds_list_lock); 172 down_read(&leds_list_lock);
173 list_for_each_entry(led_cdev, &leds_list, node) { 173 list_for_each_entry(led_cdev, &leds_list, node) {
174 down_write(&led_cdev->trigger_lock); 174 down_write(&led_cdev->trigger_lock);
175 if (!led_cdev->trigger && led_cdev->default_trigger && 175 if (!led_cdev->trigger && led_cdev->default_trigger &&
@@ -177,7 +177,7 @@ int led_trigger_register(struct led_trigger *trigger)
177 led_trigger_set(led_cdev, trigger); 177 led_trigger_set(led_cdev, trigger);
178 up_write(&led_cdev->trigger_lock); 178 up_write(&led_cdev->trigger_lock);
179 } 179 }
180 read_unlock(&leds_list_lock); 180 up_read(&leds_list_lock);
181 181
182 return 0; 182 return 0;
183} 183}
@@ -212,14 +212,14 @@ void led_trigger_unregister(struct led_trigger *trigger)
212 up_write(&triggers_list_lock); 212 up_write(&triggers_list_lock);
213 213
214 /* Remove anyone actively using this trigger */ 214 /* Remove anyone actively using this trigger */
215 read_lock(&leds_list_lock); 215 down_read(&leds_list_lock);
216 list_for_each_entry(led_cdev, &leds_list, node) { 216 list_for_each_entry(led_cdev, &leds_list, node) {
217 down_write(&led_cdev->trigger_lock); 217 down_write(&led_cdev->trigger_lock);
218 if (led_cdev->trigger == trigger) 218 if (led_cdev->trigger == trigger)
219 led_trigger_set(led_cdev, NULL); 219 led_trigger_set(led_cdev, NULL);
220 up_write(&led_cdev->trigger_lock); 220 up_write(&led_cdev->trigger_lock);
221 } 221 }
222 read_unlock(&leds_list_lock); 222 up_read(&leds_list_lock);
223} 223}
224 224
225void led_trigger_unregister_simple(struct led_trigger *trigger) 225void led_trigger_unregister_simple(struct led_trigger *trigger)
diff --git a/drivers/leds/leds-locomo.c b/drivers/leds/leds-locomo.c
index bfac499f3258..2207335e9212 100644
--- a/drivers/leds/leds-locomo.c
+++ b/drivers/leds/leds-locomo.c
@@ -19,7 +19,7 @@
19static void locomoled_brightness_set(struct led_classdev *led_cdev, 19static void locomoled_brightness_set(struct led_classdev *led_cdev,
20 enum led_brightness value, int offset) 20 enum led_brightness value, int offset)
21{ 21{
22 struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev); 22 struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev->parent);
23 unsigned long flags; 23 unsigned long flags;
24 24
25 local_irq_save(flags); 25 local_irq_save(flags);
diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
index f2f3884fe063..12b6fe93b135 100644
--- a/drivers/leds/leds.h
+++ b/drivers/leds/leds.h
@@ -14,6 +14,7 @@
14#define __LEDS_H_INCLUDED 14#define __LEDS_H_INCLUDED
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/rwsem.h>
17#include <linux/leds.h> 18#include <linux/leds.h>
18 19
19static inline void led_set_brightness(struct led_classdev *led_cdev, 20static inline void led_set_brightness(struct led_classdev *led_cdev,
@@ -26,7 +27,7 @@ static inline void led_set_brightness(struct led_classdev *led_cdev,
26 led_cdev->brightness_set(led_cdev, value); 27 led_cdev->brightness_set(led_cdev, value);
27} 28}
28 29
29extern rwlock_t leds_list_lock; 30extern struct rw_semaphore leds_list_lock;
30extern struct list_head leds_list; 31extern struct list_head leds_list;
31 32
32#ifdef CONFIG_LEDS_TRIGGERS 33#ifdef CONFIG_LEDS_TRIGGERS
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 0fb1709ce5e3..7ceb8209e5df 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -59,7 +59,6 @@
59#include <scsi/scsi_cmnd.h> 59#include <scsi/scsi_cmnd.h>
60#include <scsi/scsi_dbg.h> 60#include <scsi/scsi_dbg.h>
61#include <scsi/scsi_device.h> 61#include <scsi/scsi_device.h>
62#include <scsi/scsi_driver.h>
63#include <scsi/scsi_eh.h> 62#include <scsi/scsi_eh.h>
64#include <scsi/scsi_host.h> 63#include <scsi/scsi_host.h>
65#include <scsi/scsi_tcq.h> 64#include <scsi/scsi_tcq.h>
@@ -368,8 +367,9 @@ void scsi_log_send(struct scsi_cmnd *cmd)
368 scsi_print_command(cmd); 367 scsi_print_command(cmd);
369 if (level > 3) { 368 if (level > 3) {
370 printk(KERN_INFO "buffer = 0x%p, bufflen = %d," 369 printk(KERN_INFO "buffer = 0x%p, bufflen = %d,"
371 " queuecommand 0x%p\n", 370 " done = 0x%p, queuecommand 0x%p\n",
372 scsi_sglist(cmd), scsi_bufflen(cmd), 371 scsi_sglist(cmd), scsi_bufflen(cmd),
372 cmd->done,
373 cmd->device->host->hostt->queuecommand); 373 cmd->device->host->hostt->queuecommand);
374 374
375 } 375 }
@@ -654,12 +654,6 @@ void __scsi_done(struct scsi_cmnd *cmd)
654 blk_complete_request(rq); 654 blk_complete_request(rq);
655} 655}
656 656
657/* Move this to a header if it becomes more generally useful */
658static struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
659{
660 return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
661}
662
663/* 657/*
664 * Function: scsi_finish_command 658 * Function: scsi_finish_command
665 * 659 *
@@ -671,8 +665,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
671{ 665{
672 struct scsi_device *sdev = cmd->device; 666 struct scsi_device *sdev = cmd->device;
673 struct Scsi_Host *shost = sdev->host; 667 struct Scsi_Host *shost = sdev->host;
674 struct scsi_driver *drv;
675 unsigned int good_bytes;
676 668
677 scsi_device_unbusy(sdev); 669 scsi_device_unbusy(sdev);
678 670
@@ -698,13 +690,7 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
698 "Notifying upper driver of completion " 690 "Notifying upper driver of completion "
699 "(result %x)\n", cmd->result)); 691 "(result %x)\n", cmd->result));
700 692
701 good_bytes = cmd->request_bufflen; 693 cmd->done(cmd);
702 if (cmd->request->cmd_type != REQ_TYPE_BLOCK_PC) {
703 drv = scsi_cmd_to_driver(cmd);
704 if (drv->done)
705 good_bytes = drv->done(cmd);
706 }
707 scsi_io_completion(cmd, good_bytes);
708} 694}
709EXPORT_SYMBOL(scsi_finish_command); 695EXPORT_SYMBOL(scsi_finish_command);
710 696
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index ebaca4ca4a13..70700b97c915 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1699,6 +1699,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
1699 memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd)); 1699 memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd));
1700 1700
1701 scmd->scsi_done = scsi_reset_provider_done_command; 1701 scmd->scsi_done = scsi_reset_provider_done_command;
1702 scmd->done = NULL;
1702 scmd->request_buffer = NULL; 1703 scmd->request_buffer = NULL;
1703 scmd->request_bufflen = 0; 1704 scmd->request_bufflen = 0;
1704 1705
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 0e81e4cf8876..60f77c4b3946 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1092,6 +1092,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
1092 } 1092 }
1093 scsi_end_request(cmd, 0, this_count, !result); 1093 scsi_end_request(cmd, 0, this_count, !result);
1094} 1094}
1095EXPORT_SYMBOL(scsi_io_completion);
1095 1096
1096/* 1097/*
1097 * Function: scsi_init_io() 1098 * Function: scsi_init_io()
@@ -1170,6 +1171,18 @@ static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev,
1170 return cmd; 1171 return cmd;
1171} 1172}
1172 1173
1174static void scsi_blk_pc_done(struct scsi_cmnd *cmd)
1175{
1176 BUG_ON(!blk_pc_request(cmd->request));
1177 /*
1178 * This will complete the whole command with uptodate=1 so
1179 * as far as the block layer is concerned the command completed
1180 * successfully. Since this is a REQ_BLOCK_PC command the
1181 * caller should check the request's errors value
1182 */
1183 scsi_io_completion(cmd, cmd->request_bufflen);
1184}
1185
1173int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) 1186int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req)
1174{ 1187{
1175 struct scsi_cmnd *cmd; 1188 struct scsi_cmnd *cmd;
@@ -1219,6 +1232,7 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req)
1219 cmd->transfersize = req->data_len; 1232 cmd->transfersize = req->data_len;
1220 cmd->allowed = req->retries; 1233 cmd->allowed = req->retries;
1221 cmd->timeout_per_command = req->timeout; 1234 cmd->timeout_per_command = req->timeout;
1235 cmd->done = scsi_blk_pc_done;
1222 return BLKPREP_OK; 1236 return BLKPREP_OK;
1223} 1237}
1224EXPORT_SYMBOL(scsi_setup_blk_pc_cmnd); 1238EXPORT_SYMBOL(scsi_setup_blk_pc_cmnd);
@@ -1332,7 +1346,7 @@ int scsi_prep_return(struct request_queue *q, struct request *req, int ret)
1332} 1346}
1333EXPORT_SYMBOL(scsi_prep_return); 1347EXPORT_SYMBOL(scsi_prep_return);
1334 1348
1335static int scsi_prep_fn(struct request_queue *q, struct request *req) 1349int scsi_prep_fn(struct request_queue *q, struct request *req)
1336{ 1350{
1337 struct scsi_device *sdev = q->queuedata; 1351 struct scsi_device *sdev = q->queuedata;
1338 int ret = BLKPREP_KILL; 1352 int ret = BLKPREP_KILL;
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index eff005951895..1de52b6ded40 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -68,12 +68,14 @@ extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
68extern void scsi_device_unbusy(struct scsi_device *sdev); 68extern void scsi_device_unbusy(struct scsi_device *sdev);
69extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason); 69extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
70extern void scsi_next_command(struct scsi_cmnd *cmd); 70extern void scsi_next_command(struct scsi_cmnd *cmd);
71extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
72extern void scsi_run_host_queues(struct Scsi_Host *shost); 71extern void scsi_run_host_queues(struct Scsi_Host *shost);
73extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev); 72extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
74extern void scsi_free_queue(struct request_queue *q); 73extern void scsi_free_queue(struct request_queue *q);
75extern int scsi_init_queue(void); 74extern int scsi_init_queue(void);
76extern void scsi_exit_queue(void); 75extern void scsi_exit_queue(void);
76struct request_queue;
77struct request;
78extern int scsi_prep_fn(struct request_queue *, struct request *);
77 79
78/* scsi_proc.c */ 80/* scsi_proc.c */
79#ifdef CONFIG_SCSI_PROC_FS 81#ifdef CONFIG_SCSI_PROC_FS
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index f374fdcb6815..00b386677392 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -373,12 +373,29 @@ static int scsi_bus_resume(struct device * dev)
373 return err; 373 return err;
374} 374}
375 375
376static int scsi_bus_remove(struct device *dev)
377{
378 struct device_driver *drv = dev->driver;
379 struct scsi_device *sdev = to_scsi_device(dev);
380 int err = 0;
381
382 /* reset the prep_fn back to the default since the
383 * driver may have altered it and it's being removed */
384 blk_queue_prep_rq(sdev->request_queue, scsi_prep_fn);
385
386 if (drv && drv->remove)
387 err = drv->remove(dev);
388
389 return 0;
390}
391
376struct bus_type scsi_bus_type = { 392struct bus_type scsi_bus_type = {
377 .name = "scsi", 393 .name = "scsi",
378 .match = scsi_bus_match, 394 .match = scsi_bus_match,
379 .uevent = scsi_bus_uevent, 395 .uevent = scsi_bus_uevent,
380 .suspend = scsi_bus_suspend, 396 .suspend = scsi_bus_suspend,
381 .resume = scsi_bus_resume, 397 .resume = scsi_bus_resume,
398 .remove = scsi_bus_remove,
382}; 399};
383 400
384int scsi_sysfs_register(void) 401int scsi_sysfs_register(void)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a69b155f39a2..cb85296d5384 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -86,19 +86,6 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_DISK);
86MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD); 86MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD);
87MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC); 87MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);
88 88
89static int sd_revalidate_disk(struct gendisk *);
90static int sd_probe(struct device *);
91static int sd_remove(struct device *);
92static void sd_shutdown(struct device *);
93static int sd_suspend(struct device *, pm_message_t state);
94static int sd_resume(struct device *);
95static void sd_rescan(struct device *);
96static int sd_done(struct scsi_cmnd *);
97static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
98static void scsi_disk_release(struct class_device *cdev);
99static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
100static void sd_print_result(struct scsi_disk *, int);
101
102static DEFINE_IDR(sd_index_idr); 89static DEFINE_IDR(sd_index_idr);
103static DEFINE_SPINLOCK(sd_index_lock); 90static DEFINE_SPINLOCK(sd_index_lock);
104 91
@@ -253,7 +240,6 @@ static struct scsi_driver sd_template = {
253 .shutdown = sd_shutdown, 240 .shutdown = sd_shutdown,
254 }, 241 },
255 .rescan = sd_rescan, 242 .rescan = sd_rescan,
256 .done = sd_done,
257}; 243};
258 244
259/* 245/*
@@ -523,6 +509,12 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
523 SCpnt->timeout_per_command = timeout; 509 SCpnt->timeout_per_command = timeout;
524 510
525 /* 511 /*
512 * This is the completion routine we use. This is matched in terms
513 * of capability to this function.
514 */
515 SCpnt->done = sd_rw_intr;
516
517 /*
526 * This indicates that the command is ready from our end to be 518 * This indicates that the command is ready from our end to be
527 * queued. 519 * queued.
528 */ 520 */
@@ -895,13 +887,13 @@ static struct block_device_operations sd_fops = {
895}; 887};
896 888
897/** 889/**
898 * sd_done - bottom half handler: called when the lower level 890 * sd_rw_intr - bottom half handler: called when the lower level
899 * driver has completed (successfully or otherwise) a scsi command. 891 * driver has completed (successfully or otherwise) a scsi command.
900 * @SCpnt: mid-level's per command structure. 892 * @SCpnt: mid-level's per command structure.
901 * 893 *
902 * Note: potentially run from within an ISR. Must not block. 894 * Note: potentially run from within an ISR. Must not block.
903 **/ 895 **/
904static int sd_done(struct scsi_cmnd *SCpnt) 896static void sd_rw_intr(struct scsi_cmnd * SCpnt)
905{ 897{
906 int result = SCpnt->result; 898 int result = SCpnt->result;
907 unsigned int xfer_size = SCpnt->request_bufflen; 899 unsigned int xfer_size = SCpnt->request_bufflen;
@@ -922,7 +914,7 @@ static int sd_done(struct scsi_cmnd *SCpnt)
922 SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt)); 914 SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt));
923 if (sense_valid) { 915 if (sense_valid) {
924 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt, 916 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
925 "sd_done: sb[respc,sk,asc," 917 "sd_rw_intr: sb[respc,sk,asc,"
926 "ascq]=%x,%x,%x,%x\n", 918 "ascq]=%x,%x,%x,%x\n",
927 sshdr.response_code, 919 sshdr.response_code,
928 sshdr.sense_key, sshdr.asc, 920 sshdr.sense_key, sshdr.asc,
@@ -994,7 +986,7 @@ static int sd_done(struct scsi_cmnd *SCpnt)
994 break; 986 break;
995 } 987 }
996 out: 988 out:
997 return good_bytes; 989 scsi_io_completion(SCpnt, good_bytes);
998} 990}
999 991
1000static int media_not_present(struct scsi_disk *sdkp, 992static int media_not_present(struct scsi_disk *sdkp,
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index c61999031141..a0c4e13d4dab 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -78,7 +78,6 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);
78 78
79static int sr_probe(struct device *); 79static int sr_probe(struct device *);
80static int sr_remove(struct device *); 80static int sr_remove(struct device *);
81static int sr_done(struct scsi_cmnd *);
82 81
83static struct scsi_driver sr_template = { 82static struct scsi_driver sr_template = {
84 .owner = THIS_MODULE, 83 .owner = THIS_MODULE,
@@ -87,7 +86,6 @@ static struct scsi_driver sr_template = {
87 .probe = sr_probe, 86 .probe = sr_probe,
88 .remove = sr_remove, 87 .remove = sr_remove,
89 }, 88 },
90 .done = sr_done,
91}; 89};
92 90
93static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG]; 91static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG];
@@ -210,12 +208,12 @@ static int sr_media_change(struct cdrom_device_info *cdi, int slot)
210} 208}
211 209
212/* 210/*
213 * sr_done is the interrupt routine for the device driver. 211 * rw_intr is the interrupt routine for the device driver.
214 * 212 *
215 * It will be notified on the end of a SCSI read / write, and will take one 213 * It will be notified on the end of a SCSI read / write, and will take on
216 * of several actions based on success or failure. 214 * of several actions based on success or failure.
217 */ 215 */
218static int sr_done(struct scsi_cmnd *SCpnt) 216static void rw_intr(struct scsi_cmnd * SCpnt)
219{ 217{
220 int result = SCpnt->result; 218 int result = SCpnt->result;
221 int this_count = SCpnt->request_bufflen; 219 int this_count = SCpnt->request_bufflen;
@@ -288,7 +286,12 @@ static int sr_done(struct scsi_cmnd *SCpnt)
288 } 286 }
289 } 287 }
290 288
291 return good_bytes; 289 /*
290 * This calls the generic completion function, now that we know
291 * how many actual sectors finished, and how many sectors we need
292 * to say have failed.
293 */
294 scsi_io_completion(SCpnt, good_bytes);
292} 295}
293 296
294static int sr_prep_fn(struct request_queue *q, struct request *rq) 297static int sr_prep_fn(struct request_queue *q, struct request *rq)
@@ -425,6 +428,12 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)
425 SCpnt->timeout_per_command = timeout; 428 SCpnt->timeout_per_command = timeout;
426 429
427 /* 430 /*
431 * This is the completion routine we use. This is matched in terms
432 * of capability to this function.
433 */
434 SCpnt->done = rw_intr;
435
436 /*
428 * This indicates that the command is ready from our end to be 437 * This indicates that the command is ready from our end to be
429 * queued. 438 * queued.
430 */ 439 */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f03d9d5f5ba4..9e2e1c7291db 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -741,10 +741,10 @@ static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata)
741 if (data->rpc_status == 0) { 741 if (data->rpc_status == 0) {
742 memcpy(data->o_res.stateid.data, data->c_res.stateid.data, 742 memcpy(data->o_res.stateid.data, data->c_res.stateid.data,
743 sizeof(data->o_res.stateid.data)); 743 sizeof(data->o_res.stateid.data));
744 nfs_confirm_seqid(&data->owner->so_seqid, 0);
744 renew_lease(data->o_res.server, data->timestamp); 745 renew_lease(data->o_res.server, data->timestamp);
745 data->rpc_done = 1; 746 data->rpc_done = 1;
746 } 747 }
747 nfs_confirm_seqid(&data->owner->so_seqid, data->rpc_status);
748 nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid); 748 nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid);
749} 749}
750 750
@@ -759,7 +759,6 @@ static void nfs4_open_confirm_release(void *calldata)
759 /* In case of error, no cleanup! */ 759 /* In case of error, no cleanup! */
760 if (!data->rpc_done) 760 if (!data->rpc_done)
761 goto out_free; 761 goto out_free;
762 nfs_confirm_seqid(&data->owner->so_seqid, 0);
763 state = nfs4_opendata_to_nfs4_state(data); 762 state = nfs4_opendata_to_nfs4_state(data);
764 if (!IS_ERR(state)) 763 if (!IS_ERR(state))
765 nfs4_close_state(&data->path, state, data->o_arg.open_flags); 764 nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -886,7 +885,6 @@ static void nfs4_open_release(void *calldata)
886 /* In case we need an open_confirm, no cleanup! */ 885 /* In case we need an open_confirm, no cleanup! */
887 if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM) 886 if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)
888 goto out_free; 887 goto out_free;
889 nfs_confirm_seqid(&data->owner->so_seqid, 0);
890 state = nfs4_opendata_to_nfs4_state(data); 888 state = nfs4_opendata_to_nfs4_state(data);
891 if (!IS_ERR(state)) 889 if (!IS_ERR(state))
892 nfs4_close_state(&data->path, state, data->o_arg.open_flags); 890 nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -3333,6 +3331,12 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
3333 3331
3334 p->arg.fh = NFS_FH(inode); 3332 p->arg.fh = NFS_FH(inode);
3335 p->arg.fl = &p->fl; 3333 p->arg.fl = &p->fl;
3334 if (!(lsp->ls_seqid.flags & NFS_SEQID_CONFIRMED)) {
3335 p->arg.open_seqid = nfs_alloc_seqid(&lsp->ls_state->owner->so_seqid);
3336 if (p->arg.open_seqid == NULL)
3337 goto out_free;
3338
3339 }
3336 p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid); 3340 p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid);
3337 if (p->arg.lock_seqid == NULL) 3341 if (p->arg.lock_seqid == NULL)
3338 goto out_free; 3342 goto out_free;
@@ -3345,6 +3349,8 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
3345 memcpy(&p->fl, fl, sizeof(p->fl)); 3349 memcpy(&p->fl, fl, sizeof(p->fl));
3346 return p; 3350 return p;
3347out_free: 3351out_free:
3352 if (p->arg.open_seqid != NULL)
3353 nfs_free_seqid(p->arg.open_seqid);
3348 kfree(p); 3354 kfree(p);
3349 return NULL; 3355 return NULL;
3350} 3356}
@@ -3361,23 +3367,23 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
3361 .rpc_cred = sp->so_cred, 3367 .rpc_cred = sp->so_cred,
3362 }; 3368 };
3363 3369
3364 if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
3365 return;
3366 dprintk("%s: begin!\n", __FUNCTION__); 3370 dprintk("%s: begin!\n", __FUNCTION__);
3367 /* Do we need to do an open_to_lock_owner? */ 3371 /* Do we need to do an open_to_lock_owner? */
3368 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { 3372 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
3369 data->arg.open_seqid = nfs_alloc_seqid(&sp->so_seqid); 3373 if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0)
3370 if (data->arg.open_seqid == NULL) { 3374 return;
3371 data->rpc_status = -ENOMEM;
3372 task->tk_action = NULL;
3373 goto out;
3374 }
3375 data->arg.open_stateid = &state->stateid; 3375 data->arg.open_stateid = &state->stateid;
3376 data->arg.new_lock_owner = 1; 3376 data->arg.new_lock_owner = 1;
3377 /* Retest in case we raced... */
3378 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED))
3379 goto do_rpc;
3377 } 3380 }
3381 if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
3382 return;
3383 data->arg.new_lock_owner = 0;
3384do_rpc:
3378 data->timestamp = jiffies; 3385 data->timestamp = jiffies;
3379 rpc_call_setup(task, &msg, 0); 3386 rpc_call_setup(task, &msg, 0);
3380out:
3381 dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status); 3387 dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status);
3382} 3388}
3383 3389
@@ -3413,8 +3419,6 @@ static void nfs4_lock_release(void *calldata)
3413 struct nfs4_lockdata *data = calldata; 3419 struct nfs4_lockdata *data = calldata;
3414 3420
3415 dprintk("%s: begin!\n", __FUNCTION__); 3421 dprintk("%s: begin!\n", __FUNCTION__);
3416 if (data->arg.open_seqid != NULL)
3417 nfs_free_seqid(data->arg.open_seqid);
3418 if (data->cancelled != 0) { 3422 if (data->cancelled != 0) {
3419 struct rpc_task *task; 3423 struct rpc_task *task;
3420 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, 3424 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
@@ -3424,6 +3428,8 @@ static void nfs4_lock_release(void *calldata)
3424 dprintk("%s: cancelling lock!\n", __FUNCTION__); 3428 dprintk("%s: cancelling lock!\n", __FUNCTION__);
3425 } else 3429 } else
3426 nfs_free_seqid(data->arg.lock_seqid); 3430 nfs_free_seqid(data->arg.lock_seqid);
3431 if (data->arg.open_seqid != NULL)
3432 nfs_free_seqid(data->arg.open_seqid);
3427 nfs4_put_lock_state(data->lsp); 3433 nfs4_put_lock_state(data->lsp);
3428 put_nfs_open_context(data->ctx); 3434 put_nfs_open_context(data->ctx);
3429 kfree(data); 3435 kfree(data);
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index 3ea352d82eba..5e2e4af1a0e6 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -133,9 +133,7 @@ nfs4_renewd_prepare_shutdown(struct nfs_server *server)
133void 133void
134nfs4_kill_renewd(struct nfs_client *clp) 134nfs4_kill_renewd(struct nfs_client *clp)
135{ 135{
136 down_read(&clp->cl_sem);
137 cancel_delayed_work_sync(&clp->cl_renewd); 136 cancel_delayed_work_sync(&clp->cl_renewd);
138 up_read(&clp->cl_sem);
139} 137}
140 138
141/* 139/*
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index ea929207f274..0b0c72a072ff 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1475,7 +1475,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
1475 error = PTR_ERR(mntroot); 1475 error = PTR_ERR(mntroot);
1476 goto error_splat_super; 1476 goto error_splat_super;
1477 } 1477 }
1478 if (mntroot->d_inode->i_op != server->nfs_client->rpc_ops->dir_inode_ops) { 1478 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
1479 dput(mntroot); 1479 dput(mntroot);
1480 error = -ESTALE; 1480 error = -ESTALE;
1481 goto error_splat_super; 1481 goto error_splat_super;
@@ -1826,6 +1826,11 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
1826 error = PTR_ERR(mntroot); 1826 error = PTR_ERR(mntroot);
1827 goto error_splat_super; 1827 goto error_splat_super;
1828 } 1828 }
1829 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
1830 dput(mntroot);
1831 error = -ESTALE;
1832 goto error_splat_super;
1833 }
1829 1834
1830 s->s_flags |= MS_ACTIVE; 1835 s->s_flags |= MS_ACTIVE;
1831 mnt->mnt_sb = s; 1836 mnt->mnt_sb = s;
@@ -1900,6 +1905,11 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
1900 error = PTR_ERR(mntroot); 1905 error = PTR_ERR(mntroot);
1901 goto error_splat_super; 1906 goto error_splat_super;
1902 } 1907 }
1908 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
1909 dput(mntroot);
1910 error = -ESTALE;
1911 goto error_splat_super;
1912 }
1903 1913
1904 s->s_flags |= MS_ACTIVE; 1914 s->s_flags |= MS_ACTIVE;
1905 mnt->mnt_sb = s; 1915 mnt->mnt_sb = s;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 02a63ac04178..7411bfb0b7cc 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -202,6 +202,26 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf
202 (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \ 202 (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \
203 security_ptrace(current,task) == 0)) 203 security_ptrace(current,task) == 0))
204 204
205struct mm_struct *mm_for_maps(struct task_struct *task)
206{
207 struct mm_struct *mm = get_task_mm(task);
208 if (!mm)
209 return NULL;
210 down_read(&mm->mmap_sem);
211 task_lock(task);
212 if (task->mm != mm)
213 goto out;
214 if (task->mm != current->mm && __ptrace_may_attach(task) < 0)
215 goto out;
216 task_unlock(task);
217 return mm;
218out:
219 task_unlock(task);
220 up_read(&mm->mmap_sem);
221 mmput(mm);
222 return NULL;
223}
224
205static int proc_pid_cmdline(struct task_struct *task, char * buffer) 225static int proc_pid_cmdline(struct task_struct *task, char * buffer)
206{ 226{
207 int res = 0; 227 int res = 0;
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 1820eb2ef762..05b3e9006262 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -27,6 +27,8 @@ struct vmalloc_info {
27 unsigned long largest_chunk; 27 unsigned long largest_chunk;
28}; 28};
29 29
30extern struct mm_struct *mm_for_maps(struct task_struct *);
31
30#ifdef CONFIG_MMU 32#ifdef CONFIG_MMU
31#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START) 33#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
32extern void get_vmalloc_info(struct vmalloc_info *vmi); 34extern void get_vmalloc_info(struct vmalloc_info *vmi);
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index e0d064e9764e..3462bfde89f6 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -410,7 +410,7 @@ static const struct file_operations proc_modules_operations = {
410}; 410};
411#endif 411#endif
412 412
413#ifdef CONFIG_SLAB 413#ifdef CONFIG_SLABINFO
414static int slabinfo_open(struct inode *inode, struct file *file) 414static int slabinfo_open(struct inode *inode, struct file *file)
415{ 415{
416 return seq_open(file, &slabinfo_op); 416 return seq_open(file, &slabinfo_op);
@@ -728,7 +728,7 @@ void __init proc_misc_init(void)
728#endif 728#endif
729 create_seq_entry("stat", 0, &proc_stat_operations); 729 create_seq_entry("stat", 0, &proc_stat_operations);
730 create_seq_entry("interrupts", 0, &proc_interrupts_operations); 730 create_seq_entry("interrupts", 0, &proc_interrupts_operations);
731#ifdef CONFIG_SLAB 731#ifdef CONFIG_SLABINFO
732 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); 732 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
733#ifdef CONFIG_DEBUG_SLAB_LEAK 733#ifdef CONFIG_DEBUG_SLAB_LEAK
734 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); 734 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index c24d81a5a040..8043a3eab52c 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -397,12 +397,11 @@ static void *m_start(struct seq_file *m, loff_t *pos)
397 if (!priv->task) 397 if (!priv->task)
398 return NULL; 398 return NULL;
399 399
400 mm = get_task_mm(priv->task); 400 mm = mm_for_maps(priv->task);
401 if (!mm) 401 if (!mm)
402 return NULL; 402 return NULL;
403 403
404 priv->tail_vma = tail_vma = get_gate_vma(priv->task); 404 priv->tail_vma = tail_vma = get_gate_vma(priv->task);
405 down_read(&mm->mmap_sem);
406 405
407 /* Start with last addr hint */ 406 /* Start with last addr hint */
408 if (last_addr && (vma = find_vma(mm, last_addr))) { 407 if (last_addr && (vma = find_vma(mm, last_addr))) {
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index d8b8c7183c24..1932c2ca3457 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -165,15 +165,13 @@ static void *m_start(struct seq_file *m, loff_t *pos)
165 if (!priv->task) 165 if (!priv->task)
166 return NULL; 166 return NULL;
167 167
168 mm = get_task_mm(priv->task); 168 mm = mm_for_maps(priv->task);
169 if (!mm) { 169 if (!mm) {
170 put_task_struct(priv->task); 170 put_task_struct(priv->task);
171 priv->task = NULL; 171 priv->task = NULL;
172 return NULL; 172 return NULL;
173 } 173 }
174 174
175 down_read(&mm->mmap_sem);
176
177 /* start from the Nth VMA */ 175 /* start from the Nth VMA */
178 for (vml = mm->context.vmlist; vml; vml = vml->next) 176 for (vml = mm->context.vmlist; vml; vml = vml->next)
179 if (n-- == 0) 177 if (n-- == 0)
diff --git a/include/asm-x86/byteorder.h b/include/asm-x86/byteorder.h
index 1f2d6d5bf20d..fe2f2e5d51ba 100644
--- a/include/asm-x86/byteorder.h
+++ b/include/asm-x86/byteorder.h
@@ -30,13 +30,13 @@ static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
30 } v; 30 } v;
31 v.u = val; 31 v.u = val;
32#ifdef CONFIG_X86_BSWAP 32#ifdef CONFIG_X86_BSWAP
33 asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 33 __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
34 : "=r" (v.s.a), "=r" (v.s.b) 34 : "=r" (v.s.a), "=r" (v.s.b)
35 : "0" (v.s.a), "1" (v.s.b)); 35 : "0" (v.s.a), "1" (v.s.b));
36#else 36#else
37 v.s.a = ___arch__swab32(v.s.a); 37 v.s.a = ___arch__swab32(v.s.a);
38 v.s.b = ___arch__swab32(v.s.b); 38 v.s.b = ___arch__swab32(v.s.b);
39 asm("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b)); 39 __asm__("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
40#endif 40#endif
41 return v.u; 41 return v.u;
42} 42}
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index ba4b31432120..664a2fa7adc9 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -191,38 +191,6 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
191 191
192#define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32) 192#define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32)
193 193
194/* wrmsr with exception handling */
195#define wrmsr_safe(msr,a,b) ({ int ret__; \
196 asm volatile("2: wrmsr ; xorl %0,%0\n" \
197 "1:\n\t" \
198 ".section .fixup,\"ax\"\n\t" \
199 "3: movl %4,%0 ; jmp 1b\n\t" \
200 ".previous\n\t" \
201 ".section __ex_table,\"a\"\n" \
202 " .align 8\n\t" \
203 " .quad 2b,3b\n\t" \
204 ".previous" \
205 : "=a" (ret__) \
206 : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \
207 ret__; })
208
209#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32))
210
211#define rdmsr_safe(msr,a,b) \
212 ({ int ret__; \
213 asm volatile ("1: rdmsr\n" \
214 "2:\n" \
215 ".section .fixup,\"ax\"\n" \
216 "3: movl %4,%0\n" \
217 " jmp 2b\n" \
218 ".previous\n" \
219 ".section __ex_table,\"a\"\n" \
220 " .align 8\n" \
221 " .quad 1b,3b\n" \
222 ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b)) \
223 :"c"(msr), "i"(-EIO), "0"(0)); \
224 ret__; })
225
226#define rdtsc(low,high) \ 194#define rdtsc(low,high) \
227 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) 195 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
228 196
@@ -230,17 +198,17 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
230 __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") 198 __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
231 199
232#define rdtscp(low,high,aux) \ 200#define rdtscp(low,high,aux) \
233 asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux)) 201 __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux))
234 202
235#define rdtscll(val) do { \ 203#define rdtscll(val) do { \
236 unsigned int __a,__d; \ 204 unsigned int __a,__d; \
237 asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ 205 __asm__ __volatile__("rdtsc" : "=a" (__a), "=d" (__d)); \
238 (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ 206 (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \
239} while(0) 207} while(0)
240 208
241#define rdtscpll(val, aux) do { \ 209#define rdtscpll(val, aux) do { \
242 unsigned long __a, __d; \ 210 unsigned long __a, __d; \
243 asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \ 211 __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \
244 (val) = (__d << 32) | __a; \ 212 (val) = (__d << 32) | __a; \
245} while (0) 213} while (0)
246 214
@@ -253,6 +221,7 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
253 : "=a" (low), "=d" (high) \ 221 : "=a" (low), "=d" (high) \
254 : "c" (counter)) 222 : "c" (counter))
255 223
224
256static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx, 225static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx,
257 unsigned int *ecx, unsigned int *edx) 226 unsigned int *ecx, unsigned int *edx)
258{ 227{
@@ -320,6 +289,40 @@ static inline unsigned int cpuid_edx(unsigned int op)
320 return edx; 289 return edx;
321} 290}
322 291
292#ifdef __KERNEL__
293
294/* wrmsr with exception handling */
295#define wrmsr_safe(msr,a,b) ({ int ret__; \
296 asm volatile("2: wrmsr ; xorl %0,%0\n" \
297 "1:\n\t" \
298 ".section .fixup,\"ax\"\n\t" \
299 "3: movl %4,%0 ; jmp 1b\n\t" \
300 ".previous\n\t" \
301 ".section __ex_table,\"a\"\n" \
302 " .align 8\n\t" \
303 " .quad 2b,3b\n\t" \
304 ".previous" \
305 : "=a" (ret__) \
306 : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \
307 ret__; })
308
309#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32))
310
311#define rdmsr_safe(msr,a,b) \
312 ({ int ret__; \
313 asm volatile ("1: rdmsr\n" \
314 "2:\n" \
315 ".section .fixup,\"ax\"\n" \
316 "3: movl %4,%0\n" \
317 " jmp 2b\n" \
318 ".previous\n" \
319 ".section __ex_table,\"a\"\n" \
320 " .align 8\n" \
321 " .quad 1b,3b\n" \
322 ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b)) \
323 :"c"(msr), "i"(-EIO), "0"(0)); \
324 ret__; })
325
323#ifdef CONFIG_SMP 326#ifdef CONFIG_SMP
324void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 327void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
325void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); 328void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
@@ -343,6 +346,7 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
343 return wrmsr_safe(msr_no, l, h); 346 return wrmsr_safe(msr_no, l, h);
344} 347}
345#endif /* CONFIG_SMP */ 348#endif /* CONFIG_SMP */
349#endif /* __KERNEL__ */
346#endif /* __ASSEMBLY__ */ 350#endif /* __ASSEMBLY__ */
347 351
348#endif /* !__i386__ */ 352#endif /* !__i386__ */
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ae8146abd746..3ea5750a0f7e 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -97,6 +97,7 @@ extern void __ptrace_link(struct task_struct *child,
97extern void __ptrace_unlink(struct task_struct *child); 97extern void __ptrace_unlink(struct task_struct *child);
98extern void ptrace_untrace(struct task_struct *child); 98extern void ptrace_untrace(struct task_struct *child);
99extern int ptrace_may_attach(struct task_struct *task); 99extern int ptrace_may_attach(struct task_struct *task);
100extern int __ptrace_may_attach(struct task_struct *task);
100 101
101static inline void ptrace_link(struct task_struct *child, 102static inline void ptrace_link(struct task_struct *child,
102 struct task_struct *new_parent) 103 struct task_struct *new_parent)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index f3a8eecd99f3..f62caaad94e0 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -271,5 +271,10 @@ static inline void *kzalloc(size_t size, gfp_t flags)
271 return kmalloc(size, flags | __GFP_ZERO); 271 return kmalloc(size, flags | __GFP_ZERO);
272} 272}
273 273
274#ifdef CONFIG_SLABINFO
275extern const struct seq_operations slabinfo_op;
276ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
277#endif
278
274#endif /* __KERNEL__ */ 279#endif /* __KERNEL__ */
275#endif /* _LINUX_SLAB_H */ 280#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 32bdc2ffd715..fcc48096ee64 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -95,7 +95,4 @@ found:
95 95
96#endif /* CONFIG_NUMA */ 96#endif /* CONFIG_NUMA */
97 97
98extern const struct seq_operations slabinfo_op;
99ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
100
101#endif /* _LINUX_SLAB_DEF_H */ 98#endif /* _LINUX_SLAB_DEF_H */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 3f47e522a1ec..7613c2989370 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -34,6 +34,7 @@ struct scsi_cmnd {
34 struct list_head list; /* scsi_cmnd participates in queue lists */ 34 struct list_head list; /* scsi_cmnd participates in queue lists */
35 struct list_head eh_entry; /* entry for the host eh_cmd_q */ 35 struct list_head eh_entry; /* entry for the host eh_cmd_q */
36 int eh_eflags; /* Used by error handlr */ 36 int eh_eflags; /* Used by error handlr */
37 void (*done) (struct scsi_cmnd *); /* Mid-level done function */
37 38
38 /* 39 /*
39 * A SCSI Command is assigned a nonzero serial_number before passed 40 * A SCSI Command is assigned a nonzero serial_number before passed
@@ -121,6 +122,7 @@ extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);
121extern void scsi_put_command(struct scsi_cmnd *); 122extern void scsi_put_command(struct scsi_cmnd *);
122extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *, 123extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *,
123 struct device *); 124 struct device *);
125extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
124extern void scsi_finish_command(struct scsi_cmnd *cmd); 126extern void scsi_finish_command(struct scsi_cmnd *cmd);
125extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd); 127extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd);
126 128
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 1f5ca7f62116..56a304709fde 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -15,7 +15,6 @@ struct scsi_driver {
15 struct device_driver gendrv; 15 struct device_driver gendrv;
16 16
17 void (*rescan)(struct device *); 17 void (*rescan)(struct device *);
18 int (*done)(struct scsi_cmnd *);
19}; 18};
20#define to_scsi_driver(drv) \ 19#define to_scsi_driver(drv) \
21 container_of((drv), struct scsi_driver, gendrv) 20 container_of((drv), struct scsi_driver, gendrv)
diff --git a/include/scsi/sd.h b/include/scsi/sd.h
index f7513313ef0d..aa1e71613010 100644
--- a/include/scsi/sd.h
+++ b/include/scsi/sd.h
@@ -47,6 +47,19 @@ struct scsi_disk {
47}; 47};
48#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev) 48#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev)
49 49
50static int sd_revalidate_disk(struct gendisk *disk);
51static void sd_rw_intr(struct scsi_cmnd * SCpnt);
52static int sd_probe(struct device *);
53static int sd_remove(struct device *);
54static void sd_shutdown(struct device *dev);
55static int sd_suspend(struct device *dev, pm_message_t state);
56static int sd_resume(struct device *dev);
57static void sd_rescan(struct device *);
58static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
59static void scsi_disk_release(struct class_device *cdev);
60static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
61static void sd_print_result(struct scsi_disk *, int);
62
50#define sd_printk(prefix, sdsk, fmt, a...) \ 63#define sd_printk(prefix, sdsk, fmt, a...) \
51 (sdsk)->disk ? \ 64 (sdsk)->disk ? \
52 sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \ 65 sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
diff --git a/init/Kconfig b/init/Kconfig
index 404bbf3699be..b9d11a899b88 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -658,6 +658,12 @@ endchoice
658 658
659endmenu # General setup 659endmenu # General setup
660 660
661config SLABINFO
662 bool
663 depends on PROC_FS
664 depends on SLAB || SLUB
665 default y
666
661config RT_MUTEXES 667config RT_MUTEXES
662 boolean 668 boolean
663 select PLIST 669 select PLIST
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 7c76f2ffaeaa..c25db863081d 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -120,7 +120,7 @@ int ptrace_check_attach(struct task_struct *child, int kill)
120 return ret; 120 return ret;
121} 121}
122 122
123static int may_attach(struct task_struct *task) 123int __ptrace_may_attach(struct task_struct *task)
124{ 124{
125 /* May we inspect the given task? 125 /* May we inspect the given task?
126 * This check is used both for attaching with ptrace 126 * This check is used both for attaching with ptrace
@@ -154,7 +154,7 @@ int ptrace_may_attach(struct task_struct *task)
154{ 154{
155 int err; 155 int err;
156 task_lock(task); 156 task_lock(task);
157 err = may_attach(task); 157 err = __ptrace_may_attach(task);
158 task_unlock(task); 158 task_unlock(task);
159 return !err; 159 return !err;
160} 160}
@@ -196,7 +196,7 @@ repeat:
196 /* the same process cannot be attached many times */ 196 /* the same process cannot be attached many times */
197 if (task->ptrace & PT_PTRACED) 197 if (task->ptrace & PT_PTRACED)
198 goto bad; 198 goto bad;
199 retval = may_attach(task); 199 retval = __ptrace_may_attach(task);
200 if (retval) 200 if (retval)
201 goto bad; 201 goto bad;
202 202
diff --git a/mm/slab.c b/mm/slab.c
index 2e338a5f7b14..aebb9f68557a 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4105,7 +4105,7 @@ out:
4105 schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC)); 4105 schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC));
4106} 4106}
4107 4107
4108#ifdef CONFIG_PROC_FS 4108#ifdef CONFIG_SLABINFO
4109 4109
4110static void print_slabinfo_header(struct seq_file *m) 4110static void print_slabinfo_header(struct seq_file *m)
4111{ 4111{
diff --git a/mm/slub.c b/mm/slub.c
index 3655ad359f03..474945ecd89d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3076,6 +3076,19 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
3076 return slab_alloc(s, gfpflags, node, caller); 3076 return slab_alloc(s, gfpflags, node, caller);
3077} 3077}
3078 3078
3079static unsigned long count_partial(struct kmem_cache_node *n)
3080{
3081 unsigned long flags;
3082 unsigned long x = 0;
3083 struct page *page;
3084
3085 spin_lock_irqsave(&n->list_lock, flags);
3086 list_for_each_entry(page, &n->partial, lru)
3087 x += page->inuse;
3088 spin_unlock_irqrestore(&n->list_lock, flags);
3089 return x;
3090}
3091
3079#if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG) 3092#if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG)
3080static int validate_slab(struct kmem_cache *s, struct page *page, 3093static int validate_slab(struct kmem_cache *s, struct page *page,
3081 unsigned long *map) 3094 unsigned long *map)
@@ -3458,19 +3471,6 @@ static int list_locations(struct kmem_cache *s, char *buf,
3458 return n; 3471 return n;
3459} 3472}
3460 3473
3461static unsigned long count_partial(struct kmem_cache_node *n)
3462{
3463 unsigned long flags;
3464 unsigned long x = 0;
3465 struct page *page;
3466
3467 spin_lock_irqsave(&n->list_lock, flags);
3468 list_for_each_entry(page, &n->partial, lru)
3469 x += page->inuse;
3470 spin_unlock_irqrestore(&n->list_lock, flags);
3471 return x;
3472}
3473
3474enum slab_stat_type { 3474enum slab_stat_type {
3475 SL_FULL, 3475 SL_FULL,
3476 SL_PARTIAL, 3476 SL_PARTIAL,
@@ -4123,3 +4123,89 @@ static int __init slab_sysfs_init(void)
4123 4123
4124__initcall(slab_sysfs_init); 4124__initcall(slab_sysfs_init);
4125#endif 4125#endif
4126
4127/*
4128 * The /proc/slabinfo ABI
4129 */
4130#ifdef CONFIG_SLABINFO
4131
4132ssize_t slabinfo_write(struct file *file, const char __user * buffer,
4133 size_t count, loff_t *ppos)
4134{
4135 return -EINVAL;
4136}
4137
4138
4139static void print_slabinfo_header(struct seq_file *m)
4140{
4141 seq_puts(m, "slabinfo - version: 2.1\n");
4142 seq_puts(m, "# name <active_objs> <num_objs> <objsize> "
4143 "<objperslab> <pagesperslab>");
4144 seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
4145 seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
4146 seq_putc(m, '\n');
4147}
4148
4149static void *s_start(struct seq_file *m, loff_t *pos)
4150{
4151 loff_t n = *pos;
4152
4153 down_read(&slub_lock);
4154 if (!n)
4155 print_slabinfo_header(m);
4156
4157 return seq_list_start(&slab_caches, *pos);
4158}
4159
4160static void *s_next(struct seq_file *m, void *p, loff_t *pos)
4161{
4162 return seq_list_next(p, &slab_caches, pos);
4163}
4164
4165static void s_stop(struct seq_file *m, void *p)
4166{
4167 up_read(&slub_lock);
4168}
4169
4170static int s_show(struct seq_file *m, void *p)
4171{
4172 unsigned long nr_partials = 0;
4173 unsigned long nr_slabs = 0;
4174 unsigned long nr_inuse = 0;
4175 unsigned long nr_objs;
4176 struct kmem_cache *s;
4177 int node;
4178
4179 s = list_entry(p, struct kmem_cache, list);
4180
4181 for_each_online_node(node) {
4182 struct kmem_cache_node *n = get_node(s, node);
4183
4184 if (!n)
4185 continue;
4186
4187 nr_partials += n->nr_partial;
4188 nr_slabs += atomic_long_read(&n->nr_slabs);
4189 nr_inuse += count_partial(n);
4190 }
4191
4192 nr_objs = nr_slabs * s->objects;
4193 nr_inuse += (nr_slabs - nr_partials) * s->objects;
4194
4195 seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d", s->name, nr_inuse,
4196 nr_objs, s->size, s->objects, (1 << s->order));
4197 seq_printf(m, " : tunables %4u %4u %4u", 0, 0, 0);
4198 seq_printf(m, " : slabdata %6lu %6lu %6lu", nr_slabs, nr_slabs,
4199 0UL);
4200 seq_putc(m, '\n');
4201 return 0;
4202}
4203
4204const struct seq_operations slabinfo_op = {
4205 .start = s_start,
4206 .next = s_next,
4207 .stop = s_stop,
4208 .show = s_show,
4209};
4210
4211#endif /* CONFIG_SLABINFO */
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index a6e57d1c2eb6..1f2d85e869c0 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -625,7 +625,7 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
625 err = -EINVAL; 625 err = -EINVAL;
626 gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor); 626 gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);
627 if (!gss_auth->mech) { 627 if (!gss_auth->mech) {
628 printk(KERN_WARNING "%s: Pseudoflavor %d not found!", 628 printk(KERN_WARNING "%s: Pseudoflavor %d not found!\n",
629 __FUNCTION__, flavor); 629 __FUNCTION__, flavor);
630 goto err_free; 630 goto err_free;
631 } 631 }