cell.c (415d2b3392d7a80903e0f97f051201aa02bf20e9) cell.c (6b3944e42e2e554aa5a4be681ecd70dccd459114)
1/* AFS cell and server record management
2 *
3 * Copyright (C) 2002, 2017 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 500 unchanged lines hidden (view full) ---

509 return 0;
510}
511
512/*
513 * Activate a cell.
514 */
515static int afs_activate_cell(struct afs_net *net, struct afs_cell *cell)
516{
1/* AFS cell and server record management
2 *
3 * Copyright (C) 2002, 2017 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 500 unchanged lines hidden (view full) ---

509 return 0;
510}
511
512/*
513 * Activate a cell.
514 */
515static int afs_activate_cell(struct afs_net *net, struct afs_cell *cell)
516{
517 struct hlist_node **p;
518 struct afs_cell *pcell;
517 int ret;
518
519 if (!cell->anonymous_key) {
520 ret = afs_alloc_anon_key(cell);
521 if (ret < 0)
522 return ret;
523 }
524

--- 4 unchanged lines hidden (view full) ---

529 NULL, 0,
530 cell, 0, true);
531#endif
532 ret = afs_proc_cell_setup(cell);
533 if (ret < 0)
534 return ret;
535
536 mutex_lock(&net->proc_cells_lock);
519 int ret;
520
521 if (!cell->anonymous_key) {
522 ret = afs_alloc_anon_key(cell);
523 if (ret < 0)
524 return ret;
525 }
526

--- 4 unchanged lines hidden (view full) ---

531 NULL, 0,
532 cell, 0, true);
533#endif
534 ret = afs_proc_cell_setup(cell);
535 if (ret < 0)
536 return ret;
537
538 mutex_lock(&net->proc_cells_lock);
537 list_add_tail(&cell->proc_link, &net->proc_cells);
539 for (p = &net->proc_cells.first; *p; p = &(*p)->next) {
540 pcell = hlist_entry(*p, struct afs_cell, proc_link);
541 if (strcmp(cell->name, pcell->name) < 0)
542 break;
543 }
544
545 cell->proc_link.pprev = p;
546 cell->proc_link.next = *p;
547 rcu_assign_pointer(*p, &cell->proc_link.next);
548 if (cell->proc_link.next)
549 cell->proc_link.next->pprev = &cell->proc_link.next;
550
538 afs_dynroot_mkdir(net, cell);
539 mutex_unlock(&net->proc_cells_lock);
540 return 0;
541}
542
543/*
544 * Deactivate a cell.
545 */
546static void afs_deactivate_cell(struct afs_net *net, struct afs_cell *cell)
547{
548 _enter("%s", cell->name);
549
550 afs_proc_cell_remove(cell);
551
552 mutex_lock(&net->proc_cells_lock);
551 afs_dynroot_mkdir(net, cell);
552 mutex_unlock(&net->proc_cells_lock);
553 return 0;
554}
555
556/*
557 * Deactivate a cell.
558 */
559static void afs_deactivate_cell(struct afs_net *net, struct afs_cell *cell)
560{
561 _enter("%s", cell->name);
562
563 afs_proc_cell_remove(cell);
564
565 mutex_lock(&net->proc_cells_lock);
553 list_del_init(&cell->proc_link);
566 hlist_del_rcu(&cell->proc_link);
554 afs_dynroot_rmdir(net, cell);
555 mutex_unlock(&net->proc_cells_lock);
556
557#ifdef CONFIG_AFS_FSCACHE
558 fscache_relinquish_cookie(cell->cache, NULL, false);
559 cell->cache = NULL;
560#endif
561

--- 217 unchanged lines hidden ---
567 afs_dynroot_rmdir(net, cell);
568 mutex_unlock(&net->proc_cells_lock);
569
570#ifdef CONFIG_AFS_FSCACHE
571 fscache_relinquish_cookie(cell->cache, NULL, false);
572 cell->cache = NULL;
573#endif
574

--- 217 unchanged lines hidden ---