summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-11-18 01:19:50 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-11-18 21:14:58 -0800
commit9e481a7aee95cc7aebba8843820069909f21fe07 (patch)
tree40d91abeee8f7cd1731c0940dbf7cc287d4516cd /libglusterfsclient
parent2bf35da812016c8adb05b0aa90c9f0b25e50a878 (diff)
libglusterfsclient: update iattr cache only if operation was successful.
Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 369 (Samba does not work with booster.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=369
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index a298bd33264..83943bd2acd 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -4730,13 +4730,18 @@ libgf_client_stat (libglusterfs_client_ctx_t *ctx,
op_ret = stub->args.stat_cbk.op_ret;
errno = stub->args.stat_cbk.op_errno;
libgf_transform_iattr (ctx, loc->inode, &stub->args.stat_cbk.buf);
- if (stbuf)
- *stbuf = stub->args.stat_cbk.buf;
gf_log (LIBGF_XL_NAME, GF_LOG_DEBUG, "path %s, status %d, errno %d",
loc->path, op_ret, errno);
- libgf_update_iattr_cache (loc->inode, LIBGF_UPDATE_STAT,
- &stub->args.stat_cbk.buf);
+
+ if (op_ret == 0) {
+ if (stbuf)
+ *stbuf = stub->args.stat_cbk.buf;
+
+ libgf_update_iattr_cache (loc->inode, LIBGF_UPDATE_STAT,
+ &stub->args.stat_cbk.buf);
+ }
+
call_stub_destroy (stub);
out:
@@ -4962,14 +4967,17 @@ libgf_client_fstat (libglusterfs_client_ctx_t *ctx,
op_ret = stub->args.fstat_cbk.op_ret;
errno = stub->args.fstat_cbk.op_errno;
- libgf_transform_iattr (ctx, fd->inode, &stub->args.fstat_cbk.buf);
- if (buf)
- *buf = stub->args.fstat_cbk.buf;
-
gf_log (LIBGF_XL_NAME, GF_LOG_DEBUG, "status %d, errno %d", op_ret,
errno);
- libgf_update_iattr_cache (fd->inode, LIBGF_UPDATE_STAT,
- &stub->args.fstat_cbk.buf);
+
+ if (op_ret == 0) {
+ libgf_transform_iattr (ctx, fd->inode,
+ &stub->args.fstat_cbk.buf);
+ if (buf)
+ *buf = stub->args.fstat_cbk.buf;
+ libgf_update_iattr_cache (fd->inode, LIBGF_UPDATE_STAT,
+ &stub->args.fstat_cbk.buf);
+ }
call_stub_destroy (stub);
out:
@@ -7913,15 +7921,22 @@ libgf_client_truncate (libglusterfs_client_ctx_t *ctx,
op_ret = stub->args.truncate_cbk.op_ret;
errno = stub->args.truncate_cbk.op_errno;
- libgf_transform_iattr (ctx, loc->inode,
- &stub->args.truncate_cbk.postbuf);
gf_log (LIBGF_XL_NAME, GF_LOG_DEBUG, "path %s, status %d, errno %d",
loc->path, op_ret, errno);
+
+ if (op_ret == -1) {
+ goto out;
+ }
+
+ libgf_transform_iattr (ctx, loc->inode,
+ &stub->args.truncate_cbk.postbuf);
+
libgf_update_iattr_cache (loc->inode, LIBGF_UPDATE_STAT,
&stub->args.truncate_cbk.postbuf);
call_stub_destroy (stub);
+out:
return op_ret;
}