|
|
14f8ab |
From 58070aa568ffbaac267b02428e974b2459ae13b0 Mon Sep 17 00:00:00 2001
|
|
|
14f8ab |
From: Susant Palai <spalai@redhat.com>
|
|
|
14f8ab |
Date: Tue, 18 Jun 2019 16:43:43 +0530
|
|
|
14f8ab |
Subject: [PATCH 197/221] :posix: fix crash in posix_cs_set_state
|
|
|
14f8ab |
|
|
|
14f8ab |
> Fixes: bz#1721474
|
|
|
14f8ab |
> Change-Id: Ic2a53fa3d1e9e23424c6898e0986f80d52c5e3f6
|
|
|
14f8ab |
> Signed-off-by: Susant Palai <spalai@redhat.com>
|
|
|
14f8ab |
(cherry-pick of https://review.gluster.org/#/c/glusterfs/+/22892/)
|
|
|
14f8ab |
|
|
|
14f8ab |
BUG: 1721477
|
|
|
14f8ab |
Change-Id: Ic2a53fa3d1e9e23424c6898e0986f80d52c5e3f6
|
|
|
14f8ab |
Signed-off-by: Susant Palai <spalai@redhat.com>
|
|
|
14f8ab |
Reviewed-on: https://code.engineering.redhat.com/gerrit/173936
|
|
|
14f8ab |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
14f8ab |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
14f8ab |
---
|
|
|
14f8ab |
xlators/storage/posix/src/posix-helpers.c | 5 +++++
|
|
|
14f8ab |
xlators/storage/posix/src/posix-inode-fd-ops.c | 7 ++++---
|
|
|
14f8ab |
2 files changed, 9 insertions(+), 3 deletions(-)
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
|
|
|
14f8ab |
index aecf4f8..849db3d 100644
|
|
|
14f8ab |
--- a/xlators/storage/posix/src/posix-helpers.c
|
|
|
14f8ab |
+++ b/xlators/storage/posix/src/posix-helpers.c
|
|
|
14f8ab |
@@ -3235,6 +3235,11 @@ posix_cs_set_state(xlator_t *this, dict_t **rsp, gf_cs_obj_state state,
|
|
|
14f8ab |
char *value = NULL;
|
|
|
14f8ab |
size_t xattrsize = 0;
|
|
|
14f8ab |
|
|
|
14f8ab |
+ if (!rsp) {
|
|
|
14f8ab |
+ ret = -1;
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
if (!(*rsp)) {
|
|
|
14f8ab |
*rsp = dict_new();
|
|
|
14f8ab |
if (!(*rsp)) {
|
|
|
14f8ab |
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
|
|
|
14f8ab |
index 7ca4d26..b92c411 100644
|
|
|
14f8ab |
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
|
|
|
14f8ab |
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
|
|
|
14f8ab |
@@ -1028,6 +1028,7 @@ posix_glfallocate(call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
14f8ab |
struct iatt statpost = {
|
|
|
14f8ab |
0,
|
|
|
14f8ab |
};
|
|
|
14f8ab |
+ dict_t *rsp_xdata = NULL;
|
|
|
14f8ab |
|
|
|
14f8ab |
#ifdef FALLOC_FL_KEEP_SIZE
|
|
|
14f8ab |
if (keep_size)
|
|
|
14f8ab |
@@ -1035,15 +1036,15 @@ posix_glfallocate(call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
14f8ab |
#endif /* FALLOC_FL_KEEP_SIZE */
|
|
|
14f8ab |
|
|
|
14f8ab |
ret = posix_do_fallocate(frame, this, fd, flags, offset, len, &statpre,
|
|
|
14f8ab |
- &statpost, xdata, NULL);
|
|
|
14f8ab |
+ &statpost, xdata, &rsp_xdata);
|
|
|
14f8ab |
if (ret < 0)
|
|
|
14f8ab |
goto err;
|
|
|
14f8ab |
|
|
|
14f8ab |
- STACK_UNWIND_STRICT(fallocate, frame, 0, 0, &statpre, &statpost, NULL);
|
|
|
14f8ab |
+ STACK_UNWIND_STRICT(fallocate, frame, 0, 0, &statpre, &statpost, rsp_xdata);
|
|
|
14f8ab |
return 0;
|
|
|
14f8ab |
|
|
|
14f8ab |
err:
|
|
|
14f8ab |
- STACK_UNWIND_STRICT(fallocate, frame, -1, -ret, NULL, NULL, NULL);
|
|
|
14f8ab |
+ STACK_UNWIND_STRICT(fallocate, frame, -1, -ret, NULL, NULL, rsp_xdata);
|
|
|
14f8ab |
return 0;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
--
|
|
|
14f8ab |
1.8.3.1
|
|
|
14f8ab |
|