diff options
author | Tiger Yang <tiger.yang@oracle.com> | 2007-03-20 19:42:10 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-04-26 17:40:16 -0400 |
commit | 68e2b740c4b5394680cfefccddbdb486c5866a4c (patch) | |
tree | a420b97cff9a1d4ffff7f27834318d238675f8c4 | |
parent | 500086300e6dc5308a7328990bd50d17e075162b (diff) |
ocfs2: remove unused code
Remove node messaging code that becomes unused with the delete inode vote
removal.
[Removed even more cruft which I spotted during review --Mark]
Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
-rw-r--r-- | fs/ocfs2/inode.c | 40 | ||||
-rw-r--r-- | fs/ocfs2/inode.h | 6 | ||||
-rw-r--r-- | fs/ocfs2/vote.c | 287 | ||||
-rw-r--r-- | fs/ocfs2/vote.h | 3 |
4 files changed, 7 insertions, 329 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 10d16a9e4fda..e1e4882eab4f 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -89,24 +89,6 @@ void ocfs2_set_inode_flags(struct inode *inode) | |||
89 | inode->i_flags |= S_DIRSYNC; | 89 | inode->i_flags |= S_DIRSYNC; |
90 | } | 90 | } |
91 | 91 | ||
92 | struct inode *ocfs2_ilookup_for_vote(struct ocfs2_super *osb, | ||
93 | u64 blkno, | ||
94 | int delete_vote) | ||
95 | { | ||
96 | struct ocfs2_find_inode_args args; | ||
97 | |||
98 | /* ocfs2_ilookup_for_vote should *only* be called from the | ||
99 | * vote thread */ | ||
100 | BUG_ON(current != osb->vote_task); | ||
101 | |||
102 | args.fi_blkno = blkno; | ||
103 | args.fi_flags = OCFS2_FI_FLAG_NOWAIT; | ||
104 | if (delete_vote) | ||
105 | args.fi_flags |= OCFS2_FI_FLAG_DELETE; | ||
106 | args.fi_ino = ino_from_blkno(osb->sb, blkno); | ||
107 | return ilookup5(osb->sb, args.fi_ino, ocfs2_find_actor, &args); | ||
108 | } | ||
109 | |||
110 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, int flags) | 92 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, int flags) |
111 | { | 93 | { |
112 | struct inode *inode = NULL; | 94 | struct inode *inode = NULL; |
@@ -182,28 +164,6 @@ static int ocfs2_find_actor(struct inode *inode, void *opaque) | |||
182 | if (oi->ip_blkno != args->fi_blkno) | 164 | if (oi->ip_blkno != args->fi_blkno) |
183 | goto bail; | 165 | goto bail; |
184 | 166 | ||
185 | /* OCFS2_FI_FLAG_NOWAIT is *only* set from | ||
186 | * ocfs2_ilookup_for_vote which won't create an inode for one | ||
187 | * that isn't found. The vote thread which doesn't want to get | ||
188 | * an inode which is in the process of going away - otherwise | ||
189 | * the call to __wait_on_freeing_inode in find_inode_fast will | ||
190 | * cause it to deadlock on an inode which may be waiting on a | ||
191 | * vote (or lock release) in delete_inode */ | ||
192 | if ((args->fi_flags & OCFS2_FI_FLAG_NOWAIT) && | ||
193 | (inode->i_state & (I_FREEING|I_CLEAR))) { | ||
194 | /* As stated above, we're not going to return an | ||
195 | * inode. In the case of a delete vote, the voting | ||
196 | * code is going to signal the other node to go | ||
197 | * ahead. Mark that state here, so this freeing inode | ||
198 | * has the state when it gets to delete_inode. */ | ||
199 | if (args->fi_flags & OCFS2_FI_FLAG_DELETE) { | ||
200 | spin_lock(&oi->ip_lock); | ||
201 | ocfs2_mark_inode_remotely_deleted(inode); | ||
202 | spin_unlock(&oi->ip_lock); | ||
203 | } | ||
204 | goto bail; | ||
205 | } | ||
206 | |||
207 | ret = 1; | 167 | ret = 1; |
208 | bail: | 168 | bail: |
209 | mlog_exit(ret); | 169 | mlog_exit(ret); |
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index 92d4feb34d74..042ae20a7132 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -45,7 +45,6 @@ struct ocfs2_inode_info | |||
45 | u32 ip_clusters; | 45 | u32 ip_clusters; |
46 | struct ocfs2_extent_map ip_map; | 46 | struct ocfs2_extent_map ip_map; |
47 | struct list_head ip_io_markers; | 47 | struct list_head ip_io_markers; |
48 | int ip_orphaned_slot; | ||
49 | 48 | ||
50 | struct mutex ip_io_mutex; | 49 | struct mutex ip_io_mutex; |
51 | 50 | ||
@@ -118,14 +117,9 @@ void ocfs2_delete_inode(struct inode *inode); | |||
118 | void ocfs2_drop_inode(struct inode *inode); | 117 | void ocfs2_drop_inode(struct inode *inode); |
119 | 118 | ||
120 | /* Flags for ocfs2_iget() */ | 119 | /* Flags for ocfs2_iget() */ |
121 | #define OCFS2_FI_FLAG_NOWAIT 0x1 | ||
122 | #define OCFS2_FI_FLAG_DELETE 0x2 | ||
123 | #define OCFS2_FI_FLAG_SYSFILE 0x4 | 120 | #define OCFS2_FI_FLAG_SYSFILE 0x4 |
124 | #define OCFS2_FI_FLAG_ORPHAN_RECOVERY 0x8 | 121 | #define OCFS2_FI_FLAG_ORPHAN_RECOVERY 0x8 |
125 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 feoff, int flags); | 122 | struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 feoff, int flags); |
126 | struct inode *ocfs2_ilookup_for_vote(struct ocfs2_super *osb, | ||
127 | u64 blkno, | ||
128 | int delete_vote); | ||
129 | int ocfs2_inode_init_private(struct inode *inode); | 123 | int ocfs2_inode_init_private(struct inode *inode); |
130 | int ocfs2_inode_revalidate(struct dentry *dentry); | 124 | int ocfs2_inode_revalidate(struct dentry *dentry); |
131 | int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, | 125 | int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, |
diff --git a/fs/ocfs2/vote.c b/fs/ocfs2/vote.c index 1552d6449478..4f82a2f0efef 100644 --- a/fs/ocfs2/vote.c +++ b/fs/ocfs2/vote.c | |||
@@ -63,17 +63,10 @@ struct ocfs2_msg_hdr | |||
63 | __be32 h_node_num; /* node sending this particular message. */ | 63 | __be32 h_node_num; /* node sending this particular message. */ |
64 | }; | 64 | }; |
65 | 65 | ||
66 | /* OCFS2_MAX_FILENAME_LEN is 255 characters, but we want to align this | ||
67 | * for the network. */ | ||
68 | #define OCFS2_VOTE_FILENAME_LEN 256 | ||
69 | struct ocfs2_vote_msg | 66 | struct ocfs2_vote_msg |
70 | { | 67 | { |
71 | struct ocfs2_msg_hdr v_hdr; | 68 | struct ocfs2_msg_hdr v_hdr; |
72 | union { | 69 | __be32 v_reserved1; |
73 | __be32 v_generic1; | ||
74 | __be32 v_orphaned_slot; /* Used during delete votes */ | ||
75 | __be32 v_nlink; /* Used during unlink votes */ | ||
76 | } md1; /* Message type dependant 1 */ | ||
77 | }; | 70 | }; |
78 | 71 | ||
79 | /* Responses are given these values to maintain backwards | 72 | /* Responses are given these values to maintain backwards |
@@ -86,7 +79,6 @@ struct ocfs2_response_msg | |||
86 | { | 79 | { |
87 | struct ocfs2_msg_hdr r_hdr; | 80 | struct ocfs2_msg_hdr r_hdr; |
88 | __be32 r_response; | 81 | __be32 r_response; |
89 | __be32 r_orphaned_slot; | ||
90 | }; | 82 | }; |
91 | 83 | ||
92 | struct ocfs2_vote_work { | 84 | struct ocfs2_vote_work { |
@@ -96,7 +88,6 @@ struct ocfs2_vote_work { | |||
96 | 88 | ||
97 | enum ocfs2_vote_request { | 89 | enum ocfs2_vote_request { |
98 | OCFS2_VOTE_REQ_INVALID = 0, | 90 | OCFS2_VOTE_REQ_INVALID = 0, |
99 | OCFS2_VOTE_REQ_DELETE, | ||
100 | OCFS2_VOTE_REQ_MOUNT, | 91 | OCFS2_VOTE_REQ_MOUNT, |
101 | OCFS2_VOTE_REQ_UMOUNT, | 92 | OCFS2_VOTE_REQ_UMOUNT, |
102 | OCFS2_VOTE_REQ_LAST | 93 | OCFS2_VOTE_REQ_LAST |
@@ -151,135 +142,23 @@ static void ocfs2_process_umount_request(struct ocfs2_super *osb, | |||
151 | ocfs2_node_map_set_bit(osb, &osb->umount_map, node_num); | 142 | ocfs2_node_map_set_bit(osb, &osb->umount_map, node_num); |
152 | } | 143 | } |
153 | 144 | ||
154 | void ocfs2_mark_inode_remotely_deleted(struct inode *inode) | ||
155 | { | ||
156 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | ||
157 | |||
158 | assert_spin_locked(&oi->ip_lock); | ||
159 | /* We set the SKIP_DELETE flag on the inode so we don't try to | ||
160 | * delete it in delete_inode ourselves, thus avoiding | ||
161 | * unecessary lock pinging. If the other node failed to wipe | ||
162 | * the inode as a result of a crash, then recovery will pick | ||
163 | * up the slack. */ | ||
164 | oi->ip_flags |= OCFS2_INODE_DELETED|OCFS2_INODE_SKIP_DELETE; | ||
165 | } | ||
166 | |||
167 | static int ocfs2_process_delete_request(struct inode *inode, | ||
168 | int *orphaned_slot) | ||
169 | { | ||
170 | int response = OCFS2_RESPONSE_BUSY; | ||
171 | |||
172 | mlog(0, "DELETE vote on inode %lu, read lnk_cnt = %u, slot = %d\n", | ||
173 | inode->i_ino, inode->i_nlink, *orphaned_slot); | ||
174 | |||
175 | spin_lock(&OCFS2_I(inode)->ip_lock); | ||
176 | |||
177 | /* Whatever our vote response is, we want to make sure that | ||
178 | * the orphaned slot is recorded properly on this node *and* | ||
179 | * on the requesting node. Technically, if the requesting node | ||
180 | * did not know which slot the inode is orphaned in but we | ||
181 | * respond with BUSY he doesn't actually need the orphaned | ||
182 | * slot, but it doesn't hurt to do it here anyway. */ | ||
183 | if ((*orphaned_slot) != OCFS2_INVALID_SLOT) { | ||
184 | mlog_bug_on_msg(OCFS2_I(inode)->ip_orphaned_slot != | ||
185 | OCFS2_INVALID_SLOT && | ||
186 | OCFS2_I(inode)->ip_orphaned_slot != | ||
187 | (*orphaned_slot), | ||
188 | "Inode %llu: This node thinks it's " | ||
189 | "orphaned in slot %d, messaged it's in %d\n", | ||
190 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
191 | OCFS2_I(inode)->ip_orphaned_slot, | ||
192 | *orphaned_slot); | ||
193 | |||
194 | mlog(0, "Setting orphaned slot for inode %llu to %d\n", | ||
195 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
196 | *orphaned_slot); | ||
197 | |||
198 | OCFS2_I(inode)->ip_orphaned_slot = *orphaned_slot; | ||
199 | } else { | ||
200 | mlog(0, "Sending back orphaned slot %d for inode %llu\n", | ||
201 | OCFS2_I(inode)->ip_orphaned_slot, | ||
202 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
203 | |||
204 | *orphaned_slot = OCFS2_I(inode)->ip_orphaned_slot; | ||
205 | } | ||
206 | |||
207 | /* vote no if the file is still open. */ | ||
208 | if (OCFS2_I(inode)->ip_open_count) { | ||
209 | mlog(0, "open count = %u\n", | ||
210 | OCFS2_I(inode)->ip_open_count); | ||
211 | spin_unlock(&OCFS2_I(inode)->ip_lock); | ||
212 | goto done; | ||
213 | } | ||
214 | spin_unlock(&OCFS2_I(inode)->ip_lock); | ||
215 | |||
216 | /* directories are a bit ugly... What if someone is sitting in | ||
217 | * it? We want to make sure the inode is removed completely as | ||
218 | * a result of the iput in process_vote. */ | ||
219 | if (S_ISDIR(inode->i_mode) && (atomic_read(&inode->i_count) != 1)) { | ||
220 | mlog(0, "i_count = %u\n", atomic_read(&inode->i_count)); | ||
221 | goto done; | ||
222 | } | ||
223 | |||
224 | if (filemap_fdatawrite(inode->i_mapping)) { | ||
225 | mlog(ML_ERROR, "Could not sync inode %llu for delete!\n", | ||
226 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
227 | goto done; | ||
228 | } | ||
229 | sync_mapping_buffers(inode->i_mapping); | ||
230 | truncate_inode_pages(inode->i_mapping, 0); | ||
231 | ocfs2_extent_map_trunc(inode, 0); | ||
232 | |||
233 | spin_lock(&OCFS2_I(inode)->ip_lock); | ||
234 | /* double check open count - someone might have raced this | ||
235 | * thread into ocfs2_file_open while we were writing out | ||
236 | * data. If we're to allow a wipe of this inode now, we *must* | ||
237 | * hold the spinlock until we've marked it. */ | ||
238 | if (OCFS2_I(inode)->ip_open_count) { | ||
239 | mlog(0, "Raced to wipe! open count = %u\n", | ||
240 | OCFS2_I(inode)->ip_open_count); | ||
241 | spin_unlock(&OCFS2_I(inode)->ip_lock); | ||
242 | goto done; | ||
243 | } | ||
244 | |||
245 | /* Mark the inode as being wiped from disk. */ | ||
246 | ocfs2_mark_inode_remotely_deleted(inode); | ||
247 | spin_unlock(&OCFS2_I(inode)->ip_lock); | ||
248 | |||
249 | /* Not sure this is necessary anymore. */ | ||
250 | d_prune_aliases(inode); | ||
251 | |||
252 | /* If we get here, then we're voting 'yes', so commit the | ||
253 | * delete on our side. */ | ||
254 | response = OCFS2_RESPONSE_OK; | ||
255 | done: | ||
256 | return response; | ||
257 | } | ||
258 | |||
259 | static void ocfs2_process_vote(struct ocfs2_super *osb, | 145 | static void ocfs2_process_vote(struct ocfs2_super *osb, |
260 | struct ocfs2_vote_msg *msg) | 146 | struct ocfs2_vote_msg *msg) |
261 | { | 147 | { |
262 | int net_status, vote_response; | 148 | int net_status, vote_response; |
263 | int orphaned_slot = 0; | 149 | unsigned int node_num; |
264 | unsigned int node_num, generation; | ||
265 | u64 blkno; | 150 | u64 blkno; |
266 | enum ocfs2_vote_request request; | 151 | enum ocfs2_vote_request request; |
267 | struct inode *inode = NULL; | ||
268 | struct ocfs2_msg_hdr *hdr = &msg->v_hdr; | 152 | struct ocfs2_msg_hdr *hdr = &msg->v_hdr; |
269 | struct ocfs2_response_msg response; | 153 | struct ocfs2_response_msg response; |
270 | 154 | ||
271 | /* decode the network mumbo jumbo into local variables. */ | 155 | /* decode the network mumbo jumbo into local variables. */ |
272 | request = be32_to_cpu(hdr->h_request); | 156 | request = be32_to_cpu(hdr->h_request); |
273 | blkno = be64_to_cpu(hdr->h_blkno); | 157 | blkno = be64_to_cpu(hdr->h_blkno); |
274 | generation = be32_to_cpu(hdr->h_generation); | ||
275 | node_num = be32_to_cpu(hdr->h_node_num); | 158 | node_num = be32_to_cpu(hdr->h_node_num); |
276 | if (request == OCFS2_VOTE_REQ_DELETE) | ||
277 | orphaned_slot = be32_to_cpu(msg->md1.v_orphaned_slot); | ||
278 | 159 | ||
279 | mlog(0, "processing vote: request = %u, blkno = %llu, " | 160 | mlog(0, "processing vote: request = %u, blkno = %llu, node_num = %u\n", |
280 | "generation = %u, node_num = %u, priv1 = %u\n", request, | 161 | request, (unsigned long long)blkno, node_num); |
281 | (unsigned long long)blkno, generation, node_num, | ||
282 | be32_to_cpu(msg->md1.v_generic1)); | ||
283 | 162 | ||
284 | if (!ocfs2_is_valid_vote_request(request)) { | 163 | if (!ocfs2_is_valid_vote_request(request)) { |
285 | mlog(ML_ERROR, "Invalid vote request %d from node %u\n", | 164 | mlog(ML_ERROR, "Invalid vote request %d from node %u\n", |
@@ -302,52 +181,6 @@ static void ocfs2_process_vote(struct ocfs2_super *osb, | |||
302 | break; | 181 | break; |
303 | } | 182 | } |
304 | 183 | ||
305 | /* We cannot process the remaining message types before we're | ||
306 | * fully mounted. It's perfectly safe however to send a 'yes' | ||
307 | * response as we can't possibly have any of the state they're | ||
308 | * asking us to modify yet. */ | ||
309 | if (atomic_read(&osb->vol_state) == VOLUME_INIT) | ||
310 | goto respond; | ||
311 | |||
312 | /* If we get here, then the request is against an inode. */ | ||
313 | inode = ocfs2_ilookup_for_vote(osb, blkno, | ||
314 | request == OCFS2_VOTE_REQ_DELETE); | ||
315 | |||
316 | /* Not finding the inode is perfectly valid - it means we're | ||
317 | * not interested in what the other node is about to do to it | ||
318 | * so in those cases we automatically respond with an | ||
319 | * affirmative. Cluster locking ensures that we won't race | ||
320 | * interest in the inode with this vote request. */ | ||
321 | if (!inode) | ||
322 | goto respond; | ||
323 | |||
324 | /* Check generation values. It's possible for us to get a | ||
325 | * request against a stale inode. If so then we proceed as if | ||
326 | * we had not found an inode in the first place. */ | ||
327 | if (inode->i_generation != generation) { | ||
328 | mlog(0, "generation passed %u != inode generation = %u, " | ||
329 | "ip_flags = %x, ip_blkno = %llu, msg %llu, i_count = %u, " | ||
330 | "message type = %u\n", generation, inode->i_generation, | ||
331 | OCFS2_I(inode)->ip_flags, | ||
332 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
333 | (unsigned long long)blkno, atomic_read(&inode->i_count), | ||
334 | request); | ||
335 | iput(inode); | ||
336 | inode = NULL; | ||
337 | goto respond; | ||
338 | } | ||
339 | |||
340 | switch (request) { | ||
341 | case OCFS2_VOTE_REQ_DELETE: | ||
342 | vote_response = ocfs2_process_delete_request(inode, | ||
343 | &orphaned_slot); | ||
344 | break; | ||
345 | default: | ||
346 | mlog(ML_ERROR, "node %u, invalid request: %u\n", | ||
347 | node_num, request); | ||
348 | vote_response = OCFS2_RESPONSE_BAD_MSG; | ||
349 | } | ||
350 | |||
351 | respond: | 184 | respond: |
352 | /* Response struture is small so we just put it on the stack | 185 | /* Response struture is small so we just put it on the stack |
353 | * and stuff it inline. */ | 186 | * and stuff it inline. */ |
@@ -357,7 +190,6 @@ respond: | |||
357 | response.r_hdr.h_generation = hdr->h_generation; | 190 | response.r_hdr.h_generation = hdr->h_generation; |
358 | response.r_hdr.h_node_num = cpu_to_be32(osb->node_num); | 191 | response.r_hdr.h_node_num = cpu_to_be32(osb->node_num); |
359 | response.r_response = cpu_to_be32(vote_response); | 192 | response.r_response = cpu_to_be32(vote_response); |
360 | response.r_orphaned_slot = cpu_to_be32(orphaned_slot); | ||
361 | 193 | ||
362 | net_status = o2net_send_message(OCFS2_MESSAGE_TYPE_RESPONSE, | 194 | net_status = o2net_send_message(OCFS2_MESSAGE_TYPE_RESPONSE, |
363 | osb->net_key, | 195 | osb->net_key, |
@@ -373,9 +205,6 @@ respond: | |||
373 | && net_status != -ENOTCONN) | 205 | && net_status != -ENOTCONN) |
374 | mlog(ML_ERROR, "message to node %u fails with error %d!\n", | 206 | mlog(ML_ERROR, "message to node %u fails with error %d!\n", |
375 | node_num, net_status); | 207 | node_num, net_status); |
376 | |||
377 | if (inode) | ||
378 | iput(inode); | ||
379 | } | 208 | } |
380 | 209 | ||
381 | static void ocfs2_vote_thread_do_work(struct ocfs2_super *osb) | 210 | static void ocfs2_vote_thread_do_work(struct ocfs2_super *osb) |
@@ -634,8 +463,7 @@ bail: | |||
634 | static struct ocfs2_vote_msg * ocfs2_new_vote_request(struct ocfs2_super *osb, | 463 | static struct ocfs2_vote_msg * ocfs2_new_vote_request(struct ocfs2_super *osb, |
635 | u64 blkno, | 464 | u64 blkno, |
636 | unsigned int generation, | 465 | unsigned int generation, |
637 | enum ocfs2_vote_request type, | 466 | enum ocfs2_vote_request type) |
638 | u32 priv) | ||
639 | { | 467 | { |
640 | struct ocfs2_vote_msg *request; | 468 | struct ocfs2_vote_msg *request; |
641 | struct ocfs2_msg_hdr *hdr; | 469 | struct ocfs2_msg_hdr *hdr; |
@@ -651,8 +479,6 @@ static struct ocfs2_vote_msg * ocfs2_new_vote_request(struct ocfs2_super *osb, | |||
651 | hdr->h_request = cpu_to_be32(type); | 479 | hdr->h_request = cpu_to_be32(type); |
652 | hdr->h_blkno = cpu_to_be64(blkno); | 480 | hdr->h_blkno = cpu_to_be64(blkno); |
653 | hdr->h_generation = cpu_to_be32(generation); | 481 | hdr->h_generation = cpu_to_be32(generation); |
654 | |||
655 | request->md1.v_generic1 = cpu_to_be32(priv); | ||
656 | } | 482 | } |
657 | 483 | ||
658 | return request; | 484 | return request; |
@@ -686,109 +512,12 @@ bail: | |||
686 | return status; | 512 | return status; |
687 | } | 513 | } |
688 | 514 | ||
689 | static int ocfs2_request_vote(struct inode *inode, | ||
690 | struct ocfs2_vote_msg *request, | ||
691 | struct ocfs2_net_response_cb *callback) | ||
692 | { | ||
693 | int status; | ||
694 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
695 | |||
696 | if (ocfs2_inode_is_new(inode)) | ||
697 | return 0; | ||
698 | |||
699 | status = -EAGAIN; | ||
700 | while (status == -EAGAIN) { | ||
701 | if (!(osb->s_mount_opt & OCFS2_MOUNT_NOINTR) && | ||
702 | signal_pending(current)) | ||
703 | return -ERESTARTSYS; | ||
704 | |||
705 | status = ocfs2_super_lock(osb, 0); | ||
706 | if (status < 0) { | ||
707 | mlog_errno(status); | ||
708 | break; | ||
709 | } | ||
710 | |||
711 | status = 0; | ||
712 | if (!ocfs2_node_map_is_only(osb, &osb->mounted_map, | ||
713 | osb->node_num)) | ||
714 | status = ocfs2_do_request_vote(osb, request, callback); | ||
715 | |||
716 | ocfs2_super_unlock(osb, 0); | ||
717 | } | ||
718 | return status; | ||
719 | } | ||
720 | |||
721 | static void ocfs2_delete_response_cb(void *priv, | ||
722 | struct ocfs2_response_msg *resp) | ||
723 | { | ||
724 | int orphaned_slot, node; | ||
725 | struct inode *inode = priv; | ||
726 | |||
727 | orphaned_slot = be32_to_cpu(resp->r_orphaned_slot); | ||
728 | node = be32_to_cpu(resp->r_hdr.h_node_num); | ||
729 | mlog(0, "node %d tells us that inode %llu is orphaned in slot %d\n", | ||
730 | node, (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
731 | orphaned_slot); | ||
732 | |||
733 | /* The other node may not actually know which slot the inode | ||
734 | * is orphaned in. */ | ||
735 | if (orphaned_slot == OCFS2_INVALID_SLOT) | ||
736 | return; | ||
737 | |||
738 | /* Ok, the responding node knows which slot this inode is | ||
739 | * orphaned in. We verify that the information is correct and | ||
740 | * then record this in the inode. ocfs2_delete_inode will use | ||
741 | * this information to determine which lock to take. */ | ||
742 | spin_lock(&OCFS2_I(inode)->ip_lock); | ||
743 | mlog_bug_on_msg(OCFS2_I(inode)->ip_orphaned_slot != orphaned_slot && | ||
744 | OCFS2_I(inode)->ip_orphaned_slot | ||
745 | != OCFS2_INVALID_SLOT, "Inode %llu: Node %d says it's " | ||
746 | "orphaned in slot %d, we think it's in %d\n", | ||
747 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
748 | be32_to_cpu(resp->r_hdr.h_node_num), | ||
749 | orphaned_slot, OCFS2_I(inode)->ip_orphaned_slot); | ||
750 | |||
751 | OCFS2_I(inode)->ip_orphaned_slot = orphaned_slot; | ||
752 | spin_unlock(&OCFS2_I(inode)->ip_lock); | ||
753 | } | ||
754 | |||
755 | int ocfs2_request_delete_vote(struct inode *inode) | ||
756 | { | ||
757 | int orphaned_slot, status; | ||
758 | struct ocfs2_net_response_cb delete_cb; | ||
759 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
760 | struct ocfs2_vote_msg *request; | ||
761 | |||
762 | spin_lock(&OCFS2_I(inode)->ip_lock); | ||
763 | orphaned_slot = OCFS2_I(inode)->ip_orphaned_slot; | ||
764 | spin_unlock(&OCFS2_I(inode)->ip_lock); | ||
765 | |||
766 | delete_cb.rc_cb = ocfs2_delete_response_cb; | ||
767 | delete_cb.rc_priv = inode; | ||
768 | |||
769 | mlog(0, "Inode %llu, we start thinking orphaned slot is %d\n", | ||
770 | (unsigned long long)OCFS2_I(inode)->ip_blkno, orphaned_slot); | ||
771 | |||
772 | status = -ENOMEM; | ||
773 | request = ocfs2_new_vote_request(osb, OCFS2_I(inode)->ip_blkno, | ||
774 | inode->i_generation, | ||
775 | OCFS2_VOTE_REQ_DELETE, orphaned_slot); | ||
776 | if (request) { | ||
777 | status = ocfs2_request_vote(inode, request, &delete_cb); | ||
778 | |||
779 | kfree(request); | ||
780 | } | ||
781 | |||
782 | return status; | ||
783 | } | ||
784 | |||
785 | int ocfs2_request_mount_vote(struct ocfs2_super *osb) | 515 | int ocfs2_request_mount_vote(struct ocfs2_super *osb) |
786 | { | 516 | { |
787 | int status; | 517 | int status; |
788 | struct ocfs2_vote_msg *request = NULL; | 518 | struct ocfs2_vote_msg *request = NULL; |
789 | 519 | ||
790 | request = ocfs2_new_vote_request(osb, 0ULL, 0, | 520 | request = ocfs2_new_vote_request(osb, 0ULL, 0, OCFS2_VOTE_REQ_MOUNT); |
791 | OCFS2_VOTE_REQ_MOUNT, 0); | ||
792 | if (!request) { | 521 | if (!request) { |
793 | status = -ENOMEM; | 522 | status = -ENOMEM; |
794 | goto bail; | 523 | goto bail; |
@@ -821,8 +550,7 @@ int ocfs2_request_umount_vote(struct ocfs2_super *osb) | |||
821 | int status; | 550 | int status; |
822 | struct ocfs2_vote_msg *request = NULL; | 551 | struct ocfs2_vote_msg *request = NULL; |
823 | 552 | ||
824 | request = ocfs2_new_vote_request(osb, 0ULL, 0, | 553 | request = ocfs2_new_vote_request(osb, 0ULL, 0, OCFS2_VOTE_REQ_UMOUNT); |
825 | OCFS2_VOTE_REQ_UMOUNT, 0); | ||
826 | if (!request) { | 554 | if (!request) { |
827 | status = -ENOMEM; | 555 | status = -ENOMEM; |
828 | goto bail; | 556 | goto bail; |
@@ -969,7 +697,6 @@ static int ocfs2_handle_vote_message(struct o2net_msg *msg, | |||
969 | be32_to_cpu(work->w_msg.v_hdr.h_generation)); | 697 | be32_to_cpu(work->w_msg.v_hdr.h_generation)); |
970 | mlog(0, "h_node_num = %u\n", | 698 | mlog(0, "h_node_num = %u\n", |
971 | be32_to_cpu(work->w_msg.v_hdr.h_node_num)); | 699 | be32_to_cpu(work->w_msg.v_hdr.h_node_num)); |
972 | mlog(0, "v_generic1 = %u\n", be32_to_cpu(work->w_msg.md1.v_generic1)); | ||
973 | 700 | ||
974 | spin_lock(&osb->vote_task_lock); | 701 | spin_lock(&osb->vote_task_lock); |
975 | list_add_tail(&work->w_list, &osb->vote_list); | 702 | list_add_tail(&work->w_list, &osb->vote_list); |
diff --git a/fs/ocfs2/vote.h b/fs/ocfs2/vote.h index 53ebc1c69e56..9ea46f62de31 100644 --- a/fs/ocfs2/vote.h +++ b/fs/ocfs2/vote.h | |||
@@ -38,14 +38,11 @@ static inline void ocfs2_kick_vote_thread(struct ocfs2_super *osb) | |||
38 | wake_up(&osb->vote_event); | 38 | wake_up(&osb->vote_event); |
39 | } | 39 | } |
40 | 40 | ||
41 | int ocfs2_request_delete_vote(struct inode *inode); | ||
42 | int ocfs2_request_mount_vote(struct ocfs2_super *osb); | 41 | int ocfs2_request_mount_vote(struct ocfs2_super *osb); |
43 | int ocfs2_request_umount_vote(struct ocfs2_super *osb); | 42 | int ocfs2_request_umount_vote(struct ocfs2_super *osb); |
44 | int ocfs2_register_net_handlers(struct ocfs2_super *osb); | 43 | int ocfs2_register_net_handlers(struct ocfs2_super *osb); |
45 | void ocfs2_unregister_net_handlers(struct ocfs2_super *osb); | 44 | void ocfs2_unregister_net_handlers(struct ocfs2_super *osb); |
46 | 45 | ||
47 | void ocfs2_mark_inode_remotely_deleted(struct inode *inode); | ||
48 | |||
49 | void ocfs2_remove_node_from_vote_queues(struct ocfs2_super *osb, | 46 | void ocfs2_remove_node_from_vote_queues(struct ocfs2_super *osb, |
50 | int node_num); | 47 | int node_num); |
51 | #endif | 48 | #endif |