summaryrefslogtreecommitdiffstats
path: root/xlators/mount
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2010-08-20 07:23:15 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-21 05:17:14 -0700
commit883913af305e2de2d51ebac083b359bafebb782c (patch)
tree9859f26a7579eec1908f39e33a1ee263a5d457cc /xlators/mount
parenta81debc473fe5eddeba318c91715252238069b1e (diff)
check whether xlator is NULL in FUSE_FOP macro
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1407 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1407
Diffstat (limited to 'xlators/mount')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c2
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.h17
2 files changed, 14 insertions, 5 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 798b87b0525..5c43bf90206 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -94,7 +94,7 @@ send_fuse_data (xlator_t *this, fuse_in_header_t *finh, void *data, size_t size)
#define send_fuse_obj(this, finh, obj) \
send_fuse_data (this, finh, obj, sizeof (*(obj)))
-static int
+int
send_fuse_err (xlator_t *this, fuse_in_header_t *finh, int error)
{
struct fuse_out_header fouh = {0, };
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h
index afefd815a14..547cc895268 100644
--- a/xlators/mount/fuse/src/fuse-bridge.h
+++ b/xlators/mount/fuse/src/fuse-bridge.h
@@ -135,12 +135,21 @@ typedef struct fuse_private fuse_private_t;
free_fuse_state (state); \
return; \
} \
- xl = fuse_state_subvol (state); \
\
frame->root->state = state; \
frame->root->op = op_num; \
- frame->op = op_num; \
- STACK_WIND (frame, ret, xl, xl->fops->fop, args); \
+ frame->op = op_num; \
+ \
+ xl = fuse_state_subvol (state); \
+ if (!xl) { \
+ gf_log ("glusterfs-fuse", GF_LOG_ERROR, \
+ "xl is NULL"); \
+ send_fuse_err (state->this, state->finh, ENOENT); \
+ free_fuse_state (state); \
+ STACK_DESTROY (frame->root); \
+ } else { \
+ STACK_WIND (frame, ret, xl, xl->fops->fop, args); \
+ } \
} while (0)
@@ -275,5 +284,5 @@ xlator_t *fuse_active_subvol (xlator_t *fuse);
inode_t *fuse_ino_to_inode (uint64_t ino, xlator_t *fuse);
int fuse_resolve_and_resume (fuse_state_t *state, fuse_resume_fn_t fn);
int is_gf_log_command (xlator_t *this, const char *name, char *value);
-
+int send_fuse_err (xlator_t *this, fuse_in_header_t *finh, int error);
#endif /* _GF_FUSE_BRIDGE_H_ */