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/orangefs-cache.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'fs/orangefs/orangefs-cache.c') diff --git a/fs/orangefs/orangefs-cache.c b/fs/orangefs/orangefs-cache.c index 3b3de91406ca..59ab0c207e90 100644 --- a/fs/orangefs/orangefs-cache.c +++ b/fs/orangefs/orangefs-cache.c @@ -101,6 +101,15 @@ char *get_opname_string(struct orangefs_kernel_op_s *new_op) return "OP_UNKNOWN?"; } +void orangefs_new_tag(struct orangefs_kernel_op_s *op) +{ + spin_lock(&next_tag_value_lock); + op->tag = next_tag_value++; + if (next_tag_value == 0) + next_tag_value = 100; + spin_unlock(&next_tag_value_lock); +} + struct orangefs_kernel_op_s *op_alloc(__s32 type) { struct orangefs_kernel_op_s *new_op = NULL; @@ -120,14 +129,9 @@ struct orangefs_kernel_op_s *op_alloc(__s32 type) new_op->downcall.status = -1; new_op->op_state = OP_VFS_STATE_UNKNOWN; - new_op->tag = 0; /* initialize the op specific tag and upcall credentials */ - spin_lock(&next_tag_value_lock); - new_op->tag = next_tag_value++; - if (next_tag_value == 0) - next_tag_value = 100; - spin_unlock(&next_tag_value_lock); + orangefs_new_tag(new_op); new_op->upcall.type = type; new_op->attempts = 0; gossip_debug(GOSSIP_CACHE_DEBUG, -- cgit v1.2.3