diff options
-rw-r--r-- | net/decnet/dn_dev.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 5790d660bc7d..6c916e2b8a84 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -68,7 +68,7 @@ extern struct neigh_table dn_neigh_table; | |||
68 | */ | 68 | */ |
69 | __le16 decnet_address = 0; | 69 | __le16 decnet_address = 0; |
70 | 70 | ||
71 | static DEFINE_RWLOCK(dndev_lock); | 71 | static DEFINE_SPINLOCK(dndev_lock); |
72 | static struct net_device *decnet_default_device; | 72 | static struct net_device *decnet_default_device; |
73 | static BLOCKING_NOTIFIER_HEAD(dnaddr_chain); | 73 | static BLOCKING_NOTIFIER_HEAD(dnaddr_chain); |
74 | 74 | ||
@@ -557,7 +557,8 @@ rarok: | |||
557 | struct net_device *dn_dev_get_default(void) | 557 | struct net_device *dn_dev_get_default(void) |
558 | { | 558 | { |
559 | struct net_device *dev; | 559 | struct net_device *dev; |
560 | read_lock(&dndev_lock); | 560 | |
561 | spin_lock(&dndev_lock); | ||
561 | dev = decnet_default_device; | 562 | dev = decnet_default_device; |
562 | if (dev) { | 563 | if (dev) { |
563 | if (dev->dn_ptr) | 564 | if (dev->dn_ptr) |
@@ -565,7 +566,8 @@ struct net_device *dn_dev_get_default(void) | |||
565 | else | 566 | else |
566 | dev = NULL; | 567 | dev = NULL; |
567 | } | 568 | } |
568 | read_unlock(&dndev_lock); | 569 | spin_unlock(&dndev_lock); |
570 | |||
569 | return dev; | 571 | return dev; |
570 | } | 572 | } |
571 | 573 | ||
@@ -575,13 +577,15 @@ int dn_dev_set_default(struct net_device *dev, int force) | |||
575 | int rv = -EBUSY; | 577 | int rv = -EBUSY; |
576 | if (!dev->dn_ptr) | 578 | if (!dev->dn_ptr) |
577 | return -ENODEV; | 579 | return -ENODEV; |
578 | write_lock(&dndev_lock); | 580 | |
581 | spin_lock(&dndev_lock); | ||
579 | if (force || decnet_default_device == NULL) { | 582 | if (force || decnet_default_device == NULL) { |
580 | old = decnet_default_device; | 583 | old = decnet_default_device; |
581 | decnet_default_device = dev; | 584 | decnet_default_device = dev; |
582 | rv = 0; | 585 | rv = 0; |
583 | } | 586 | } |
584 | write_unlock(&dndev_lock); | 587 | spin_unlock(&dndev_lock); |
588 | |||
585 | if (old) | 589 | if (old) |
586 | dev_put(old); | 590 | dev_put(old); |
587 | return rv; | 591 | return rv; |
@@ -589,13 +593,14 @@ int dn_dev_set_default(struct net_device *dev, int force) | |||
589 | 593 | ||
590 | static void dn_dev_check_default(struct net_device *dev) | 594 | static void dn_dev_check_default(struct net_device *dev) |
591 | { | 595 | { |
592 | write_lock(&dndev_lock); | 596 | spin_lock(&dndev_lock); |
593 | if (dev == decnet_default_device) { | 597 | if (dev == decnet_default_device) { |
594 | decnet_default_device = NULL; | 598 | decnet_default_device = NULL; |
595 | } else { | 599 | } else { |
596 | dev = NULL; | 600 | dev = NULL; |
597 | } | 601 | } |
598 | write_unlock(&dndev_lock); | 602 | spin_unlock(&dndev_lock); |
603 | |||
599 | if (dev) | 604 | if (dev) |
600 | dev_put(dev); | 605 | dev_put(dev); |
601 | } | 606 | } |