Commit 641bb324 authored by Martin Brandenburg's avatar Martin Brandenburg

orangefs: don't put readdir slot twice

This was quite an oversight. After a readdir, the module could not be
unloaded, the number of slots is wrong, and memory near the slot bitmap
is possibly corrupt. Oops.
Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
parent f55532a0
...@@ -235,7 +235,7 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) ...@@ -235,7 +235,7 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx)
if (ret == -EIO && op_state_purged(new_op)) { if (ret == -EIO && op_state_purged(new_op)) {
gossip_err("%s: Client is down. Aborting readdir call.\n", gossip_err("%s: Client is down. Aborting readdir call.\n",
__func__); __func__);
goto out_slot; goto out_free_op;
} }
if (ret < 0 || new_op->downcall.status != 0) { if (ret < 0 || new_op->downcall.status != 0) {
...@@ -244,14 +244,14 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) ...@@ -244,14 +244,14 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx)
new_op->downcall.status); new_op->downcall.status);
if (ret >= 0) if (ret >= 0)
ret = new_op->downcall.status; ret = new_op->downcall.status;
goto out_slot; goto out_free_op;
} }
dents_buf = new_op->downcall.trailer_buf; dents_buf = new_op->downcall.trailer_buf;
if (dents_buf == NULL) { if (dents_buf == NULL) {
gossip_err("Invalid NULL buffer in readdir response\n"); gossip_err("Invalid NULL buffer in readdir response\n");
ret = -ENOMEM; ret = -ENOMEM;
goto out_slot; goto out_free_op;
} }
bytes_decoded = decode_dirents(dents_buf, new_op->downcall.trailer_size, bytes_decoded = decode_dirents(dents_buf, new_op->downcall.trailer_size,
...@@ -363,8 +363,6 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) ...@@ -363,8 +363,6 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx)
out_vfree: out_vfree:
gossip_debug(GOSSIP_DIR_DEBUG, "vfree %p\n", dents_buf); gossip_debug(GOSSIP_DIR_DEBUG, "vfree %p\n", dents_buf);
vfree(dents_buf); vfree(dents_buf);
out_slot:
orangefs_readdir_index_put(buffer_index);
out_free_op: out_free_op:
op_release(new_op); op_release(new_op);
gossip_debug(GOSSIP_DIR_DEBUG, "orangefs_readdir returning %d\n", ret); gossip_debug(GOSSIP_DIR_DEBUG, "orangefs_readdir returning %d\n", ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment