xijinyu has uploaded this change for review.

View Change

Fix Segmentation fault.

When exporting a directory that does not exist in GlusterFS volume,
occur seg-fault and the Ganesha process crashes.

We are hitting this seg-fault on V4-dev.2 and V4-dev.9:
Breakpoint 1, mdcache_exp_release (exp_hdl=0x7fd75c009770) at
/usr/src/debug/nfs-ganesha-4-dev.2/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_export.c:184
184 struct mdcache_fsal_export *exp = mdc_export(exp_hdl);
Missing separate debuginfos, use: debuginfo-install openssl-libs-1.0.2k-8.el7.x86_64
(gdb) n
185 struct fsal_export *sub_export = exp->mfe_exp.sub_export;
(gdb)
188 fsal_hdl = sub_export->fsal;
(gdb)
190 LogInfo(COMPONENT_FSAL, "Releasing %s export %" PRIu16 " for %s",
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x00007fd8124777ad in mdcache_exp_release (exp_hdl=0x7fd75c009770) at
/usr/src/debug/nfs-ganesha-4-dev.2/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_export.c:190
190 LogInfo(COMPONENT_FSAL, "Releasing %s export %" PRIu16 " for %s",
(gdb) l
185 struct fsal_export *sub_export = exp->mfe_exp.sub_export;
186 struct fsal_module *fsal_hdl;
187
188 fsal_hdl = sub_export->fsal;
189
190 LogInfo(COMPONENT_FSAL, "Releasing %s export %" PRIu16 " for %s",
191 fsal_hdl->name, op_ctx->ctx_export->export_id,
192 export_path(op_ctx->ctx_export));
193
194 /* Stop the dirmap thread */
(gdb) p fsal_hdl->name
$1 = 0x7fd75c009750 "GLUSTER"
(gdb) p op_ctx->ctx_export->export_id
Cannot access memory at address 0x68
(gdb) p op_ctx->ctx_export
Cannot access memory at address 0x68

Signed-off-by: Xi Jinyu <xijinyu@cmss.chinamobile.com>
Change-Id: I10c6ef3d6d904434e9da595de56aa7d3698d47b2
---
M src/FSAL/Stackable_FSALs/FSAL_MDCACHE/mdcache_export.c
1 file changed, 3 insertions(+), 3 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/15/488515/1

To view, visit change 488515. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I10c6ef3d6d904434e9da595de56aa7d3698d47b2
Gerrit-Change-Number: 488515
Gerrit-PatchSet: 1
Gerrit-Owner: xijinyu <xijinyu@cmss.chinamobile.com>
Gerrit-MessageType: newchange