Skip to content

Commit

Permalink
orangefs: don't put readdir slot twice
Browse files Browse the repository at this point in the history
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: Martin Brandenburg <martin@omnibond.com>
  • Loading branch information
Martin Brandenburg committed Mar 31, 2016
1 parent f55532a commit 641bb32
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fs/orangefs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx)
if (ret == -EIO && op_state_purged(new_op)) {
gossip_err("%s: Client is down. Aborting readdir call.\n",
__func__);
goto out_slot;
goto out_free_op;
}

if (ret < 0 || new_op->downcall.status != 0) {
Expand All @@ -244,14 +244,14 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx)
new_op->downcall.status);
if (ret >= 0)
ret = new_op->downcall.status;
goto out_slot;
goto out_free_op;
}

dents_buf = new_op->downcall.trailer_buf;
if (dents_buf == NULL) {
gossip_err("Invalid NULL buffer in readdir response\n");
ret = -ENOMEM;
goto out_slot;
goto out_free_op;
}

bytes_decoded = decode_dirents(dents_buf, new_op->downcall.trailer_size,
Expand Down Expand Up @@ -363,8 +363,6 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx)
out_vfree:
gossip_debug(GOSSIP_DIR_DEBUG, "vfree %p\n", dents_buf);
vfree(dents_buf);
out_slot:
orangefs_readdir_index_put(buffer_index);
out_free_op:
op_release(new_op);
gossip_debug(GOSSIP_DIR_DEBUG, "orangefs_readdir returning %d\n", ret);
Expand Down

0 comments on commit 641bb32

Please sign in to comment.