Open code sidtab lock to make Andrew Morton happy.
Signed-off-by: James Morris <jmorris@namei.org>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
#define SIDTAB_HASH(sid) \
(sid & SIDTAB_HASH_MASK)
#define SIDTAB_HASH(sid) \
(sid & SIDTAB_HASH_MASK)
-#define INIT_SIDTAB_LOCK(s) spin_lock_init(&s->lock)
-#define SIDTAB_LOCK(s, x) spin_lock_irqsave(&s->lock, x)
-#define SIDTAB_UNLOCK(s, x) spin_unlock_irqrestore(&s->lock, x)
-
int sidtab_init(struct sidtab *s)
{
int i;
int sidtab_init(struct sidtab *s)
{
int i;
s->nel = 0;
s->next_sid = 1;
s->shutdown = 0;
s->nel = 0;
s->next_sid = 1;
s->shutdown = 0;
+ spin_lock_init(&s->lock);
sid = sidtab_search_context(s, context);
if (!sid) {
sid = sidtab_search_context(s, context);
if (!sid) {
+ spin_lock_irqsave(&s->lock, flags);
/* Rescan now that we hold the lock. */
sid = sidtab_search_context(s, context);
if (sid)
/* Rescan now that we hold the lock. */
sid = sidtab_search_context(s, context);
if (sid)
if (ret)
s->next_sid--;
unlock_out:
if (ret)
s->next_sid--;
unlock_out:
- SIDTAB_UNLOCK(s, flags);
+ spin_unlock_irqrestore(&s->lock, flags);
- SIDTAB_LOCK(src, flags);
+ spin_lock_irqsave(&src->lock, flags);
dst->htable = src->htable;
dst->nel = src->nel;
dst->next_sid = src->next_sid;
dst->shutdown = 0;
dst->htable = src->htable;
dst->nel = src->nel;
dst->next_sid = src->next_sid;
dst->shutdown = 0;
- SIDTAB_UNLOCK(src, flags);
+ spin_unlock_irqrestore(&src->lock, flags);
}
void sidtab_shutdown(struct sidtab *s)
{
unsigned long flags;
}
void sidtab_shutdown(struct sidtab *s)
{
unsigned long flags;
+ spin_lock_irqsave(&s->lock, flags);
- SIDTAB_UNLOCK(s, flags);
+ spin_unlock_irqrestore(&s->lock, flags);