afs: Fix cell refcounting by splitting the usage counter
[linux-block.git] / fs / afs / super.c
index 0be99016ecfb91d890db89f7981aff5fded33cf7..e72c223f831d2ffbcfe0741f546daf5c2b045dfe 100644 (file)
@@ -294,7 +294,7 @@ static int afs_parse_source(struct fs_context *fc, struct fs_parameter *param)
                               cellnamesz, cellnamesz, cellname ?: "");
                        return PTR_ERR(cell);
                }
-               afs_put_cell(ctx->net, ctx->cell);
+               afs_unuse_cell(ctx->net, ctx->cell);
                ctx->cell = cell;
        }
 
@@ -389,8 +389,8 @@ static int afs_validate_fc(struct fs_context *fc)
                                _debug("switch to alias");
                                key_put(ctx->key);
                                ctx->key = NULL;
-                               cell = afs_get_cell(ctx->cell->alias_of);
-                               afs_put_cell(ctx->net, ctx->cell);
+                               cell = afs_use_cell(ctx->cell->alias_of);
+                               afs_unuse_cell(ctx->net, ctx->cell);
                                ctx->cell = cell;
                                goto reget_key;
                        }
@@ -508,7 +508,7 @@ static struct afs_super_info *afs_alloc_sbi(struct fs_context *fc)
                if (ctx->dyn_root) {
                        as->dyn_root = true;
                } else {
-                       as->cell = afs_get_cell(ctx->cell);
+                       as->cell = afs_use_cell(ctx->cell);
                        as->volume = afs_get_volume(ctx->volume,
                                                    afs_volume_trace_get_alloc_sbi);
                }
@@ -521,7 +521,7 @@ static void afs_destroy_sbi(struct afs_super_info *as)
        if (as) {
                struct afs_net *net = afs_net(as->net_ns);
                afs_put_volume(net, as->volume, afs_volume_trace_put_destroy_sbi);
-               afs_put_cell(net, as->cell);
+               afs_unuse_cell(net, as->cell);
                put_net(as->net_ns);
                kfree(as);
        }
@@ -607,7 +607,7 @@ static void afs_free_fc(struct fs_context *fc)
 
        afs_destroy_sbi(fc->s_fs_info);
        afs_put_volume(ctx->net, ctx->volume, afs_volume_trace_put_free_fc);
-       afs_put_cell(ctx->net, ctx->cell);
+       afs_unuse_cell(ctx->net, ctx->cell);
        key_put(ctx->key);
        kfree(ctx);
 }