summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorManikandan Selvaganesh <mselvaga@redhat.com>2015-02-04 12:14:52 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-04-08 05:37:12 +0000
commit20e86a1b4c733934ff9960314d06697ad05a4528 (patch)
treef5d8e5961765abcd43aaeab271aa642685fec6b7 /xlators/cluster
parent5ac39ab3cd4ba8c5c3a103912a13c443036bfe2e (diff)
afr : null dereference coverity fix.
CID : 1194648 Change-Id: Ib26e7cdbf412d563240885fb3113bcc1fe5c9c49 BUG: 789278 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-on: http://review.gluster.org/9571 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/afr/src/afr-common.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index efe8f8bc435..5654e3ad03d 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -328,14 +328,16 @@ afr_inode_read_subvol_get (inode_t *inode, xlator_t *this, unsigned char *data,
{
int ret = -1;
- LOCK(&inode->lock);
+ GF_VALIDATE_OR_GOTO (this->name, inode, out);
+
+ LOCK(&inode->lock);
{
ret = __afr_inode_read_subvol_get (inode, this, data,
metadata, event_p);
}
UNLOCK(&inode->lock);
-
- return ret;
+out:
+ return ret;
}
int
@@ -344,14 +346,16 @@ afr_inode_split_brain_choice_get (inode_t *inode, xlator_t *this,
{
int ret = -1;
+ GF_VALIDATE_OR_GOTO (this->name, inode, out);
+
LOCK(&inode->lock);
{
ret = __afr_inode_split_brain_choice_get (inode, this,
spb_choice);
}
UNLOCK(&inode->lock);
-
- return ret;
+out:
+ return ret;
}
@@ -361,29 +365,34 @@ afr_inode_read_subvol_set (inode_t *inode, xlator_t *this, unsigned char *data,
{
int ret = -1;
- LOCK(&inode->lock);
+ GF_VALIDATE_OR_GOTO (this->name, inode, out);
+
+ LOCK(&inode->lock);
{
ret = __afr_inode_read_subvol_set (inode, this, data, metadata,
event);
}
UNLOCK(&inode->lock);
-
- return ret;
+out:
+ return ret;
}
+
int
afr_inode_split_brain_choice_set (inode_t *inode, xlator_t *this,
int spb_choice)
{
int ret = -1;
+ GF_VALIDATE_OR_GOTO (this->name, inode, out);
+
LOCK(&inode->lock);
{
ret = __afr_inode_split_brain_choice_set (inode, this,
spb_choice);
}
UNLOCK(&inode->lock);
-
+out:
return ret;
}
@@ -393,12 +402,14 @@ afr_inode_read_subvol_reset (inode_t *inode, xlator_t *this)
{
int ret = -1;
- LOCK(&inode->lock);
- {
- ret = __afr_inode_read_subvol_reset (inode, this);
- }
- UNLOCK(&inode->lock);
+ GF_VALIDATE_OR_GOTO (this->name, inode, out);
+ LOCK(&inode->lock);
+ {
+ ret = __afr_inode_read_subvol_reset (inode, this);
+ }
+ UNLOCK(&inode->lock);
+out:
return ret;
}