cb8e9e
From 7a578ddf23794d8a95000ce950807c88de74dfce Mon Sep 17 00:00:00 2001
cb8e9e
From: Gaurav Kumar Garg <ggarg@redhat.com>
cb8e9e
Date: Wed, 12 Aug 2015 15:00:29 +0530
cb8e9e
Subject: [PATCH 276/279] libglusterfs: write error handling when filesystem have no space left
cb8e9e
cb8e9e
This is a backport of: http://review.gluster.org/#/c/11029/
cb8e9e
cb8e9e
When no space left on filesystem and user want to perform any operation
cb8e9e
which result to change in /var/lib/glusterd/* files then glusterd is
cb8e9e
failing to write on temporary file.
cb8e9e
cb8e9e
Fix is to handle error when write failed on temporary files due to no
cb8e9e
space left on file system.
cb8e9e
cb8e9e
>Change-Id: I79d595776b42580da35e1282b4a3cd7fe3d14afe
cb8e9e
>BUG: 1226829
cb8e9e
>Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
cb8e9e
cb8e9e
Change-Id: Ifae5d27698025bb3b5cf7235449565575e762451
cb8e9e
BUG: 1226665
cb8e9e
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/54977
cb8e9e
Reviewed-by: Niels de Vos <ndevos@redhat.com>
cb8e9e
Tested-by: Niels de Vos <ndevos@redhat.com>
cb8e9e
---
cb8e9e
 libglusterfs/src/store.c |   12 ++++++------
cb8e9e
 1 files changed, 6 insertions(+), 6 deletions(-)
cb8e9e
cb8e9e
diff --git a/libglusterfs/src/store.c b/libglusterfs/src/store.c
cb8e9e
index 7c8b29d..8442b31 100644
cb8e9e
--- a/libglusterfs/src/store.c
cb8e9e
+++ b/libglusterfs/src/store.c
cb8e9e
@@ -345,15 +345,15 @@ gf_store_save_value (int fd, char *key, char *value)
cb8e9e
 
cb8e9e
         fp = fdopen (dup_fd, "a+");
cb8e9e
         if (fp == NULL) {
cb8e9e
-                gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
cb8e9e
-                        "fdopen failed.");
cb8e9e
+                gf_msg (THIS->name, GF_LOG_WARNING, errno,
cb8e9e
+                        LG_MSG_FILE_OP_FAILED, "fdopen failed.");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = fprintf (fp, "%s=%s\n", key, value);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
cb8e9e
+                gf_msg (THIS->name, GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
cb8e9e
                         "Unable to store key: %s, value: %s.",
cb8e9e
                         key, value);
cb8e9e
                 ret = -1;
cb8e9e
@@ -361,8 +361,8 @@ gf_store_save_value (int fd, char *key, char *value)
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = fflush (fp);
cb8e9e
-        if (feof (fp)) {
cb8e9e
-                gf_msg ("", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
cb8e9e
+        if (ret) {
cb8e9e
+                gf_msg (THIS->name, GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED,
cb8e9e
                         "fflush failed.");
cb8e9e
                 ret = -1;
cb8e9e
                 goto out;
cb8e9e
@@ -373,7 +373,7 @@ out:
cb8e9e
         if (fp)
cb8e9e
                 fclose (fp);
cb8e9e
 
cb8e9e
-        gf_msg_debug ("", 0, "returning: %d", ret);
cb8e9e
+        gf_msg_debug (THIS->name, 0, "returning: %d", ret);
cb8e9e
         return ret;
cb8e9e
 }
cb8e9e
 
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e