diff options
author | vmallika <vmallika@redhat.com> | 2015-07-29 16:19:12 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-08-20 02:04:42 -0700 |
commit | dfa2bfb289cc73ade0e441f2e2ee88d0d819d48d (patch) | |
tree | b8a46c90458061057fc05d169ef55d793d33237a | |
parent | 620403b48a021593883f39dec3a1d6bc16c53517 (diff) |
features/quota: prevent statfs frame-loss when an error happens duringv3.6.5
ancestry building.
This is a backport of http://review.gluster.org/#/c/9380/
We do quota_build_ancestry in function 'quota_get_limit_dir',
suppose if quota_build_ancestry fails, then we don't have a
frame saved to continue the statfs FOP and client can hang.
> Change-Id: I92e25c1510d09444b9d4810afdb6b2a69dcd92c0
> BUG: 1178619
> Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
> Signed-off-by: vmallika <vmallika@redhat.com>
> Reviewed-on: http://review.gluster.org/9380
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Change-Id: Ia25cf738250fdc2c766f96c26e3c31093d534aba
BUG: 1247959
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/11790
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
-rw-r--r-- | xlators/features/quota/src/quota.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index dd3e8e2b624..520f12b6a59 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -3819,16 +3819,9 @@ quota_statfs_continue (call_frame_t *frame, xlator_t *this, inode_t *inode) quota_local_t *local = frame->local; int ret = -1; - stub = fop_statfs_stub (frame, quota_statfs_helper, - &local->loc, local->xdata); - if (!stub) - goto err; - LOCK (&local->lock); { local->inode = inode_ref (inode); - local->link_count = 1; - local->stub = stub; } UNLOCK (&local->lock); @@ -3836,12 +3829,6 @@ quota_statfs_continue (call_frame_t *frame, xlator_t *this, inode_t *inode) quota_statfs_validate_cbk); if (0 > ret) quota_handle_validate_error (local, -1, -ret); - return; - -err: - QUOTA_STACK_UNWIND (statfs, frame, -1, ENOMEM, NULL, NULL); - - return; } void @@ -3908,6 +3895,7 @@ quota_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) int8_t ignore_deem_statfs = 0; quota_priv_t *priv = NULL; quota_local_t *local = NULL; + call_stub_t *stub = NULL; priv = this->private; GF_ASSERT (loc); @@ -3927,6 +3915,7 @@ quota_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) op_errno = ENOMEM; goto err; } + frame->local = local; ret = loc_copy (&local->loc, loc); if (-1 == ret) { @@ -3937,9 +3926,19 @@ quota_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) if (xdata) local->xdata = dict_ref (xdata); - local->link_count = 1; + stub = fop_statfs_stub (frame, quota_statfs_helper, + &local->loc, local->xdata); + if (!stub) { + op_errno = ENOMEM; + goto err; + } - frame->local = local; + LOCK (&local->lock); + { + local->link_count = 1; + local->stub = stub; + } + UNLOCK (&local->lock); quota_get_limit_dir (frame, loc->inode, this); |