Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171514
b: refs/heads/master
c: e5c140a
h: refs/heads/master
v: v3
  • Loading branch information
stephen hemminger authored and David S. Miller committed Nov 12, 2009
1 parent 8b228a9 commit 34370fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 41bdecf17e6dba92256c65972ec79a482d978be5
refs/heads/master: e5c140a340c4796054b0f6e9035e1faa7edfa6d6
19 changes: 12 additions & 7 deletions trunk/net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extern struct neigh_table dn_neigh_table;
*/
__le16 decnet_address = 0;

static DEFINE_RWLOCK(dndev_lock);
static DEFINE_SPINLOCK(dndev_lock);
static struct net_device *decnet_default_device;
static BLOCKING_NOTIFIER_HEAD(dnaddr_chain);

Expand Down Expand Up @@ -557,15 +557,17 @@ int dn_dev_ioctl(unsigned int cmd, void __user *arg)
struct net_device *dn_dev_get_default(void)
{
struct net_device *dev;
read_lock(&dndev_lock);

spin_lock(&dndev_lock);
dev = decnet_default_device;
if (dev) {
if (dev->dn_ptr)
dev_hold(dev);
else
dev = NULL;
}
read_unlock(&dndev_lock);
spin_unlock(&dndev_lock);

return dev;
}

Expand All @@ -575,27 +577,30 @@ int dn_dev_set_default(struct net_device *dev, int force)
int rv = -EBUSY;
if (!dev->dn_ptr)
return -ENODEV;
write_lock(&dndev_lock);

spin_lock(&dndev_lock);
if (force || decnet_default_device == NULL) {
old = decnet_default_device;
decnet_default_device = dev;
rv = 0;
}
write_unlock(&dndev_lock);
spin_unlock(&dndev_lock);

if (old)
dev_put(old);
return rv;
}

static void dn_dev_check_default(struct net_device *dev)
{
write_lock(&dndev_lock);
spin_lock(&dndev_lock);
if (dev == decnet_default_device) {
decnet_default_device = NULL;
} else {
dev = NULL;
}
write_unlock(&dndev_lock);
spin_unlock(&dndev_lock);

if (dev)
dev_put(dev);
}
Expand Down

0 comments on commit 34370fd

Please sign in to comment.