aboutsummaryrefslogtreecommitdiffstats
path: root/fs/orangefs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-02-11 21:28:52 -0500
committerMike Marshall <hubcap@omnibond.com>2016-02-12 15:05:32 -0500
commitc0eae8cd77bc34b7e4c52037eeb53712f46fa05c (patch)
treed7c6788cadf658293774c197ff852dc9312d0136 /fs/orangefs
parent7b9761af86b63baf4ce304fbdfdb87227d4bfbed (diff)
orangefs: get rid of handle_io_error()
the second caller never needs to cancel, actually Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r--fs/orangefs/file.c65
1 files changed, 14 insertions, 51 deletions
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index c767ec746c76..dafa03ef0107 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -83,46 +83,6 @@ static int postcopy_buffers(struct orangefs_bufmap *bufmap,
83} 83}
84 84
85/* 85/*
86 * handles two possible error cases, depending on context.
87 *
88 * by design, our vfs i/o errors need to be handled in one of two ways,
89 * depending on where the error occured.
90 *
91 * if the error happens in the waitqueue code because we either timed
92 * out or a signal was raised while waiting, we need to cancel the
93 * userspace i/o operation and free the op manually. this is done to
94 * avoid having the device start writing application data to our shared
95 * bufmap pages without us expecting it.
96 *
97 * FIXME: POSSIBLE OPTIMIZATION:
98 * However, if we timed out or if we got a signal AND our upcall was never
99 * picked off the queue (i.e. we were in OP_VFS_STATE_WAITING), then we don't
100 * need to send a cancellation upcall. The way we can handle this is
101 * set error_exit to 2 in such cases and 1 whenever cancellation has to be
102 * sent and have handle_error
103 * take care of this situation as well..
104 *
105 * if a orangefs sysint level error occured and i/o has been completed,
106 * there is no need to cancel the operation, as the user has finished
107 * using the bufmap page and so there is no danger in this case. in
108 * this case, we wake up the device normally so that it may free the
109 * op, as normal.
110 *
111 * note the only reason this is a macro is because both read and write
112 * cases need the exact same handling code.
113 */
114#define handle_io_error() \
115do { \
116 if (!op_state_serviced(new_op)) { \
117 orangefs_cancel_op_in_progress(new_op->tag); \
118 } else { \
119 complete(&new_op->done); \
120 } \
121 orangefs_bufmap_put(bufmap, buffer_index); \
122 buffer_index = -1; \
123} while (0)
124
125/*
126 * Post and wait for the I/O upcall to finish 86 * Post and wait for the I/O upcall to finish
127 */ 87 */
128static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode, 88static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode,
@@ -221,7 +181,17 @@ populate_shared_memory:
221 } 181 }
222 182
223 if (ret < 0) { 183 if (ret < 0) {
224 handle_io_error(); 184 /*
185 * XXX: needs to be optimized - we only need to cancel if it
186 * had been seen by daemon and not completed
187 */
188 if (!op_state_serviced(new_op)) {
189 orangefs_cancel_op_in_progress(new_op->tag);
190 } else {
191 complete(&new_op->done);
192 }
193 orangefs_bufmap_put(bufmap, buffer_index);
194 buffer_index = -1;
225 /* 195 /*
226 * don't write an error to syslog on signaled operation 196 * don't write an error to syslog on signaled operation
227 * termination unless we've got debugging turned on, as 197 * termination unless we've got debugging turned on, as
@@ -249,16 +219,8 @@ populate_shared_memory:
249 buffer_index, 219 buffer_index,
250 iter, 220 iter,
251 new_op->downcall.resp.io.amt_complete); 221 new_op->downcall.resp.io.amt_complete);
252 if (ret < 0) { 222 if (ret < 0)
253 /* 223 goto done_copying;
254 * put error codes in downcall so that handle_io_error()
255 * preserves it properly
256 */
257 WARN_ON(!op_state_serviced(new_op));
258 new_op->downcall.status = ret;
259 handle_io_error();
260 goto out;
261 }
262 } 224 }
263 gossip_debug(GOSSIP_FILE_DEBUG, 225 gossip_debug(GOSSIP_FILE_DEBUG,
264 "%s(%pU): Amount written as returned by the sys-io call:%d\n", 226 "%s(%pU): Amount written as returned by the sys-io call:%d\n",
@@ -268,6 +230,7 @@ populate_shared_memory:
268 230
269 ret = new_op->downcall.resp.io.amt_complete; 231 ret = new_op->downcall.resp.io.amt_complete;
270 232
233done_copying:
271 /* 234 /*
272 * tell the device file owner waiting on I/O that this read has 235 * tell the device file owner waiting on I/O that this read has
273 * completed and it can return now. 236 * completed and it can return now.