diff options
-rw-r--r-- | xlators/cluster/ec/src/ec-generic.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/xlators/cluster/ec/src/ec-generic.c b/xlators/cluster/ec/src/ec-generic.c index 4cd47a83b8..884deb9366 100644 --- a/xlators/cluster/ec/src/ec-generic.c +++ b/xlators/cluster/ec/src/ec-generic.c @@ -193,12 +193,14 @@ ec_flush(call_frame_t *frame, xlator_t *this, uintptr_t target, GF_VALIDATE_OR_GOTO(this->name, frame, out); GF_VALIDATE_OR_GOTO(this->name, this->private, out); - error = ec_validate_fd(fd, this); - if (error) { - gf_msg(this->name, GF_LOG_ERROR, EBADF, EC_MSG_FD_BAD, - "Failing %s on %s", gf_fop_list[GF_FOP_FLUSH], - fd->inode ? uuid_utoa(fd->inode->gfid) : ""); - goto out; + if (fd) { + error = ec_validate_fd(fd, this); + if (error) { + gf_msg(this->name, GF_LOG_ERROR, EBADF, EC_MSG_FD_BAD, + "Failing %s on %s", gf_fop_list[GF_FOP_FLUSH], + fd->inode ? uuid_utoa(fd->inode->gfid) : ""); + goto out; + } } fop = ec_fop_data_allocate(frame, this, GF_FOP_FLUSH, 0, target, fop_flags, @@ -417,12 +419,14 @@ ec_fsync(call_frame_t *frame, xlator_t *this, uintptr_t target, GF_VALIDATE_OR_GOTO(this->name, frame, out); GF_VALIDATE_OR_GOTO(this->name, this->private, out); - error = ec_validate_fd(fd, this); - if (error) { - gf_msg(this->name, GF_LOG_ERROR, EBADF, EC_MSG_FD_BAD, - "Failing %s on %s", gf_fop_list[GF_FOP_FSYNC], - fd->inode ? uuid_utoa(fd->inode->gfid) : ""); - goto out; + if (fd) { + error = ec_validate_fd(fd, this); + if (error) { + gf_msg(this->name, GF_LOG_ERROR, EBADF, EC_MSG_FD_BAD, + "Failing %s on %s", gf_fop_list[GF_FOP_FSYNC], + fd->inode ? uuid_utoa(fd->inode->gfid) : ""); + goto out; + } } fop = ec_fop_data_allocate(frame, this, GF_FOP_FSYNC, 0, target, fop_flags, |