diff options
author | Raghavendra G <raghavendra@gluster.com> | 2011-04-11 01:13:58 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-04-11 05:44:02 -0700 |
commit | 204db674a9c6a724f5fe887c02cd98386043f4fe (patch) | |
tree | 57e7d88cde828c146fe1cc4d7a011e3d5dcaec52 /xlators/features/quota/src/quota.c | |
parent | f5625e628f1959331eed85082cb6bfdc324db3c2 (diff) |
features/quota: handle failed fops gracefully.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2701 ([6db2b422f05d0553d0a83af603ae4d176b41cbdf]: crash in quota_readlink_cbk)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2701
Diffstat (limited to 'xlators/features/quota/src/quota.c')
-rw-r--r-- | xlators/features/quota/src/quota.c | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 3a2c26daa..6fac7572f 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -193,15 +193,15 @@ quota_validate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint64_t value = 0; call_stub_t *stub = NULL; + if (op_ret < 0) { + goto unwind; + } + local = frame->local; GF_ASSERT (local); priv = this->private; - if (op_ret == -1) { - goto unwind; - } - GF_ASSERT (frame); GF_VALIDATE_OR_GOTO_WITH_ERROR ("quota", this, unwind, op_errno, EINVAL); @@ -774,7 +774,7 @@ quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; - if ((op_ret == -1) || (local == NULL)) { + if ((op_ret < 0) || (local == NULL)) { goto out; } @@ -1187,7 +1187,7 @@ quota_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_inode_ctx_t *ctx = NULL; uint64_t value = 0; - if (op_ret == -1) { + if (op_ret < 0) { goto out; } @@ -1259,7 +1259,7 @@ quota_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_dentry_t *dentry = NULL; char found = 0; - if (op_ret == -1) { + if (op_ret < 0) { goto out; } @@ -1441,7 +1441,7 @@ quota_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, char new_dentry_found = 0; int64_t size = 0; - if (op_ret == -1) { + if (op_ret < 0) { goto out; } @@ -1672,7 +1672,7 @@ quota_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_inode_ctx_t *ctx = NULL; quota_dentry_t *dentry = NULL; - if (op_ret == -1) { + if (op_ret < 0) { goto out; } @@ -1819,7 +1819,7 @@ quota_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int64_t delta = 0; quota_inode_ctx_t *ctx = NULL; - if (op_ret == -1) { + if (op_ret < 0) { goto out; } @@ -1895,7 +1895,7 @@ quota_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int64_t delta = 0; quota_inode_ctx_t *ctx = NULL; - if (op_ret == -1) { + if (op_ret < 0) { goto out; } @@ -2040,6 +2040,10 @@ quota_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_local_t *local = NULL; quota_inode_ctx_t *ctx = NULL; + if (op_ret < 0) { + goto out; + } + local = frame->local; if (local == NULL) { gf_log (this->name, GF_LOG_WARNING, "local is NULL"); @@ -2104,6 +2108,10 @@ quota_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_local_t *local = NULL; quota_inode_ctx_t *ctx = NULL; + if (op_ret < 0) { + goto out; + } + local = frame->local; if (local == NULL) { gf_log (this->name, GF_LOG_WARNING, "local is NULL"); @@ -2163,6 +2171,10 @@ quota_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_local_t *local = NULL; quota_inode_ctx_t *ctx = NULL; + if (op_ret < 0) { + goto out; + } + local = frame->local; if (local == NULL) { gf_log (this->name, GF_LOG_WARNING, "local is NULL"); @@ -2228,6 +2240,10 @@ quota_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_local_t *local = NULL; quota_inode_ctx_t *ctx = NULL; + if (op_ret < 0) { + goto out; + } + local = frame->local; if (local == NULL) { gf_log (this->name, GF_LOG_WARNING, "local is NULL"); @@ -2288,6 +2304,10 @@ quota_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_local_t *local = NULL; quota_inode_ctx_t *ctx = NULL; + if (op_ret < 0) { + goto out; + } + local = frame->local; if (local == NULL) { gf_log (this->name, GF_LOG_WARNING, "local is NULL"); @@ -2347,6 +2367,10 @@ quota_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_local_t *local = NULL; quota_inode_ctx_t *ctx = NULL; + if (op_ret < 0) { + goto out; + } + local = frame->local; if (local == NULL) { gf_log (this->name, GF_LOG_WARNING, "local is NULL"); @@ -2415,6 +2439,10 @@ quota_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, quota_local_t *local = NULL; quota_inode_ctx_t *ctx = NULL; + if (op_ret < 0) { + goto out; + } + local = frame->local; if (local == NULL) { gf_log (this->name, GF_LOG_WARNING, "local is NULL"); |