aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/afs/cell.c4
-rw-r--r--fs/afs/proc.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 69b95faacc5e..721425b98b31 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -334,8 +334,8 @@ int afs_cell_init(struct afs_net *net, const char *rootcell)
334 return PTR_ERR(new_root); 334 return PTR_ERR(new_root);
335 } 335 }
336 336
337 set_bit(AFS_CELL_FL_NO_GC, &new_root->flags); 337 if (!test_and_set_bit(AFS_CELL_FL_NO_GC, &new_root->flags))
338 afs_get_cell(new_root); 338 afs_get_cell(new_root);
339 339
340 /* install the new cell */ 340 /* install the new cell */
341 write_seqlock(&net->cells_lock); 341 write_seqlock(&net->cells_lock);
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 1c95756335b7..2f04d37eeef0 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -284,7 +284,8 @@ static ssize_t afs_proc_cells_write(struct file *file, const char __user *buf,
284 goto done; 284 goto done;
285 } 285 }
286 286
287 set_bit(AFS_CELL_FL_NO_GC, &cell->flags); 287 if (test_and_set_bit(AFS_CELL_FL_NO_GC, &cell->flags))
288 afs_put_cell(net, cell);
288 printk("kAFS: Added new cell '%s'\n", name); 289 printk("kAFS: Added new cell '%s'\n", name);
289 } else { 290 } else {
290 goto inval; 291 goto inval;