diff options
author | vinayak hegde <vinayak@gluster.com> | 2009-11-11 22:52:01 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-11-13 02:13:17 -0800 |
commit | 63ece0f8bc81c2ec145465ff132a18ca47e50be5 (patch) | |
tree | a8ea5d3f2aab6be919b0f4da4f47d92e99ceecab /xlators/cluster/stripe/src | |
parent | 15a6e0be9bc1c56bd2a0a67c926b01f2f8631ae4 (diff) |
cluster/stripe: Initialize frame->local before checking for directory or regular files.
Signed-off-by: Vinayak Hegde <vinayak@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 368 (setattr on a non-regular file makes glusterfs crash)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=368
Diffstat (limited to 'xlators/cluster/stripe/src')
-rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index c2d500e92..0b0206019 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -893,6 +893,17 @@ stripe_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) goto err; } + /* Initialization */ + local = CALLOC (1, sizeof (stripe_local_t)); + if (!local) { + op_errno = ENOMEM; + goto err; + } + local->op_ret = -1; + frame->local = local; + local->inode = loc->inode; + local->call_count = 1; + if (S_ISDIR (loc->inode->st_mode) || S_ISREG (loc->inode->st_mode)) send_fop_to_all = 1; @@ -900,15 +911,6 @@ stripe_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) STACK_WIND (frame, stripe_truncate_cbk, trav->xlator, trav->xlator->fops->truncate, loc, offset); } else { - /* Initialization */ - local = CALLOC (1, sizeof (stripe_local_t)); - if (!local) { - op_errno = ENOMEM; - goto err; - } - local->op_ret = -1; - frame->local = local; - local->inode = loc->inode; local->call_count = priv->child_count; while (trav) { @@ -1032,6 +1034,17 @@ stripe_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, goto err; } + /* Initialization */ + local = CALLOC (1, sizeof (stripe_local_t)); + if (!local) { + op_errno = ENOMEM; + goto err; + } + local->op_ret = -1; + frame->local = local; + local->inode = loc->inode; + local->call_count = 1; + if (S_ISDIR (loc->inode->st_mode) || S_ISREG (loc->inode->st_mode)) send_fop_to_all = 1; @@ -1039,15 +1052,6 @@ stripe_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, STACK_WIND (frame, stripe_setattr_cbk, trav->xlator, trav->xlator->fops->setattr, loc, stbuf, valid); } else { - /* Initialization */ - local = CALLOC (1, sizeof (stripe_local_t)); - if (!local) { - op_errno = ENOMEM; - goto err; - } - local->op_ret = -1; - frame->local = local; - local->inode = loc->inode; local->call_count = priv->child_count; while (trav) { |