Commit f126fd25 authored by John Johansen's avatar John Johansen Committed by Tim Gardner

Revert "UBUNTU: SAUCE: Move replacedby allocation into label_alloc"

BugLink: http://bugs.launchpad.net/bugs/1379535

This reverts commit 17b556348f12791d3d8b37733422c3f645bba668.
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 52e60cf5
......@@ -285,7 +285,7 @@ void aa_label_destroy(struct aa_label *label);
void aa_label_free(struct aa_label *label);
void aa_label_kref(struct kref *kref);
bool aa_label_init(struct aa_label *label, int size);
struct aa_label *aa_label_alloc(int size, struct aa_replacedby *r, gfp_t gfp);
struct aa_label *aa_label_alloc(int size, gfp_t gfp);
bool aa_label_is_subset(struct aa_label *set, struct aa_label *sub);
struct aa_profile *__aa_label_next_not_in_set(struct label_it *I,
......
......@@ -306,7 +306,7 @@ bool aa_label_init(struct aa_label *label, int size)
* Returns: new label
* else NULL if failed
*/
struct aa_label *aa_label_alloc(int size, struct aa_replacedby *r, gfp_t gfp)
struct aa_label *aa_label_alloc(int size, gfp_t gfp)
{
struct aa_label *label;
......@@ -321,14 +321,6 @@ struct aa_label *aa_label_alloc(int size, struct aa_replacedby *r, gfp_t gfp)
if (!aa_label_init(label, size))
goto fail;
if (!r) {
r = aa_alloc_replacedby(label, gfp);
if (!r)
goto fail;
} else
aa_get_replacedby(r);
/* just set new's replacedby, don't redirect here if it was passed in */
label->replacedby = r;
labelstats_inc(allocated);
......@@ -1139,6 +1131,7 @@ struct aa_label *aa_label_merge(struct aa_label *a, struct aa_label *b,
if (!label) {
struct aa_label *new;
struct aa_replacedby *r;
a = aa_get_newest_label(a);
b = aa_get_newest_label(b);
......@@ -1146,9 +1139,16 @@ struct aa_label *aa_label_merge(struct aa_label *a, struct aa_label *b,
/* could use label_merge_len(a, b), but requires double
* comparison for small savings
*/
new = aa_label_alloc(a->size + b->size, NULL, gfp);
new = aa_label_alloc(a->size + b->size, gfp);
if (!new)
goto out;
r = aa_alloc_replacedby(new, gfp);
if (!r) {
aa_label_free(new);
goto out;
}
/* only label update will set replacedby so ns lock is enough */
new->replacedby = r;
write_lock_irqsave(&ls->lock, flags);
label = __label_merge_insert(ls, new, a, b);
......@@ -1182,7 +1182,7 @@ struct aa_label *aa_label_vec_merge(struct aa_profile **vec, int len,
/* TODO: enable when read side is lockless
* check if label exists before taking locks
*/
new = aa_label_alloc(len, NULL, gfp);
new = aa_label_alloc(len, gfp);
if (!new)
return NULL;
......@@ -1807,10 +1807,20 @@ static struct aa_label *__label_update(struct aa_label *label)
AA_BUG(!label);
AA_BUG(!mutex_is_locked(&labels_ns(label)->lock));
l = aa_label_alloc(label->size, label->replacedby, GFP_KERNEL);
l = aa_label_alloc(label->size, GFP_KERNEL);
if (!l)
return NULL;
if (!label->replacedby) {
struct aa_replacedby *r = aa_alloc_replacedby(label, GFP_KERNEL);
if (!r) {
aa_put_label(l);
return NULL;
}
/* only label update will set replacedby so ns lock is enough */
label->replacedby = r;
}
/* while holding the ns_lock will stop profile replacement, removal,
* and label updates, label merging and removal can be occuring
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment