Lines Matching full:cell

2 /* AFS cell alias detection
17 static struct afs_volume *afs_sample_volume(struct afs_cell *cell, struct key *key, in afs_sample_volume() argument
25 .net = cell->net, in afs_sample_volume()
26 .cell = cell, in afs_sample_volume()
105 * Compare root.cell volumes.
107 static int afs_compare_cell_roots(struct afs_cell *cell) in afs_compare_cell_roots() argument
115 hlist_for_each_entry_rcu(p, &cell->net->proc_cells, proc_link) { in afs_compare_cell_roots()
116 if (p == cell || p->alias_of) in afs_compare_cell_roots()
119 continue; /* Ignore cells that don't have a root.cell volume. */ in afs_compare_cell_roots()
121 if (afs_compare_volume_slists(cell->root_volume, p->root_volume) != 0) in afs_compare_cell_roots()
131 cell->alias_of = afs_use_cell(p, afs_cell_trace_use_alias); in afs_compare_cell_roots()
136 * Query the new cell for a volume from a cell we're already using.
138 static int afs_query_for_alias_one(struct afs_cell *cell, struct key *key, in afs_query_for_alias_one() argument
154 _enter("%s:%s", cell->name, pvol->name); in afs_query_for_alias_one()
156 /* And see if it's in the new cell. */ in afs_query_for_alias_one()
157 volume = afs_sample_volume(cell, key, pvol->name, pvol->name_len); in afs_query_for_alias_one()
162 /* That volume is not in the new cell, so not an alias */ in afs_query_for_alias_one()
166 /* The new cell has a like-named volume also - compare volume ID, in afs_query_for_alias_one()
183 * Query the new cell for volumes we know exist in cells we're already using.
185 static int afs_query_for_alias(struct afs_cell *cell, struct key *key) in afs_query_for_alias() argument
189 _enter("%s", cell->name); in afs_query_for_alias()
191 if (mutex_lock_interruptible(&cell->net->proc_cells_lock) < 0) in afs_query_for_alias()
194 hlist_for_each_entry(p, &cell->net->proc_cells, proc_link) { in afs_query_for_alias()
195 if (p == cell || p->alias_of) in afs_query_for_alias()
200 continue; /* Ignore cells that have a root.cell volume. */ in afs_query_for_alias()
202 mutex_unlock(&cell->net->proc_cells_lock); in afs_query_for_alias()
204 if (afs_query_for_alias_one(cell, key, p) != 0) in afs_query_for_alias()
207 if (mutex_lock_interruptible(&cell->net->proc_cells_lock) < 0) { in afs_query_for_alias()
208 afs_unuse_cell(cell->net, p, afs_cell_trace_unuse_check_alias); in afs_query_for_alias()
212 afs_unuse_cell(cell->net, p, afs_cell_trace_unuse_check_alias); in afs_query_for_alias()
215 mutex_unlock(&cell->net->proc_cells_lock); in afs_query_for_alias()
220 cell->alias_of = p; /* Transfer our ref */ in afs_query_for_alias()
227 static char *afs_vl_get_cell_name(struct afs_cell *cell, struct key *key) in afs_vl_get_cell_name() argument
234 if (!afs_begin_vlserver_operation(&vc, cell, key)) in afs_vl_get_cell_name()
253 static int yfs_check_canonical_cell_name(struct afs_cell *cell, struct key *key) in yfs_check_canonical_cell_name() argument
258 cell_name = afs_vl_get_cell_name(cell, key); in yfs_check_canonical_cell_name()
262 if (strcmp(cell_name, cell->name) == 0) { in yfs_check_canonical_cell_name()
267 master = afs_lookup_cell(cell->net, cell_name, strlen(cell_name), in yfs_check_canonical_cell_name()
273 cell->alias_of = master; /* Transfer our ref */ in yfs_check_canonical_cell_name()
277 static int afs_do_cell_detect_alias(struct afs_cell *cell, struct key *key) in afs_do_cell_detect_alias() argument
282 _enter("%s", cell->name); in afs_do_cell_detect_alias()
284 ret = yfs_check_canonical_cell_name(cell, key); in afs_do_cell_detect_alias()
288 /* Try and get the root.cell volume for comparison with other cells */ in afs_do_cell_detect_alias()
289 root_volume = afs_sample_volume(cell, key, "root.cell", 9); in afs_do_cell_detect_alias()
291 cell->root_volume = root_volume; in afs_do_cell_detect_alias()
292 return afs_compare_cell_roots(cell); in afs_do_cell_detect_alias()
298 /* Okay, this cell doesn't have an root.cell volume. We need to in afs_do_cell_detect_alias()
301 return afs_query_for_alias(cell, key); in afs_do_cell_detect_alias()
305 * Check to see if a new cell is an alias of a cell we already have. At this
306 * point we have the cell's volume server list.
310 * detect an alias, cell->alias_of is set to point to the assumed master.
312 int afs_cell_detect_alias(struct afs_cell *cell, struct key *key) in afs_cell_detect_alias() argument
314 struct afs_net *net = cell->net; in afs_cell_detect_alias()
320 if (test_bit(AFS_CELL_FL_CHECK_ALIAS, &cell->flags)) { in afs_cell_detect_alias()
321 ret = afs_do_cell_detect_alias(cell, key); in afs_cell_detect_alias()
323 clear_bit_unlock(AFS_CELL_FL_CHECK_ALIAS, &cell->flags); in afs_cell_detect_alias()
325 ret = cell->alias_of ? 1 : 0; in afs_cell_detect_alias()
331 pr_notice("kAFS: Cell %s is an alias of %s\n", in afs_cell_detect_alias()
332 cell->name, cell->alias_of->name); in afs_cell_detect_alias()