aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-12-22 22:01:55 -0500
committerLen Brown <len.brown@intel.com>2005-12-22 22:01:55 -0500
commitdb9ace7083dbdcc3d02bdd6a1d26132c80b5b726 (patch)
tree022e1162c2ef3f83d6214fdc7f3678bc5545714a
parentd8bcd8e41576809f276fa44be5012568296cce41 (diff)
parentc162eeaa21fde6c27112690f5bc0a461a9f1763e (diff)
Auto-update from upstream
-rw-r--r--arch/powerpc/platforms/pseries/xics.c21
-rw-r--r--drivers/media/video/saa7127.c6
-rw-r--r--drivers/media/video/saa7134/Kconfig26
-rw-r--r--drivers/media/video/saa7134/Makefile7
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c18
-rw-r--r--drivers/scsi/scsi_scan.c48
-rw-r--r--drivers/scsi/scsi_transport_fc.c59
-rw-r--r--drivers/usb/core/usb.c9
-rw-r--r--drivers/usb/storage/scsiglue.c4
-rw-r--r--fs/nfs/file.c3
-rw-r--r--include/linux/ipv6_route.h1
-rw-r--r--include/linux/irq.h2
-rw-r--r--include/linux/preempt.h1
-rw-r--r--include/net/if_inet6.h1
-rw-r--r--include/scsi/scsi_transport_fc.h11
-rw-r--r--net/8021q/vlan.c6
-rw-r--r--net/dccp/ipv4.c2
-rw-r--r--net/ipv6/addrconf.c111
-rw-r--r--net/ipv6/icmp.c16
-rw-r--r--net/ipv6/route.c13
-rw-r--r--net/netrom/nr_in.c6
-rw-r--r--net/xfrm/xfrm_policy.c30
23 files changed, 338 insertions, 79 deletions
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 72ac18067ece..0377decc0719 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -48,11 +48,6 @@ static struct hw_interrupt_type xics_pic = {
48 .set_affinity = xics_set_affinity 48 .set_affinity = xics_set_affinity
49}; 49};
50 50
51static struct hw_interrupt_type xics_8259_pic = {
52 .typename = " XICS/8259",
53 .ack = xics_mask_and_ack_irq,
54};
55
56/* This is used to map real irq numbers to virtual */ 51/* This is used to map real irq numbers to virtual */
57static struct radix_tree_root irq_map = RADIX_TREE_INIT(GFP_ATOMIC); 52static struct radix_tree_root irq_map = RADIX_TREE_INIT(GFP_ATOMIC);
58 53
@@ -367,12 +362,7 @@ int xics_get_irq(struct pt_regs *regs)
367 /* for sanity, this had better be < NR_IRQS - 16 */ 362 /* for sanity, this had better be < NR_IRQS - 16 */
368 if (vec == xics_irq_8259_cascade_real) { 363 if (vec == xics_irq_8259_cascade_real) {
369 irq = i8259_irq(regs); 364 irq = i8259_irq(regs);
370 if (irq == -1) { 365 xics_end_irq(irq_offset_up(xics_irq_8259_cascade));
371 /* Spurious cascaded interrupt. Still must ack xics */
372 xics_end_irq(irq_offset_up(xics_irq_8259_cascade));
373
374 irq = -1;
375 }
376 } else if (vec == XICS_IRQ_SPURIOUS) { 366 } else if (vec == XICS_IRQ_SPURIOUS) {
377 irq = -1; 367 irq = -1;
378 } else { 368 } else {
@@ -542,6 +532,7 @@ nextnode:
542 xics_irq_8259_cascade_real = *ireg; 532 xics_irq_8259_cascade_real = *ireg;
543 xics_irq_8259_cascade 533 xics_irq_8259_cascade
544 = virt_irq_create_mapping(xics_irq_8259_cascade_real); 534 = virt_irq_create_mapping(xics_irq_8259_cascade_real);
535 i8259_init(0, 0);
545 of_node_put(np); 536 of_node_put(np);
546 } 537 }
547 538
@@ -565,12 +556,7 @@ nextnode:
565#endif /* CONFIG_SMP */ 556#endif /* CONFIG_SMP */
566 } 557 }
567 558
568 xics_8259_pic.enable = i8259_pic.enable; 559 for (i = irq_offset_value(); i < NR_IRQS; ++i)
569 xics_8259_pic.disable = i8259_pic.disable;
570 xics_8259_pic.end = i8259_pic.end;
571 for (i = 0; i < 16; ++i)
572 get_irq_desc(i)->handler = &xics_8259_pic;
573 for (; i < NR_IRQS; ++i)
574 get_irq_desc(i)->handler = &xics_pic; 560 get_irq_desc(i)->handler = &xics_pic;
575 561
576 xics_setup_cpu(); 562 xics_setup_cpu();
@@ -590,7 +576,6 @@ static int __init xics_setup_i8259(void)
590 no_action, 0, "8259 cascade", NULL)) 576 no_action, 0, "8259 cascade", NULL))
591 printk(KERN_ERR "xics_setup_i8259: couldn't get 8259 " 577 printk(KERN_ERR "xics_setup_i8259: couldn't get 8259 "
592 "cascade\n"); 578 "cascade\n");
593 i8259_init(0, 0);
594 } 579 }
595 return 0; 580 return 0;
596} 581}
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index 3428e1ed0032..c36f014f1fdf 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -389,7 +389,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat
389static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data *data) 389static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data *data)
390{ 390{
391 struct saa7127_state *state = i2c_get_clientdata(client); 391 struct saa7127_state *state = i2c_get_clientdata(client);
392 u16 cc = data->data[0] << 8 | data->data[1]; 392 u16 cc = data->data[1] << 8 | data->data[0];
393 int enable = (data->line != 0); 393 int enable = (data->line != 0);
394 394
395 if (enable && (data->field != 0 || data->line != 21)) 395 if (enable && (data->field != 0 || data->line != 21))
@@ -397,7 +397,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
397 if (state->cc_enable != enable) { 397 if (state->cc_enable != enable) {
398 saa7127_dbg("Turn CC %s\n", enable ? "on" : "off"); 398 saa7127_dbg("Turn CC %s\n", enable ? "on" : "off");
399 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, 399 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
400 (enable << 6) | 0x11); 400 (state->xds_enable << 7) | (enable << 6) | 0x11);
401 state->cc_enable = enable; 401 state->cc_enable = enable;
402 } 402 }
403 if (!enable) 403 if (!enable)
@@ -423,7 +423,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat
423 if (state->xds_enable != enable) { 423 if (state->xds_enable != enable) {
424 saa7127_dbg("Turn XDS %s\n", enable ? "on" : "off"); 424 saa7127_dbg("Turn XDS %s\n", enable ? "on" : "off");
425 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, 425 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
426 (enable << 7) | 0x11); 426 (enable << 7) | (state->cc_enable << 6) | 0x11);
427 state->xds_enable = enable; 427 state->xds_enable = enable;
428 } 428 }
429 if (!enable) 429 if (!enable)
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index c512c4411b38..c0f604a6fe42 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -1,11 +1,10 @@
1config VIDEO_SAA7134 1config VIDEO_SAA7134
2 tristate "Philips SAA7134 support" 2 tristate "Philips SAA7134 support"
3 depends on VIDEO_DEV && PCI && I2C && SOUND && SND 3 depends on VIDEO_DEV && PCI && I2C
4 select VIDEO_BUF 4 select VIDEO_BUF
5 select VIDEO_IR 5 select VIDEO_IR
6 select VIDEO_TUNER 6 select VIDEO_TUNER
7 select CRC32 7 select CRC32
8 select SND_PCM_OSS
9 ---help--- 8 ---help---
10 This is a video4linux driver for Philips SAA713x based 9 This is a video4linux driver for Philips SAA713x based
11 TV cards. 10 TV cards.
@@ -13,6 +12,29 @@ config VIDEO_SAA7134
13 To compile this driver as a module, choose M here: the 12 To compile this driver as a module, choose M here: the
14 module will be called saa7134. 13 module will be called saa7134.
15 14
15config VIDEO_SAA7134_ALSA
16 tristate "Philips SAA7134 DMA audio support"
17 depends on VIDEO_SAA7134 && SOUND && SND && (!VIDEO_SAA7134_OSS || VIDEO_SAA7134_OSS = m)
18 select SND_PCM_OSS
19 ---help---
20 This is a video4linux driver for direct (DMA) audio in
21 Philips SAA713x based TV cards using ALSA
22
23 To compile this driver as a module, choose M here: the
24 module will be called saa7134-alsa.
25
26config VIDEO_SAA7134_OSS
27 tristate "Philips SAA7134 DMA audio support (OSS, DEPRECATED)"
28 depends on VIDEO_SAA7134 && SOUND_PRIME && (!VIDEO_SAA7134_ALSA || VIDEO_SAA7134_ALSA = m)
29 ---help---
30 This is a video4linux driver for direct (DMA) audio in
31 Philips SAA713x based TV cards using OSS
32
33 This is deprecated in favor of the ALSA module
34
35 To compile this driver as a module, choose M here: the
36 module will be called saa7134-oss.
37
16config VIDEO_SAA7134_DVB 38config VIDEO_SAA7134_DVB
17 tristate "DVB/ATSC Support for saa7134 based TV cards" 39 tristate "DVB/ATSC Support for saa7134 based TV cards"
18 depends on VIDEO_SAA7134 && DVB_CORE 40 depends on VIDEO_SAA7134 && DVB_CORE
diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile
index 134f83a96218..1ba998424bbd 100644
--- a/drivers/media/video/saa7134/Makefile
+++ b/drivers/media/video/saa7134/Makefile
@@ -4,8 +4,11 @@ saa7134-objs := saa7134-cards.o saa7134-core.o saa7134-i2c.o \
4 saa7134-video.o saa7134-input.o 4 saa7134-video.o saa7134-input.o
5 5
6obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o \ 6obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o \
7 saa6752hs.o saa7134-alsa.o \ 7 saa6752hs.o
8 saa7134-oss.o 8
9obj-$(CONFIG_VIDEO_SAA7134_ALSA) += saa7134-alsa.o
10obj-$(CONFIG_VIDEO_SAA7134_OSS) += saa7134-oss.o
11
9obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o 12obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o
10 13
11EXTRA_CFLAGS += -I$(src)/.. 14EXTRA_CFLAGS += -I$(src)/..
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index 953d5fec82d5..ade05f75fdb0 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -989,6 +989,14 @@ static int saa7134_alsa_init(void)
989 struct saa7134_dev *dev = NULL; 989 struct saa7134_dev *dev = NULL;
990 struct list_head *list; 990 struct list_head *list;
991 991
992 if (!dmasound_init && !dmasound_exit) {
993 dmasound_init = alsa_device_init;
994 dmasound_exit = alsa_device_exit;
995 } else {
996 printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n");
997 return -EBUSY;
998 }
999
992 printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); 1000 printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n");
993 1001
994 list_for_each(list,&saa7134_devlist) { 1002 list_for_each(list,&saa7134_devlist) {
@@ -1001,9 +1009,6 @@ static int saa7134_alsa_init(void)
1001 } 1009 }
1002 } 1010 }
1003 1011
1004 dmasound_init = alsa_device_init;
1005 dmasound_exit = alsa_device_exit;
1006
1007 if (dev == NULL) 1012 if (dev == NULL)
1008 printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); 1013 printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n");
1009 1014
@@ -1023,12 +1028,15 @@ static void saa7134_alsa_exit(void)
1023 snd_card_free(snd_saa7134_cards[idx]); 1028 snd_card_free(snd_saa7134_cards[idx]);
1024 } 1029 }
1025 1030
1031 dmasound_init = NULL;
1032 dmasound_exit = NULL;
1026 printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); 1033 printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n");
1027 1034
1028 return; 1035 return;
1029} 1036}
1030 1037
1031module_init(saa7134_alsa_init); 1038/* We initialize this late, to make sure the sound system is up and running */
1039late_initcall(saa7134_alsa_init);
1032module_exit(saa7134_alsa_exit); 1040module_exit(saa7134_alsa_exit);
1033MODULE_LICENSE("GPL"); 1041MODULE_LICENSE("GPL");
1034MODULE_AUTHOR("Ricardo Cerqueira"); 1042MODULE_AUTHOR("Ricardo Cerqueira");
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 513a699a6df2..8badd2a9cb2f 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -959,8 +959,17 @@ static int saa7134_oss_init(void)
959 struct saa7134_dev *dev = NULL; 959 struct saa7134_dev *dev = NULL;
960 struct list_head *list; 960 struct list_head *list;
961 961
962 if (!dmasound_init && !dmasound_exit) {
963 dmasound_init = oss_device_init;
964 dmasound_exit = oss_device_exit;
965 } else {
966 printk(KERN_WARNING "saa7134 OSS: can't load, DMA sound handler already assigned (probably to ALSA)\n");
967 return -EBUSY;
968 }
969
962 printk(KERN_INFO "saa7134 OSS driver for DMA sound loaded\n"); 970 printk(KERN_INFO "saa7134 OSS driver for DMA sound loaded\n");
963 971
972
964 list_for_each(list,&saa7134_devlist) { 973 list_for_each(list,&saa7134_devlist) {
965 dev = list_entry(list, struct saa7134_dev, devlist); 974 dev = list_entry(list, struct saa7134_dev, devlist);
966 if (dev->dmasound.priv_data == NULL) { 975 if (dev->dmasound.priv_data == NULL) {
@@ -974,9 +983,6 @@ static int saa7134_oss_init(void)
974 if (dev == NULL) 983 if (dev == NULL)
975 printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n"); 984 printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n");
976 985
977 dmasound_init = oss_device_init;
978 dmasound_exit = oss_device_exit;
979
980 return 0; 986 return 0;
981 987
982} 988}
@@ -997,12 +1003,16 @@ static void saa7134_oss_exit(void)
997 1003
998 } 1004 }
999 1005
1006 dmasound_init = NULL;
1007 dmasound_exit = NULL;
1008
1000 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); 1009 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n");
1001 1010
1002 return; 1011 return;
1003} 1012}
1004 1013
1005module_init(saa7134_oss_init); 1014/* We initialize this late, to make sure the sound system is up and running */
1015late_initcall(saa7134_oss_init);
1006module_exit(saa7134_oss_exit); 1016module_exit(saa7134_oss_exit);
1007MODULE_LICENSE("GPL"); 1017MODULE_LICENSE("GPL");
1008MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 1018MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 94e5167f260d..e36c21e06d31 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -400,6 +400,35 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
400 return found_target; 400 return found_target;
401} 401}
402 402
403struct work_queue_wrapper {
404 struct work_struct work;
405 struct scsi_target *starget;
406};
407
408static void scsi_target_reap_work(void *data) {
409 struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data;
410 struct scsi_target *starget = wqw->starget;
411 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
412 unsigned long flags;
413
414 kfree(wqw);
415
416 spin_lock_irqsave(shost->host_lock, flags);
417
418 if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
419 list_del_init(&starget->siblings);
420 spin_unlock_irqrestore(shost->host_lock, flags);
421 device_del(&starget->dev);
422 transport_unregister_device(&starget->dev);
423 put_device(&starget->dev);
424 return;
425
426 }
427 spin_unlock_irqrestore(shost->host_lock, flags);
428
429 return;
430}
431
403/** 432/**
404 * scsi_target_reap - check to see if target is in use and destroy if not 433 * scsi_target_reap - check to see if target is in use and destroy if not
405 * 434 *
@@ -411,19 +440,18 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
411 */ 440 */
412void scsi_target_reap(struct scsi_target *starget) 441void scsi_target_reap(struct scsi_target *starget)
413{ 442{
414 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 443 struct work_queue_wrapper *wqw =
415 unsigned long flags; 444 kzalloc(sizeof(struct work_queue_wrapper), GFP_ATOMIC);
416 spin_lock_irqsave(shost->host_lock, flags);
417 445
418 if (--starget->reap_ref == 0 && list_empty(&starget->devices)) { 446 if (!wqw) {
419 list_del_init(&starget->siblings); 447 starget_printk(KERN_ERR, starget,
420 spin_unlock_irqrestore(shost->host_lock, flags); 448 "Failed to allocate memory in scsi_reap_target()\n");
421 device_del(&starget->dev);
422 transport_unregister_device(&starget->dev);
423 put_device(&starget->dev);
424 return; 449 return;
425 } 450 }
426 spin_unlock_irqrestore(shost->host_lock, flags); 451
452 INIT_WORK(&wqw->work, scsi_target_reap_work, wqw);
453 wqw->starget = starget;
454 schedule_work(&wqw->work);
427} 455}
428 456
429/** 457/**
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 6cd5931d9a54..2a1a99a2ef56 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -105,6 +105,7 @@ static struct {
105 { FC_PORTSTATE_LINKDOWN, "Linkdown" }, 105 { FC_PORTSTATE_LINKDOWN, "Linkdown" },
106 { FC_PORTSTATE_ERROR, "Error" }, 106 { FC_PORTSTATE_ERROR, "Error" },
107 { FC_PORTSTATE_LOOPBACK, "Loopback" }, 107 { FC_PORTSTATE_LOOPBACK, "Loopback" },
108 { FC_PORTSTATE_DELETED, "Deleted" },
108}; 109};
109fc_enum_name_search(port_state, fc_port_state, fc_port_state_names) 110fc_enum_name_search(port_state, fc_port_state, fc_port_state_names)
110#define FC_PORTSTATE_MAX_NAMELEN 20 111#define FC_PORTSTATE_MAX_NAMELEN 20
@@ -211,6 +212,7 @@ fc_bitfield_name_search(remote_port_roles, fc_remote_port_role_names)
211#define FC_MGMTSRVR_PORTID 0x00000a 212#define FC_MGMTSRVR_PORTID 0x00000a
212 213
213 214
215static void fc_shost_remove_rports(void *data);
214static void fc_timeout_deleted_rport(void *data); 216static void fc_timeout_deleted_rport(void *data);
215static void fc_scsi_scan_rport(void *data); 217static void fc_scsi_scan_rport(void *data);
216static void fc_rport_terminate(struct fc_rport *rport); 218static void fc_rport_terminate(struct fc_rport *rport);
@@ -318,6 +320,8 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
318 fc_host_next_rport_number(shost) = 0; 320 fc_host_next_rport_number(shost) = 0;
319 fc_host_next_target_id(shost) = 0; 321 fc_host_next_target_id(shost) = 0;
320 322
323 fc_host_flags(shost) = 0;
324 INIT_WORK(&fc_host_rport_del_work(shost), fc_shost_remove_rports, shost);
321 return 0; 325 return 0;
322} 326}
323 327
@@ -387,6 +391,7 @@ show_fc_rport_##field (struct class_device *cdev, char *buf) \
387 struct fc_internal *i = to_fc_internal(shost->transportt); \ 391 struct fc_internal *i = to_fc_internal(shost->transportt); \
388 if ((i->f->get_rport_##field) && \ 392 if ((i->f->get_rport_##field) && \
389 !((rport->port_state == FC_PORTSTATE_BLOCKED) || \ 393 !((rport->port_state == FC_PORTSTATE_BLOCKED) || \
394 (rport->port_state == FC_PORTSTATE_DELETED) || \
390 (rport->port_state == FC_PORTSTATE_NOTPRESENT))) \ 395 (rport->port_state == FC_PORTSTATE_NOTPRESENT))) \
391 i->f->get_rport_##field(rport); \ 396 i->f->get_rport_##field(rport); \
392 return snprintf(buf, sz, format_string, cast rport->field); \ 397 return snprintf(buf, sz, format_string, cast rport->field); \
@@ -402,6 +407,7 @@ store_fc_rport_##field(struct class_device *cdev, const char *buf, \
402 struct Scsi_Host *shost = rport_to_shost(rport); \ 407 struct Scsi_Host *shost = rport_to_shost(rport); \
403 struct fc_internal *i = to_fc_internal(shost->transportt); \ 408 struct fc_internal *i = to_fc_internal(shost->transportt); \
404 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || \ 409 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || \
410 (rport->port_state == FC_PORTSTATE_DELETED) || \
405 (rport->port_state == FC_PORTSTATE_NOTPRESENT)) \ 411 (rport->port_state == FC_PORTSTATE_NOTPRESENT)) \
406 return -EBUSY; \ 412 return -EBUSY; \
407 val = simple_strtoul(buf, NULL, 0); \ 413 val = simple_strtoul(buf, NULL, 0); \
@@ -519,6 +525,7 @@ store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf,
519 struct Scsi_Host *shost = rport_to_shost(rport); 525 struct Scsi_Host *shost = rport_to_shost(rport);
520 struct fc_internal *i = to_fc_internal(shost->transportt); 526 struct fc_internal *i = to_fc_internal(shost->transportt);
521 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || 527 if ((rport->port_state == FC_PORTSTATE_BLOCKED) ||
528 (rport->port_state == FC_PORTSTATE_DELETED) ||
522 (rport->port_state == FC_PORTSTATE_NOTPRESENT)) 529 (rport->port_state == FC_PORTSTATE_NOTPRESENT))
523 return -EBUSY; 530 return -EBUSY;
524 val = simple_strtoul(buf, NULL, 0); 531 val = simple_strtoul(buf, NULL, 0);
@@ -1769,7 +1776,7 @@ fc_timeout_deleted_rport(void *data)
1769 rport->maxframe_size = -1; 1776 rport->maxframe_size = -1;
1770 rport->supported_classes = FC_COS_UNSPECIFIED; 1777 rport->supported_classes = FC_COS_UNSPECIFIED;
1771 rport->roles = FC_RPORT_ROLE_UNKNOWN; 1778 rport->roles = FC_RPORT_ROLE_UNKNOWN;
1772 rport->port_state = FC_PORTSTATE_NOTPRESENT; 1779 rport->port_state = FC_PORTSTATE_DELETED;
1773 1780
1774 /* remove the identifiers that aren't used in the consisting binding */ 1781 /* remove the identifiers that aren't used in the consisting binding */
1775 switch (fc_host_tgtid_bind_type(shost)) { 1782 switch (fc_host_tgtid_bind_type(shost)) {
@@ -1789,14 +1796,23 @@ fc_timeout_deleted_rport(void *data)
1789 break; 1796 break;
1790 } 1797 }
1791 1798
1792 spin_unlock_irqrestore(shost->host_lock, flags);
1793
1794 /* 1799 /*
1795 * As this only occurs if the remote port (scsi target) 1800 * As this only occurs if the remote port (scsi target)
1796 * went away and didn't come back - we'll remove 1801 * went away and didn't come back - we'll remove
1797 * all attached scsi devices. 1802 * all attached scsi devices.
1803 *
1804 * We'll schedule the shost work item to perform the actual removal
1805 * to avoid recursion in the different flush calls if we perform
1806 * the removal in each target - and there are lots of targets
1807 * whose timeouts fire at the same time.
1798 */ 1808 */
1799 fc_rport_tgt_remove(rport); 1809
1810 if ( !(fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED)) {
1811 fc_host_flags(shost) |= FC_SHOST_RPORT_DEL_SCHEDULED;
1812 scsi_queue_work(shost, &fc_host_rport_del_work(shost));
1813 }
1814
1815 spin_unlock_irqrestore(shost->host_lock, flags);
1800} 1816}
1801 1817
1802/** 1818/**
@@ -1818,6 +1834,41 @@ fc_scsi_scan_rport(void *data)
1818} 1834}
1819 1835
1820 1836
1837/**
1838 * fc_shost_remove_rports - called to remove all rports that are marked
1839 * as in a deleted (not connected) state.
1840 *
1841 * @data: shost whose rports are to be looked at
1842 **/
1843static void
1844fc_shost_remove_rports(void *data)
1845{
1846 struct Scsi_Host *shost = (struct Scsi_Host *)data;
1847 struct fc_rport *rport, *next_rport;
1848 unsigned long flags;
1849
1850 spin_lock_irqsave(shost->host_lock, flags);
1851 while (fc_host_flags(shost) & FC_SHOST_RPORT_DEL_SCHEDULED) {
1852
1853 fc_host_flags(shost) &= ~FC_SHOST_RPORT_DEL_SCHEDULED;
1854
1855restart_search:
1856 list_for_each_entry_safe(rport, next_rport,
1857 &fc_host_rport_bindings(shost), peers) {
1858 if (rport->port_state == FC_PORTSTATE_DELETED) {
1859 rport->port_state = FC_PORTSTATE_NOTPRESENT;
1860 spin_unlock_irqrestore(shost->host_lock, flags);
1861 fc_rport_tgt_remove(rport);
1862 spin_lock_irqsave(shost->host_lock, flags);
1863 goto restart_search;
1864 }
1865 }
1866
1867 }
1868 spin_unlock_irqrestore(shost->host_lock, flags);
1869}
1870
1871
1821MODULE_AUTHOR("Martin Hicks"); 1872MODULE_AUTHOR("Martin Hicks");
1822MODULE_DESCRIPTION("FC Transport Attributes"); 1873MODULE_DESCRIPTION("FC Transport Attributes");
1823MODULE_LICENSE("GPL"); 1874MODULE_LICENSE("GPL");
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index e197ce9353de..e80ef9467825 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1432,7 +1432,8 @@ static int usb_generic_suspend(struct device *dev, pm_message_t message)
1432 mark_quiesced(intf); 1432 mark_quiesced(intf);
1433 } else { 1433 } else {
1434 // FIXME else if there's no suspend method, disconnect... 1434 // FIXME else if there's no suspend method, disconnect...
1435 dev_warn(dev, "no %s?\n", "suspend"); 1435 dev_warn(dev, "no suspend for driver %s?\n", driver->name);
1436 mark_quiesced(intf);
1436 status = 0; 1437 status = 0;
1437 } 1438 }
1438 return status; 1439 return status;
@@ -1460,8 +1461,10 @@ static int usb_generic_resume(struct device *dev)
1460 } 1461 }
1461 1462
1462 if ((dev->driver == NULL) || 1463 if ((dev->driver == NULL) ||
1463 (dev->driver_data == &usb_generic_driver_data)) 1464 (dev->driver_data == &usb_generic_driver_data)) {
1465 dev->power.power_state.event = PM_EVENT_FREEZE;
1464 return 0; 1466 return 0;
1467 }
1465 1468
1466 intf = to_usb_interface(dev); 1469 intf = to_usb_interface(dev);
1467 driver = to_usb_driver(dev->driver); 1470 driver = to_usb_driver(dev->driver);
@@ -1481,7 +1484,7 @@ static int usb_generic_resume(struct device *dev)
1481 mark_quiesced(intf); 1484 mark_quiesced(intf);
1482 } 1485 }
1483 } else 1486 } else
1484 dev_warn(dev, "no %s?\n", "resume"); 1487 dev_warn(dev, "no resume for driver %s?\n", driver->name);
1485 return 0; 1488 return 0;
1486} 1489}
1487 1490
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 4837524eada7..4ef5527028c5 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -109,7 +109,7 @@ static int slave_configure(struct scsi_device *sdev)
109 * data comes from. 109 * data comes from.
110 */ 110 */
111 if (sdev->scsi_level < SCSI_2) 111 if (sdev->scsi_level < SCSI_2)
112 sdev->scsi_level = SCSI_2; 112 sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
113 113
114 /* According to the technical support people at Genesys Logic, 114 /* According to the technical support people at Genesys Logic,
115 * devices using their chips have problems transferring more than 115 * devices using their chips have problems transferring more than
@@ -162,7 +162,7 @@ static int slave_configure(struct scsi_device *sdev)
162 * a Get-Max-LUN request, we won't lose much by setting the 162 * a Get-Max-LUN request, we won't lose much by setting the
163 * revision level down to 2. The only devices that would be 163 * revision level down to 2. The only devices that would be
164 * affected are those with sparse LUNs. */ 164 * affected are those with sparse LUNs. */
165 sdev->scsi_level = SCSI_2; 165 sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
166 166
167 /* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable 167 /* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable
168 * Hardware Error) when any low-level error occurs, 168 * Hardware Error) when any low-level error occurs,
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index eb5cd4c3bbfd..7a79fbe9f539 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -509,7 +509,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
509 return -EINVAL; 509 return -EINVAL;
510 510
511 /* No mandatory locks over NFS */ 511 /* No mandatory locks over NFS */
512 if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) 512 if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID &&
513 fl->fl_type != F_UNLCK)
513 return -ENOLCK; 514 return -ENOLCK;
514 515
515 if (IS_GETLK(cmd)) 516 if (IS_GETLK(cmd))
diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h
index e2f935038013..d7c41d1d706a 100644
--- a/include/linux/ipv6_route.h
+++ b/include/linux/ipv6_route.h
@@ -18,6 +18,7 @@
18 fallback, no routers on link */ 18 fallback, no routers on link */
19#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */ 19#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */
20#define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */ 20#define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */
21#define RTF_ANYCAST 0x00100000 /* Anycast */
21 22
22#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */ 23#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
23#define RTF_EXPIRES 0x00400000 24#define RTF_EXPIRES 0x00400000
diff --git a/include/linux/irq.h b/include/linux/irq.h
index c516382fbec2..f04ba20712a2 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include <linux/config.h> 12#include <linux/config.h>
13#include <asm/smp.h> /* cpu_online_map */ 13#include <linux/smp.h>
14 14
15#if !defined(CONFIG_ARCH_S390) 15#if !defined(CONFIG_ARCH_S390)
16 16
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index d9a2f5254a51..5769d14d1e6a 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -48,6 +48,7 @@ do { \
48#define preempt_enable() \ 48#define preempt_enable() \
49do { \ 49do { \
50 preempt_enable_no_resched(); \ 50 preempt_enable_no_resched(); \
51 barrier(); \
51 preempt_check_resched(); \ 52 preempt_check_resched(); \
52} while (0) 53} while (0)
53 54
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index e97a9accb71d..d8234f9bd4c4 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -24,6 +24,7 @@
24#define IF_RA_MANAGED 0x40 24#define IF_RA_MANAGED 0x40
25#define IF_RA_RCVD 0x20 25#define IF_RA_RCVD 0x20
26#define IF_RS_SENT 0x10 26#define IF_RS_SENT 0x10
27#define IF_READY 0x80000000
27 28
28/* prefix flags */ 29/* prefix flags */
29#define IF_PREFIX_ONLINK 0x01 30#define IF_PREFIX_ONLINK 0x01
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index fac547d32a98..394f14a5b7cb 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -79,6 +79,7 @@ enum fc_port_state {
79 FC_PORTSTATE_LINKDOWN, 79 FC_PORTSTATE_LINKDOWN,
80 FC_PORTSTATE_ERROR, 80 FC_PORTSTATE_ERROR,
81 FC_PORTSTATE_LOOPBACK, 81 FC_PORTSTATE_LOOPBACK,
82 FC_PORTSTATE_DELETED,
82}; 83};
83 84
84 85
@@ -325,8 +326,14 @@ struct fc_host_attrs {
325 struct list_head rport_bindings; 326 struct list_head rport_bindings;
326 u32 next_rport_number; 327 u32 next_rport_number;
327 u32 next_target_id; 328 u32 next_target_id;
329 u8 flags;
330 struct work_struct rport_del_work;
328}; 331};
329 332
333/* values for struct fc_host_attrs "flags" field: */
334#define FC_SHOST_RPORT_DEL_SCHEDULED 0x01
335
336
330#define fc_host_node_name(x) \ 337#define fc_host_node_name(x) \
331 (((struct fc_host_attrs *)(x)->shost_data)->node_name) 338 (((struct fc_host_attrs *)(x)->shost_data)->node_name)
332#define fc_host_port_name(x) \ 339#define fc_host_port_name(x) \
@@ -365,6 +372,10 @@ struct fc_host_attrs {
365 (((struct fc_host_attrs *)(x)->shost_data)->next_rport_number) 372 (((struct fc_host_attrs *)(x)->shost_data)->next_rport_number)
366#define fc_host_next_target_id(x) \ 373#define fc_host_next_target_id(x) \
367 (((struct fc_host_attrs *)(x)->shost_data)->next_target_id) 374 (((struct fc_host_attrs *)(x)->shost_data)->next_target_id)
375#define fc_host_flags(x) \
376 (((struct fc_host_attrs *)(x)->shost_data)->flags)
377#define fc_host_rport_del_work(x) \
378 (((struct fc_host_attrs *)(x)->shost_data)->rport_del_work)
368 379
369 380
370/* The functions by which the transport class and the driver communicate */ 381/* The functions by which the transport class and the driver communicate */
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 91e412b0ab00..67465b65abe4 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -753,6 +753,8 @@ static int vlan_ioctl_handler(void __user *arg)
753 break; 753 break;
754 case GET_VLAN_REALDEV_NAME_CMD: 754 case GET_VLAN_REALDEV_NAME_CMD:
755 err = vlan_dev_get_realdev_name(args.device1, args.u.device2); 755 err = vlan_dev_get_realdev_name(args.device1, args.u.device2);
756 if (err)
757 goto out;
756 if (copy_to_user(arg, &args, 758 if (copy_to_user(arg, &args,
757 sizeof(struct vlan_ioctl_args))) { 759 sizeof(struct vlan_ioctl_args))) {
758 err = -EFAULT; 760 err = -EFAULT;
@@ -761,6 +763,8 @@ static int vlan_ioctl_handler(void __user *arg)
761 763
762 case GET_VLAN_VID_CMD: 764 case GET_VLAN_VID_CMD:
763 err = vlan_dev_get_vid(args.device1, &vid); 765 err = vlan_dev_get_vid(args.device1, &vid);
766 if (err)
767 goto out;
764 args.u.VID = vid; 768 args.u.VID = vid;
765 if (copy_to_user(arg, &args, 769 if (copy_to_user(arg, &args,
766 sizeof(struct vlan_ioctl_args))) { 770 sizeof(struct vlan_ioctl_args))) {
@@ -774,7 +778,7 @@ static int vlan_ioctl_handler(void __user *arg)
774 __FUNCTION__, args.cmd); 778 __FUNCTION__, args.cmd);
775 return -EINVAL; 779 return -EINVAL;
776 }; 780 };
777 781out:
778 return err; 782 return err;
779} 783}
780 784
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index ca03521112c5..656e13e38cfb 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -1251,7 +1251,7 @@ static int dccp_v4_destroy_sock(struct sock *sk)
1251 struct dccp_sock *dp = dccp_sk(sk); 1251 struct dccp_sock *dp = dccp_sk(sk);
1252 1252
1253 /* 1253 /*
1254 * DCCP doesn't use sk_qrite_queue, just sk_send_head 1254 * DCCP doesn't use sk_write_queue, just sk_send_head
1255 * for retransmissions 1255 * for retransmissions
1256 */ 1256 */
1257 if (sk->sk_send_head != NULL) { 1257 if (sk->sk_send_head != NULL) {
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 4ea8cf7c0cc4..510220f2ae8b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -137,6 +137,7 @@ static int addrconf_ifdown(struct net_device *dev, int how);
137static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags); 137static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags);
138static void addrconf_dad_timer(unsigned long data); 138static void addrconf_dad_timer(unsigned long data);
139static void addrconf_dad_completed(struct inet6_ifaddr *ifp); 139static void addrconf_dad_completed(struct inet6_ifaddr *ifp);
140static void addrconf_dad_run(struct inet6_dev *idev);
140static void addrconf_rs_timer(unsigned long data); 141static void addrconf_rs_timer(unsigned long data);
141static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); 142static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
142static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa); 143static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
@@ -388,6 +389,9 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
388 } 389 }
389#endif 390#endif
390 391
392 if (netif_carrier_ok(dev))
393 ndev->if_flags |= IF_READY;
394
391 write_lock_bh(&addrconf_lock); 395 write_lock_bh(&addrconf_lock);
392 dev->ip6_ptr = ndev; 396 dev->ip6_ptr = ndev;
393 write_unlock_bh(&addrconf_lock); 397 write_unlock_bh(&addrconf_lock);
@@ -415,6 +419,7 @@ static struct inet6_dev * ipv6_find_idev(struct net_device *dev)
415 if ((idev = ipv6_add_dev(dev)) == NULL) 419 if ((idev = ipv6_add_dev(dev)) == NULL)
416 return NULL; 420 return NULL;
417 } 421 }
422
418 if (dev->flags&IFF_UP) 423 if (dev->flags&IFF_UP)
419 ipv6_mc_up(idev); 424 ipv6_mc_up(idev);
420 return idev; 425 return idev;
@@ -634,8 +639,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
634 } 639 }
635#endif 640#endif
636 641
637 for (ifap = &idev->addr_list; (ifa=*ifap) != NULL; 642 for (ifap = &idev->addr_list; (ifa=*ifap) != NULL;) {
638 ifap = &ifa->if_next) {
639 if (ifa == ifp) { 643 if (ifa == ifp) {
640 *ifap = ifa->if_next; 644 *ifap = ifa->if_next;
641 __in6_ifa_put(ifp); 645 __in6_ifa_put(ifp);
@@ -643,6 +647,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
643 if (!(ifp->flags & IFA_F_PERMANENT) || onlink > 0) 647 if (!(ifp->flags & IFA_F_PERMANENT) || onlink > 0)
644 break; 648 break;
645 deleted = 1; 649 deleted = 1;
650 continue;
646 } else if (ifp->flags & IFA_F_PERMANENT) { 651 } else if (ifp->flags & IFA_F_PERMANENT) {
647 if (ipv6_prefix_equal(&ifa->addr, &ifp->addr, 652 if (ipv6_prefix_equal(&ifa->addr, &ifp->addr,
648 ifp->prefix_len)) { 653 ifp->prefix_len)) {
@@ -666,6 +671,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
666 } 671 }
667 } 672 }
668 } 673 }
674 ifap = &ifa->if_next;
669 } 675 }
670 write_unlock_bh(&idev->lock); 676 write_unlock_bh(&idev->lock);
671 677
@@ -903,11 +909,18 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
903 909
904 score.addr_type = __ipv6_addr_type(&ifa->addr); 910 score.addr_type = __ipv6_addr_type(&ifa->addr);
905 911
906 /* Rule 0: Candidate Source Address (section 4) 912 /* Rule 0:
913 * - Tentative Address (RFC2462 section 5.4)
914 * - A tentative address is not considered
915 * "assigned to an interface" in the traditional
916 * sense.
917 * - Candidate Source Address (section 4)
907 * - In any case, anycast addresses, multicast 918 * - In any case, anycast addresses, multicast
908 * addresses, and the unspecified address MUST 919 * addresses, and the unspecified address MUST
909 * NOT be included in a candidate set. 920 * NOT be included in a candidate set.
910 */ 921 */
922 if (ifa->flags & IFA_F_TENTATIVE)
923 continue;
911 if (unlikely(score.addr_type == IPV6_ADDR_ANY || 924 if (unlikely(score.addr_type == IPV6_ADDR_ANY ||
912 score.addr_type & IPV6_ADDR_MULTICAST)) { 925 score.addr_type & IPV6_ADDR_MULTICAST)) {
913 LIMIT_NETDEBUG(KERN_DEBUG 926 LIMIT_NETDEBUG(KERN_DEBUG
@@ -1215,10 +1228,8 @@ int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
1215 1228
1216/* Gets referenced address, destroys ifaddr */ 1229/* Gets referenced address, destroys ifaddr */
1217 1230
1218void addrconf_dad_failure(struct inet6_ifaddr *ifp) 1231void addrconf_dad_stop(struct inet6_ifaddr *ifp)
1219{ 1232{
1220 if (net_ratelimit())
1221 printk(KERN_INFO "%s: duplicate address detected!\n", ifp->idev->dev->name);
1222 if (ifp->flags&IFA_F_PERMANENT) { 1233 if (ifp->flags&IFA_F_PERMANENT) {
1223 spin_lock_bh(&ifp->lock); 1234 spin_lock_bh(&ifp->lock);
1224 addrconf_del_timer(ifp); 1235 addrconf_del_timer(ifp);
@@ -1244,6 +1255,12 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp)
1244 ipv6_del_addr(ifp); 1255 ipv6_del_addr(ifp);
1245} 1256}
1246 1257
1258void addrconf_dad_failure(struct inet6_ifaddr *ifp)
1259{
1260 if (net_ratelimit())
1261 printk(KERN_INFO "%s: duplicate address detected!\n", ifp->idev->dev->name);
1262 addrconf_dad_stop(ifp);
1263}
1247 1264
1248/* Join to solicited addr multicast group. */ 1265/* Join to solicited addr multicast group. */
1249 1266
@@ -2133,9 +2150,42 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2133{ 2150{
2134 struct net_device *dev = (struct net_device *) data; 2151 struct net_device *dev = (struct net_device *) data;
2135 struct inet6_dev *idev = __in6_dev_get(dev); 2152 struct inet6_dev *idev = __in6_dev_get(dev);
2153 int run_pending = 0;
2136 2154
2137 switch(event) { 2155 switch(event) {
2138 case NETDEV_UP: 2156 case NETDEV_UP:
2157 case NETDEV_CHANGE:
2158 if (event == NETDEV_UP) {
2159 if (!netif_carrier_ok(dev)) {
2160 /* device is not ready yet. */
2161 printk(KERN_INFO
2162 "ADDRCONF(NETDEV_UP): %s: "
2163 "link is not ready\n",
2164 dev->name);
2165 break;
2166 }
2167 } else {
2168 if (!netif_carrier_ok(dev)) {
2169 /* device is still not ready. */
2170 break;
2171 }
2172
2173 if (idev) {
2174 if (idev->if_flags & IF_READY) {
2175 /* device is already configured. */
2176 break;
2177 }
2178 idev->if_flags |= IF_READY;
2179 }
2180
2181 printk(KERN_INFO
2182 "ADDRCONF(NETDEV_CHANGE): %s: "
2183 "link becomes ready\n",
2184 dev->name);
2185
2186 run_pending = 1;
2187 }
2188
2139 switch(dev->type) { 2189 switch(dev->type) {
2140 case ARPHRD_SIT: 2190 case ARPHRD_SIT:
2141 addrconf_sit_config(dev); 2191 addrconf_sit_config(dev);
@@ -2152,6 +2202,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2152 break; 2202 break;
2153 }; 2203 };
2154 if (idev) { 2204 if (idev) {
2205 if (run_pending)
2206 addrconf_dad_run(idev);
2207
2155 /* If the MTU changed during the interface down, when the 2208 /* If the MTU changed during the interface down, when the
2156 interface up, the changed MTU must be reflected in the 2209 interface up, the changed MTU must be reflected in the
2157 idev as well as routers. 2210 idev as well as routers.
@@ -2186,8 +2239,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2186 */ 2239 */
2187 addrconf_ifdown(dev, event != NETDEV_DOWN); 2240 addrconf_ifdown(dev, event != NETDEV_DOWN);
2188 break; 2241 break;
2189 case NETDEV_CHANGE: 2242
2190 break;
2191 case NETDEV_CHANGENAME: 2243 case NETDEV_CHANGENAME:
2192#ifdef CONFIG_SYSCTL 2244#ifdef CONFIG_SYSCTL
2193 if (idev) { 2245 if (idev) {
@@ -2268,7 +2320,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
2268 2320
2269 /* Step 3: clear flags for stateless addrconf */ 2321 /* Step 3: clear flags for stateless addrconf */
2270 if (how != 1) 2322 if (how != 1)
2271 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD); 2323 idev->if_flags &= ~(IF_RS_SENT|IF_RA_RCVD|IF_READY);
2272 2324
2273 /* Step 4: clear address list */ 2325 /* Step 4: clear address list */
2274#ifdef CONFIG_IPV6_PRIVACY 2326#ifdef CONFIG_IPV6_PRIVACY
@@ -2377,11 +2429,20 @@ out:
2377/* 2429/*
2378 * Duplicate Address Detection 2430 * Duplicate Address Detection
2379 */ 2431 */
2432static void addrconf_dad_kick(struct inet6_ifaddr *ifp)
2433{
2434 unsigned long rand_num;
2435 struct inet6_dev *idev = ifp->idev;
2436
2437 rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1);
2438 ifp->probes = idev->cnf.dad_transmits;
2439 addrconf_mod_timer(ifp, AC_DAD, rand_num);
2440}
2441
2380static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) 2442static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags)
2381{ 2443{
2382 struct inet6_dev *idev = ifp->idev; 2444 struct inet6_dev *idev = ifp->idev;
2383 struct net_device *dev = idev->dev; 2445 struct net_device *dev = idev->dev;
2384 unsigned long rand_num;
2385 2446
2386 addrconf_join_solict(dev, &ifp->addr); 2447 addrconf_join_solict(dev, &ifp->addr);
2387 2448
@@ -2390,7 +2451,6 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags)
2390 flags); 2451 flags);
2391 2452
2392 net_srandom(ifp->addr.s6_addr32[3]); 2453 net_srandom(ifp->addr.s6_addr32[3]);
2393 rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1);
2394 2454
2395 read_lock_bh(&idev->lock); 2455 read_lock_bh(&idev->lock);
2396 if (ifp->dead) 2456 if (ifp->dead)
@@ -2407,8 +2467,17 @@ static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags)
2407 return; 2467 return;
2408 } 2468 }
2409 2469
2410 ifp->probes = idev->cnf.dad_transmits; 2470 if (idev->if_flags & IF_READY)
2411 addrconf_mod_timer(ifp, AC_DAD, rand_num); 2471 addrconf_dad_kick(ifp);
2472 else {
2473 /*
2474 * If the defice is not ready:
2475 * - keep it tentative if it is a permanent address.
2476 * - otherwise, kill it.
2477 */
2478 in6_ifa_hold(ifp);
2479 addrconf_dad_stop(ifp);
2480 }
2412 2481
2413 spin_unlock_bh(&ifp->lock); 2482 spin_unlock_bh(&ifp->lock);
2414out: 2483out:
@@ -2492,6 +2561,22 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp)
2492 } 2561 }
2493} 2562}
2494 2563
2564static void addrconf_dad_run(struct inet6_dev *idev) {
2565 struct inet6_ifaddr *ifp;
2566
2567 read_lock_bh(&idev->lock);
2568 for (ifp = idev->addr_list; ifp; ifp = ifp->if_next) {
2569 spin_lock_bh(&ifp->lock);
2570 if (!(ifp->flags & IFA_F_TENTATIVE)) {
2571 spin_unlock_bh(&ifp->lock);
2572 continue;
2573 }
2574 spin_unlock_bh(&ifp->lock);
2575 addrconf_dad_kick(ifp);
2576 }
2577 read_unlock_bh(&idev->lock);
2578}
2579
2495#ifdef CONFIG_PROC_FS 2580#ifdef CONFIG_PROC_FS
2496struct if6_iter_state { 2581struct if6_iter_state {
2497 int bucket; 2582 int bucket;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 34a332225c17..6ec6a2b549bb 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -328,8 +328,10 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
328 iif = skb->dev->ifindex; 328 iif = skb->dev->ifindex;
329 329
330 /* 330 /*
331 * Must not send if we know that source is Anycast also. 331 * Must not send error if the source does not uniquely
332 * for now we don't know that. 332 * identify a single node (RFC2463 Section 2.4).
333 * We check unspecified / multicast addresses here,
334 * and anycast addresses will be checked later.
333 */ 335 */
334 if ((addr_type == IPV6_ADDR_ANY) || (addr_type & IPV6_ADDR_MULTICAST)) { 336 if ((addr_type == IPV6_ADDR_ANY) || (addr_type & IPV6_ADDR_MULTICAST)) {
335 LIMIT_NETDEBUG(KERN_DEBUG "icmpv6_send: addr_any/mcast source\n"); 337 LIMIT_NETDEBUG(KERN_DEBUG "icmpv6_send: addr_any/mcast source\n");
@@ -373,6 +375,16 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
373 err = ip6_dst_lookup(sk, &dst, &fl); 375 err = ip6_dst_lookup(sk, &dst, &fl);
374 if (err) 376 if (err)
375 goto out; 377 goto out;
378
379 /*
380 * We won't send icmp if the destination is known
381 * anycast.
382 */
383 if (((struct rt6_info *)dst)->rt6i_flags & RTF_ANYCAST) {
384 LIMIT_NETDEBUG(KERN_DEBUG "icmpv6_send: acast source\n");
385 goto out_dst_release;
386 }
387
376 if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) 388 if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0)
377 goto out; 389 goto out;
378 390
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 7c68bfbee361..66140f13d119 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -413,11 +413,14 @@ static struct rt6_info *rt6_cow(struct rt6_info *ort, struct in6_addr *daddr,
413 rt = ip6_rt_copy(ort); 413 rt = ip6_rt_copy(ort);
414 414
415 if (rt) { 415 if (rt) {
416 ipv6_addr_copy(&rt->rt6i_dst.addr, daddr); 416 if (!(rt->rt6i_flags&RTF_GATEWAY)) {
417 417 if (rt->rt6i_dst.plen != 128 &&
418 if (!(rt->rt6i_flags&RTF_GATEWAY)) 418 ipv6_addr_equal(&rt->rt6i_dst.addr, daddr))
419 rt->rt6i_flags |= RTF_ANYCAST;
419 ipv6_addr_copy(&rt->rt6i_gateway, daddr); 420 ipv6_addr_copy(&rt->rt6i_gateway, daddr);
421 }
420 422
423 ipv6_addr_copy(&rt->rt6i_dst.addr, daddr);
421 rt->rt6i_dst.plen = 128; 424 rt->rt6i_dst.plen = 128;
422 rt->rt6i_flags |= RTF_CACHE; 425 rt->rt6i_flags |= RTF_CACHE;
423 rt->u.dst.flags |= DST_HOST; 426 rt->u.dst.flags |= DST_HOST;
@@ -1413,7 +1416,9 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
1413 rt->u.dst.obsolete = -1; 1416 rt->u.dst.obsolete = -1;
1414 1417
1415 rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP; 1418 rt->rt6i_flags = RTF_UP | RTF_NONEXTHOP;
1416 if (!anycast) 1419 if (anycast)
1420 rt->rt6i_flags |= RTF_ANYCAST;
1421 else
1417 rt->rt6i_flags |= RTF_LOCAL; 1422 rt->rt6i_flags |= RTF_LOCAL;
1418 rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_gateway); 1423 rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_gateway);
1419 if (rt->rt6i_nexthop == NULL) { 1424 if (rt->rt6i_nexthop == NULL) {
diff --git a/net/netrom/nr_in.c b/net/netrom/nr_in.c
index 004e8599b8fe..a7d88b5ad756 100644
--- a/net/netrom/nr_in.c
+++ b/net/netrom/nr_in.c
@@ -99,7 +99,7 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
99 break; 99 break;
100 100
101 case NR_RESET: 101 case NR_RESET:
102 if (sysctl_netrom_reset_circuit); 102 if (sysctl_netrom_reset_circuit)
103 nr_disconnect(sk, ECONNRESET); 103 nr_disconnect(sk, ECONNRESET);
104 break; 104 break;
105 105
@@ -130,7 +130,7 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
130 break; 130 break;
131 131
132 case NR_RESET: 132 case NR_RESET:
133 if (sysctl_netrom_reset_circuit); 133 if (sysctl_netrom_reset_circuit)
134 nr_disconnect(sk, ECONNRESET); 134 nr_disconnect(sk, ECONNRESET);
135 break; 135 break;
136 136
@@ -265,7 +265,7 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype
265 break; 265 break;
266 266
267 case NR_RESET: 267 case NR_RESET:
268 if (sysctl_netrom_reset_circuit); 268 if (sysctl_netrom_reset_circuit)
269 nr_disconnect(sk, ECONNRESET); 269 nr_disconnect(sk, ECONNRESET);
270 break; 270 break;
271 271
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 54a4be6a7d26..d19e274b9c4a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -346,6 +346,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
346 struct xfrm_policy *pol, **p; 346 struct xfrm_policy *pol, **p;
347 struct xfrm_policy *delpol = NULL; 347 struct xfrm_policy *delpol = NULL;
348 struct xfrm_policy **newpos = NULL; 348 struct xfrm_policy **newpos = NULL;
349 struct dst_entry *gc_list;
349 350
350 write_lock_bh(&xfrm_policy_lock); 351 write_lock_bh(&xfrm_policy_lock);
351 for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL;) { 352 for (p = &xfrm_policy_list[dir]; (pol=*p)!=NULL;) {
@@ -381,9 +382,36 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
381 xfrm_pol_hold(policy); 382 xfrm_pol_hold(policy);
382 write_unlock_bh(&xfrm_policy_lock); 383 write_unlock_bh(&xfrm_policy_lock);
383 384
384 if (delpol) { 385 if (delpol)
385 xfrm_policy_kill(delpol); 386 xfrm_policy_kill(delpol);
387
388 read_lock_bh(&xfrm_policy_lock);
389 gc_list = NULL;
390 for (policy = policy->next; policy; policy = policy->next) {
391 struct dst_entry *dst;
392
393 write_lock(&policy->lock);
394 dst = policy->bundles;
395 if (dst) {
396 struct dst_entry *tail = dst;
397 while (tail->next)
398 tail = tail->next;
399 tail->next = gc_list;
400 gc_list = dst;
401
402 policy->bundles = NULL;
403 }
404 write_unlock(&policy->lock);
386 } 405 }
406 read_unlock_bh(&xfrm_policy_lock);
407
408 while (gc_list) {
409 struct dst_entry *dst = gc_list;
410
411 gc_list = dst->next;
412 dst_free(dst);
413 }
414
387 return 0; 415 return 0;
388} 416}
389EXPORT_SYMBOL(xfrm_policy_insert); 417EXPORT_SYMBOL(xfrm_policy_insert);