Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346486
b: refs/heads/master
c: e0b2bba
h: refs/heads/master
v: v3
  • Loading branch information
Ed Cashin authored and Linus Torvalds committed Dec 18, 2012
1 parent 16810b0 commit 000256b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 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: 60116cf77310c10b573552e4d700c270ddadba76
refs/heads/master: e0b2bbab0b569590e27161290f6ea549248356df
31 changes: 20 additions & 11 deletions trunk/drivers/block/aoe/aoedev.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,34 @@ minor_get_static(ulong *sysminor, ulong aoemaj, int aoemin)
NPERSHELF = 16,
};

if (aoemin >= NPERSHELF) {
pr_err("aoe: %s %d slots per shelf\n",
"static minor device numbers support only",
NPERSHELF);
error = -1;
goto out;
}

n = aoemaj * NPERSHELF + aoemin;
if (aoemin >= NPERSHELF || n >= N_DEVS) {
if (n >= N_DEVS) {
pr_err("aoe: %s with e%ld.%d\n",
"cannot use static minor device numbers",
aoemaj, aoemin);
error = -1;
} else {
spin_lock_irqsave(&used_minors_lock, flags);
if (test_bit(n, used_minors)) {
pr_err("aoe: %s %lu\n",
"existing device already has static minor number",
n);
error = -1;
} else
set_bit(n, used_minors);
spin_unlock_irqrestore(&used_minors_lock, flags);
goto out;
}

spin_lock_irqsave(&used_minors_lock, flags);
if (test_bit(n, used_minors)) {
pr_err("aoe: %s %lu\n",
"existing device already has static minor number",
n);
error = -1;
} else
set_bit(n, used_minors);
spin_unlock_irqrestore(&used_minors_lock, flags);
*sysminor = n;
out:
return error;
}

Expand Down

0 comments on commit 000256b

Please sign in to comment.