From 8a21f10ad373dad117557555a7db43d489d05b28 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Wed, 27 Nov 2013 11:48:29 +0530 Subject: features/quota: use STACK_WIND_TAIL when quota is turned off. Change-Id: I8a0b7f3a1995a72560c210efbad1eaafb0bdf329 BUG: 969461 Signed-off-by: Raghavendra G Reviewed-on: http://review.gluster.org/6373 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/features/quota/src/quota.c | 375 ++++++++++++++++++++----------------- 1 file changed, 207 insertions(+), 168 deletions(-) diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 89f9958d8db..2c7e2984938 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -978,7 +978,7 @@ quota_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, if (!xattr_req) goto err; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -995,14 +995,8 @@ quota_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, goto err; } -wind: - /* TODO: check with vshastry@redhat.com to cleanup the ugliness of - * checking priv->is_quota_on here by using STACK_WIND_TAIL macro - */ - STACK_WIND (frame, - priv->is_quota_on ? quota_lookup_cbk : default_lookup_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->lookup, loc, - xattr_req); + STACK_WIND (frame, quota_lookup_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->lookup, loc, xattr_req); ret = 0; @@ -1016,6 +1010,11 @@ err: } return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->lookup, loc, xattr_req); + return 0; } @@ -1202,8 +1201,7 @@ quota_writev_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, } } - STACK_WIND (frame, - priv->is_quota_on? quota_writev_cbk: default_writev_cbk, + STACK_WIND (frame, quota_writev_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->writev, fd, vector, count, off, flags, iobref, xdata); @@ -1235,7 +1233,7 @@ quota_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); INIT_LIST_HEAD (&head); @@ -1306,10 +1304,10 @@ unwind: QUOTA_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL, NULL); return 0; -wind: - STACK_WIND (frame, default_writev_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->writev, fd, - vector, count, off, flags, iobref, xdata); +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->writev, fd, + vector, count, off, flags, iobref, xdata); return 0; } @@ -1345,8 +1343,7 @@ quota_mkdir_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, goto unwind; } - STACK_WIND (frame, - quota_mkdir_cbk, + STACK_WIND (frame, quota_mkdir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->mkdir, loc, mode, umask, xdata); @@ -1370,7 +1367,7 @@ quota_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -1407,11 +1404,10 @@ err: return 0; -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_mkdir_cbk: default_mkdir_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->mkdir, loc, - mode, umask, xdata); +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->mkdir, + loc, mode, umask, xdata); return 0; } @@ -1493,8 +1489,7 @@ quota_create_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, } - STACK_WIND (frame, - priv->is_quota_on? quota_create_cbk: default_create_cbk, + STACK_WIND (frame, quota_create_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->create, loc, flags, mode, umask, fd, xdata); return 0; @@ -1518,7 +1513,7 @@ quota_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -1553,11 +1548,10 @@ err: return 0; -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_create_cbk: default_create_cbk, - FIRST_CHILD (this), FIRST_CHILD (this)->fops->create, loc, - flags, mode, umask, fd, xdata); +off: + STACK_WIND_TAIL (frame, FIRST_CHILD (this), + FIRST_CHILD (this)->fops->create, loc, + flags, mode, umask, fd, xdata); return 0; } @@ -1627,7 +1621,7 @@ quota_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -1646,11 +1640,8 @@ quota_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, goto err; } -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_unlink_cbk: default_unlink_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, loc, - xflag, xdata); + STACK_WIND (frame, quota_unlink_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->unlink, loc, xflag, xdata); ret = 0; @@ -1660,6 +1651,11 @@ err: } return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->unlink, loc, xflag, xdata); + return 0; } @@ -1763,7 +1759,7 @@ quota_link_helper (call_frame_t *frame, xlator_t *this, loc_t *oldloc, goto unwind; } - STACK_WIND (frame, priv->is_quota_on? quota_link_cbk: default_link_cbk, + STACK_WIND (frame, quota_link_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->link, oldloc, newloc, xdata); return 0; @@ -1787,7 +1783,11 @@ quota_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); + + if (xdata && dict_get (xdata, GLUSTERFS_INTERNAL_FOP_KEY)) { + goto off; + } quota_inode_ctx_get (oldloc->inode, this, &ctx, 0); if (ctx == NULL) { @@ -1805,10 +1805,6 @@ quota_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, frame->local = (void *) local; - if (xdata && dict_get (xdata, GLUSTERFS_INTERNAL_FOP_KEY)) { - local->skip_check = _gf_true; - goto wind; - } ret = loc_copy (&local->loc, newloc); if (ret == -1) { @@ -1831,13 +1827,12 @@ quota_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, err: QUOTA_STACK_UNWIND (link, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL); - return 0; -wind: - STACK_WIND (frame, default_link_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->link, oldloc, - newloc, xdata); +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->link, oldloc, + newloc, xdata); return 0; } @@ -1980,8 +1975,7 @@ quota_rename_helper (call_frame_t *frame, xlator_t *this, loc_t *oldloc, goto unwind; } - STACK_WIND (frame, - priv->is_quota_on? quota_rename_cbk: default_rename_cbk, + STACK_WIND (frame, quota_rename_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, oldloc, newloc, xdata); @@ -2046,7 +2040,7 @@ quota_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -2122,10 +2116,10 @@ err: NULL, NULL, NULL, NULL, NULL); return 0; -wind: - STACK_WIND (frame, default_rename_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, oldloc, - newloc, xdata); +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->rename, oldloc, + newloc, xdata); return 0; } @@ -2208,8 +2202,7 @@ quota_symlink_helper (call_frame_t *frame, xlator_t *this, const char *linkpath, goto unwind; } - STACK_WIND (frame, - priv->is_quota_on? quota_symlink_cbk: default_symlink_cbk, + STACK_WIND (frame, quota_symlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, linkpath, loc, umask, xdata); return 0; @@ -2233,7 +2226,7 @@ quota_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -2267,11 +2260,10 @@ err: return 0; -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_symlink_cbk: default_symlink_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, - linkpath, loc, umask, xdata); +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->symlink, + linkpath, loc, umask, xdata); return 0; } @@ -2332,8 +2324,7 @@ quota_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); - + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -2348,17 +2339,19 @@ quota_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, goto err; } -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_truncate_cbk: default_truncate_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, loc, - offset, xdata); + STACK_WIND (frame, quota_truncate_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->truncate, loc, offset, xdata); return 0; + err: QUOTA_STACK_UNWIND (truncate, frame, -1, ENOMEM, NULL, NULL, NULL); return 0; +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->truncate, loc, offset, xdata); + return 0; } @@ -2417,7 +2410,7 @@ quota_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) @@ -2427,9 +2420,7 @@ quota_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, local->loc.inode = inode_ref (fd->inode); -wind: - STACK_WIND (frame, priv->is_quota_on? - quota_ftruncate_cbk: default_ftruncate_cbk, + STACK_WIND (frame, quota_ftruncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate, fd, offset, xdata); @@ -2438,6 +2429,12 @@ err: QUOTA_STACK_UNWIND (ftruncate, frame, -1, ENOMEM, NULL, NULL, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->ftruncate, fd, + offset, xdata); + return 0; } @@ -2581,8 +2578,7 @@ quota_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); - + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -2596,15 +2592,20 @@ quota_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) goto unwind; } -wind: - STACK_WIND (frame, priv->is_quota_on? quota_stat_cbk: default_stat_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->stat, loc, + STACK_WIND (frame, quota_stat_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->stat, loc, xdata); return 0; unwind: QUOTA_STACK_UNWIND (stat, frame, -1, ENOMEM, NULL, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->stat, loc, + xdata); + return 0; } @@ -2661,7 +2662,7 @@ quota_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -2672,9 +2673,7 @@ quota_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) local->loc.inode = inode_ref (fd->inode); -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_fstat_cbk: default_fstat_cbk, + STACK_WIND (frame, quota_fstat_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fstat, fd, xdata); return 0; @@ -2682,6 +2681,12 @@ wind: unwind: QUOTA_STACK_UNWIND (fstat, frame, -1, ENOMEM, NULL, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->fstat, fd, + xdata); + return 0; } @@ -2736,7 +2741,7 @@ quota_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -2751,9 +2756,7 @@ quota_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size, goto unwind; } -wind: - STACK_WIND (frame, priv->is_quota_on? - quota_readlink_cbk: default_readlink_cbk, + STACK_WIND (frame, quota_readlink_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readlink, loc, size, xdata); return 0; @@ -2761,6 +2764,12 @@ wind: unwind: QUOTA_STACK_UNWIND (readlink, frame, -1, ENOMEM, NULL, NULL, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->readlink, loc, + size, xdata); + return 0; } @@ -2815,7 +2824,7 @@ quota_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -2826,9 +2835,7 @@ quota_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, local->loc.inode = inode_ref (fd->inode); -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_readv_cbk: default_readv_cbk, + STACK_WIND (frame, quota_readv_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readv, fd, size, offset, flags, xdata); return 0; @@ -2837,6 +2844,12 @@ unwind: QUOTA_STACK_UNWIND (readv, frame, -1, ENOMEM, NULL, -1, NULL, NULL, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->readv, fd, + size, offset, flags, xdata); + return 0; } @@ -2890,7 +2903,7 @@ quota_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -2901,10 +2914,8 @@ quota_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, frame->local = local; -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_fsync_cbk: default_fsync_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync, fd, + STACK_WIND (frame, quota_fsync_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->fsync, fd, flags, xdata); return 0; @@ -2912,6 +2923,11 @@ unwind: QUOTA_STACK_UNWIND (fsync, frame, -1, ENOMEM, NULL, NULL, NULL); return 0; +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->fsync, fd, + flags, xdata); + return 0; } @@ -2970,7 +2986,7 @@ quota_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -2985,16 +3001,20 @@ quota_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, goto unwind; } -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_setattr_cbk: default_setattr_cbk, - FIRST_CHILD (this), FIRST_CHILD (this)->fops->setattr, loc, + STACK_WIND (frame, quota_setattr_cbk, FIRST_CHILD (this), + FIRST_CHILD (this)->fops->setattr, loc, stbuf, valid, xdata); return 0; unwind: QUOTA_STACK_UNWIND (setattr, frame, -1, ENOMEM, NULL, NULL, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD (this), + FIRST_CHILD (this)->fops->setattr, loc, + stbuf, valid, xdata); + return 0; } @@ -3051,8 +3071,7 @@ quota_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); - + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -3063,9 +3082,7 @@ quota_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, local->loc.inode = inode_ref (fd->inode); -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_fsetattr_cbk: default_fsetattr_cbk, + STACK_WIND (frame, quota_fsetattr_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->fsetattr, fd, stbuf, valid, xdata); return 0; @@ -3073,6 +3090,12 @@ wind: unwind: QUOTA_STACK_UNWIND (fsetattr, frame, -1, ENOMEM, NULL, NULL, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD (this), + FIRST_CHILD (this)->fops->fsetattr, fd, + stbuf, valid, xdata); + return 0; } @@ -3148,8 +3171,7 @@ quota_mknod_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, goto unwind; } - STACK_WIND (frame, - priv->is_quota_on? quota_mknod_cbk: default_mknod_cbk, + STACK_WIND (frame, quota_mknod_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->mknod, loc, mode, rdev, umask, xdata); @@ -3173,7 +3195,7 @@ quota_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); if (local == NULL) { @@ -3200,20 +3222,17 @@ quota_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, quota_check_limit (frame, loc->parent, this, NULL, NULL); return 0; + err: QUOTA_STACK_UNWIND (mknod, frame, -1, ENOMEM, NULL, NULL, NULL, NULL, NULL); - return 0; -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_mknod_cbk: default_mknod_cbk, - FIRST_CHILD(this), FIRST_CHILD(this)->fops->mknod, loc, - mode, rdev, umask, xdata); - +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->mknod, loc, + mode, rdev, umask, xdata); return 0; - } int @@ -3258,7 +3277,7 @@ quota_setxattr (call_frame_t *frame, xlator_t *this, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -3287,15 +3306,19 @@ quota_setxattr (call_frame_t *frame, xlator_t *this, local->limit.soft_lim_percent = soft_lim; } -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_setxattr_cbk: default_setxattr_cbk, + STACK_WIND (frame, quota_setxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->setxattr, loc, dict, flags, xdata); return 0; err: QUOTA_STACK_UNWIND (setxattr, frame, op_ret, op_errno, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->setxattr, loc, + dict, flags, xdata); + return 0; } int @@ -3339,7 +3362,7 @@ quota_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -3363,15 +3386,19 @@ quota_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, local->limit.soft_lim_percent = soft_lim; } -wind: - STACK_WIND (frame, priv->is_quota_on? - quota_fsetxattr_cbk: default_fsetxattr_cbk, + STACK_WIND (frame, quota_fsetxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetxattr, fd, dict, flags, xdata); return 0; - err: +err: QUOTA_STACK_UNWIND (fsetxattr, frame, op_ret, op_errno, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->fsetxattr, fd, + dict, flags, xdata); + return 0; } @@ -3392,7 +3419,7 @@ quota_removexattr (call_frame_t *frame, xlator_t *this, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); VALIDATE_OR_GOTO (this, err); @@ -3409,15 +3436,20 @@ quota_removexattr (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (loc, err); -wind: - STACK_WIND (frame, priv->is_quota_on? - quota_removexattr_cbk: default_removexattr_cbk, + STACK_WIND (frame, quota_removexattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->removexattr, loc, name, xdata); return 0; + err: QUOTA_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->removexattr, + loc, name, xdata); + return 0; } @@ -3439,7 +3471,7 @@ quota_fremovexattr (call_frame_t *frame, xlator_t *this, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -3451,15 +3483,19 @@ quota_fremovexattr (call_frame_t *frame, xlator_t *this, GF_IF_NATIVE_XATTR_GOTO ("trusted.pgfid*", name, op_errno, err); } -wind: - STACK_WIND (frame, priv->is_quota_on? - quota_fremovexattr_cbk: default_fremovexattr_cbk, + STACK_WIND (frame, quota_fremovexattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fremovexattr, fd, name, xdata); return 0; - err: +err: QUOTA_STACK_UNWIND (fremovexattr, frame, op_ret, op_errno, NULL); return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->fremovexattr, + fd, name, xdata); + return 0; } @@ -3645,7 +3681,7 @@ quota_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); if (priv->consider_statfs && loc->inode) { local = quota_local_new (); @@ -3674,25 +3710,27 @@ quota_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) } quota_resume_fop_if_validation_done (local); + + return 0; } - else { - /* - * We have to make sure that we never get to quota_statfs_cbk - * with a cookie that points to something other than an inode, - * which is exactly what would happen with STACK_UNWIND using - * that as a callback. Therefore, use default_statfs_cbk in - * this case instead. - * - * Also if the option deem-statfs is not set to "on" don't - * bother calculating quota limit on / in statfs_cbk. - */ - if (priv->consider_statfs) - gf_log(this->name,GF_LOG_WARNING, - "missing inode, cannot adjust for quota"); -wind: - STACK_WIND (frame, default_statfs_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->statfs, loc, xdata); - } + + /* + * We have to make sure that we never get to quota_statfs_cbk + * with a cookie that points to something other than an inode, + * which is exactly what would happen with STACK_UNWIND using + * that as a callback. Therefore, use default_statfs_cbk in + * this case instead. + * + * Also if the option deem-statfs is not set to "on" don't + * bother calculating quota limit on / in statfs_cbk. + */ + if (priv->consider_statfs) + gf_log (this->name,GF_LOG_WARNING, + "missing inode, cannot adjust for quota"); + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->statfs, loc, xdata); return 0; err: @@ -3751,7 +3789,7 @@ quota_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); local = quota_local_new (); @@ -3777,9 +3815,7 @@ quota_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, } } -wind: - STACK_WIND (frame, - priv->is_quota_on? quota_readdirp_cbk: default_readdirp_cbk, + STACK_WIND (frame, quota_readdirp_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdirp, fd, size, offset, dict); @@ -3796,6 +3832,12 @@ err: } return 0; + +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->readdirp, fd, + size, offset, dict); + return 0; } int32_t @@ -3873,8 +3915,7 @@ quota_fallocate_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, goto unwind; } - STACK_WIND (frame, priv->is_quota_on? - quota_fallocate_cbk: default_fallocate_cbk, + STACK_WIND (frame, quota_fallocate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fallocate, fd, mode, offset, len, xdata); @@ -3901,7 +3942,7 @@ quota_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, priv = this->private; GF_VALIDATE_OR_GOTO (this->name, priv, unwind); - WIND_IF_QUOTAOFF (priv->is_quota_on, wind); + WIND_IF_QUOTAOFF (priv->is_quota_on, off); GF_ASSERT (frame); GF_VALIDATE_OR_GOTO ("quota", this, unwind); @@ -3969,12 +4010,10 @@ unwind: QUOTA_STACK_UNWIND (fallocate, frame, -1, op_errno, NULL, NULL, NULL); return 0; -wind: - STACK_WIND (frame, priv->is_quota_on? - quota_fallocate_cbk: default_fallocate_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->fallocate, fd, mode, offset, len, - xdata); +off: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->fallocate, fd, mode, offset, + len, xdata); return 0; } -- cgit