summaryrefslogtreecommitdiff
path: root/fs/aufs/branch.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/aufs/branch.c')
-rw-r--r--fs/aufs/branch.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/aufs/branch.c b/fs/aufs/branch.c
index 07c842d14..80b018f57 100644
--- a/fs/aufs/branch.c
+++ b/fs/aufs/branch.c
@@ -38,7 +38,7 @@ static void au_br_do_free(struct au_branch *br)
if (br->br_fhsm) {
au_br_fhsm_fin(br->br_fhsm);
- kfree(br->br_fhsm);
+ au_delayed_kfree(br->br_fhsm);
}
key = br->br_dykey;
@@ -52,8 +52,9 @@ static void au_br_do_free(struct au_branch *br)
lockdep_off();
path_put(&br->br_path);
lockdep_on();
- kfree(wbr);
- kfree(br);
+ if (wbr)
+ au_delayed_kfree(wbr);
+ au_delayed_kfree(br);
}
/*
@@ -151,11 +152,12 @@ static struct au_branch *au_br_alloc(struct super_block *sb, int new_nbranch,
return add_branch; /* success */
out_wbr:
- kfree(add_branch->br_wbr);
+ if (add_branch->br_wbr)
+ au_delayed_kfree(add_branch->br_wbr);
out_hnotify:
au_hnotify_fin_br(add_branch);
out_br:
- kfree(add_branch);
+ au_delayed_kfree(add_branch);
out:
return ERR_PTR(err);
}
@@ -321,7 +323,7 @@ static int au_br_init_wh(struct super_block *sb, struct au_branch *br,
br->br_perm = old_perm;
if (!err && wbr && !au_br_writable(new_perm)) {
- kfree(wbr);
+ au_delayed_kfree(wbr);
br->br_wbr = NULL;
}
@@ -481,6 +483,7 @@ int au_br_add(struct super_block *sb, struct au_opt_add *add, int remount)
root = sb->s_root;
root_inode = d_inode(root);
IMustLock(root_inode);
+ IiMustWriteLock(root_inode);
err = test_add(sb, add, remount);
if (unlikely(err < 0))
goto out;
@@ -1343,7 +1346,7 @@ int au_br_mod(struct super_block *sb, struct au_opt_mod *mod, int remount,
if (br->br_wbr) {
err = au_wbr_init(br, sb, mod->perm);
if (unlikely(err)) {
- kfree(br->br_wbr);
+ au_delayed_kfree(br->br_wbr);
br->br_wbr = NULL;
}
}
@@ -1355,7 +1358,7 @@ int au_br_mod(struct super_block *sb, struct au_opt_mod *mod, int remount,
if (!au_br_fhsm(mod->perm)) {
/* fhsm --> non-fhsm */
au_br_fhsm_fin(br->br_fhsm);
- kfree(br->br_fhsm);
+ au_delayed_kfree(br->br_fhsm);
br->br_fhsm = NULL;
}
} else if (au_br_fhsm(mod->perm))
@@ -1367,7 +1370,8 @@ int au_br_mod(struct super_block *sb, struct au_opt_mod *mod, int remount,
goto out; /* success */
out_bf:
- kfree(bf);
+ if (bf)
+ au_delayed_kfree(bf);
out:
AuTraceErr(err);
return err;