From 78699e29fd784a4613d254a22627f336c55c4a76 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 11 Feb 2016 23:07:19 -0500 Subject: orangefs: delay freeing slot until cancel completes Make cancels reuse the aborted read/write op, to make sure they do not fail on lack of memory. Don't issue a cancel unless the daemon has seen our read/write, has not replied and isn't being shut down. If cancel *is* issued, don't wait for it to complete; stash the slot in there and just have it freed when cancel is finally replied to or purged (and delay dropping the reference until then, obviously). Signed-off-by: Al Viro Signed-off-by: Mike Marshall --- fs/orangefs/file.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'fs/orangefs/file.c') diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 193671c137c3..3b1e9e83eb91 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -181,17 +181,6 @@ populate_shared_memory: } if (ret < 0) { - /* - * XXX: needs to be optimized - we only need to cancel if it - * had been seen by daemon and not completed - */ - if (!op_state_serviced(new_op)) { - orangefs_cancel_op_in_progress(new_op->tag); - } else { - complete(&new_op->done); - } - orangefs_bufmap_put(buffer_index); - buffer_index = -1; /* * don't write an error to syslog on signaled operation * termination unless we've got debugging turned on, as @@ -207,7 +196,10 @@ populate_shared_memory: type == ORANGEFS_IO_READ ? "read from" : "write to", handle, ret); - goto out; + if (orangefs_cancel_op_in_progress(new_op)) + return ret; + + goto done_copying; } /* -- cgit v1.2.3