Skip to content

Commit

Permalink
libglusterfs: write error handling when filesystem have no space left
Browse files Browse the repository at this point in the history
When no space left on filesystem and user want to perform any operation
which result to change in /var/lib/glusterd/* files then glusterd is
failing to write on temporary file.

Fix is to handle error when write failed on temporary files due to no
space left on file system.

Change-Id: I79d595776b42580da35e1282b4a3cd7fe3d14afe
BUG: 1226829
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
Reviewed-on: http://review.gluster.org/11029
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Cedric Buissart
  • Loading branch information
gaurav36 authored and nixpanic committed Jul 31, 2015
1 parent 8470ac5 commit e7f737e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions libglusterfs/src/store.c
Expand Up @@ -339,24 +339,24 @@ gf_store_save_value (int fd, char *key, char *value)

fp = fdopen (dup_fd, "a+");
if (fp == NULL) {
gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED, "fdopen "
"failed.");
gf_msg (THIS->name, GF_LOG_WARNING, errno,
LG_MSG_FILE_OP_FAILED, "fdopen failed.");
ret = -1;
goto out;
}

ret = fprintf (fp, "%s=%s\n", key, value);
if (ret < 0) {
gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
gf_msg (THIS->name, GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
"Unable to store key: %s, value: %s.",
key, value);
ret = -1;
goto out;
}

ret = fflush (fp);
if (feof (fp)) {
gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
if (ret) {
gf_msg (THIS->name, GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
"fflush failed.");
ret = -1;
goto out;
Expand All @@ -367,7 +367,7 @@ gf_store_save_value (int fd, char *key, char *value)
if (fp)
fclose (fp);

gf_msg_debug ("", 0, "returning: %d", ret);
gf_msg_debug (THIS->name, 0, "returning: %d", ret);
return ret;
}

Expand Down

0 comments on commit e7f737e

Please sign in to comment.