summaryrefslogtreecommitdiff
path: root/fs/orangefs/orangefs-cache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-02-11 23:07:19 -0500
committerMike Marshall <hubcap@omnibond.com>2016-02-19 13:45:53 -0500
commit78699e29fd784a4613d254a22627f336c55c4a76 (patch)
treec3a8d93a89dd7abed775cdd27a9349cbbd0e539c /fs/orangefs/orangefs-cache.c
parent1357d06d49d1f87af48ab768d34af55bff18b0c3 (diff)
downloadlwn-78699e29fd784a4613d254a22627f336c55c4a76.tar.gz
lwn-78699e29fd784a4613d254a22627f336c55c4a76.zip
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 <viro@zeniv.linux.org.uk> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/orangefs-cache.c')
-rw-r--r--fs/orangefs/orangefs-cache.c16
1 files changed, 10 insertions, 6 deletions
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,