diff options
author | Paul Mackerras <paulus@samba.org> | 2008-04-14 07:11:02 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-14 07:11:02 -0400 |
commit | ac7c5353b189e10cf5dd27399f64f7b013abffc6 (patch) | |
tree | 8222d92b774c256d6ec4399c716d76b3f05ddc4b /fs/afs/cell.c | |
parent | a8f75ea70c58546205fb7673be41455b9da5d9a7 (diff) | |
parent | 120dd64cacd4fb796bca0acba3665553f1d9ecaa (diff) |
Merge branch 'linux-2.6'
Diffstat (limited to 'fs/afs/cell.c')
-rw-r--r-- | fs/afs/cell.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/afs/cell.c b/fs/afs/cell.c index 970d38f30565..584bb0f9c36a 100644 --- a/fs/afs/cell.c +++ b/fs/afs/cell.c | |||
@@ -127,14 +127,21 @@ struct afs_cell *afs_cell_create(const char *name, char *vllist) | |||
127 | 127 | ||
128 | _enter("%s,%s", name, vllist); | 128 | _enter("%s,%s", name, vllist); |
129 | 129 | ||
130 | down_write(&afs_cells_sem); | ||
131 | read_lock(&afs_cells_lock); | ||
132 | list_for_each_entry(cell, &afs_cells, link) { | ||
133 | if (strcasecmp(cell->name, name) == 0) | ||
134 | goto duplicate_name; | ||
135 | } | ||
136 | read_unlock(&afs_cells_lock); | ||
137 | |||
130 | cell = afs_cell_alloc(name, vllist); | 138 | cell = afs_cell_alloc(name, vllist); |
131 | if (IS_ERR(cell)) { | 139 | if (IS_ERR(cell)) { |
132 | _leave(" = %ld", PTR_ERR(cell)); | 140 | _leave(" = %ld", PTR_ERR(cell)); |
141 | up_write(&afs_cells_sem); | ||
133 | return cell; | 142 | return cell; |
134 | } | 143 | } |
135 | 144 | ||
136 | down_write(&afs_cells_sem); | ||
137 | |||
138 | /* add a proc directory for this cell */ | 145 | /* add a proc directory for this cell */ |
139 | ret = afs_proc_cell_setup(cell); | 146 | ret = afs_proc_cell_setup(cell); |
140 | if (ret < 0) | 147 | if (ret < 0) |
@@ -167,6 +174,11 @@ error: | |||
167 | kfree(cell); | 174 | kfree(cell); |
168 | _leave(" = %d", ret); | 175 | _leave(" = %d", ret); |
169 | return ERR_PTR(ret); | 176 | return ERR_PTR(ret); |
177 | |||
178 | duplicate_name: | ||
179 | read_unlock(&afs_cells_lock); | ||
180 | up_write(&afs_cells_sem); | ||
181 | return ERR_PTR(-EEXIST); | ||
170 | } | 182 | } |
171 | 183 | ||
172 | /* | 184 | /* |