summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-04-20 12:31:09 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-21 12:48:49 +0530
commitaa1e2fd37ab93b194308f94edd8ab0a342c7830e (patch)
tree75e0889a74cf0e7020a31542c6e2471364ea9a2f /libglusterfsclient
parentf29383ef35d210f2a72883cb6157e915200f7c7c (diff)
libglusterfsclient: Fix stat cache bug
The way stat cache gets updated was not consistent across all syscalls. Consequently, I was running into a bug that returned a 0 st_ino. The fix actually resides in the hunk that changes the lines in libgf_client_lookup but similar changes were also required in other users of stat cache. This commit fixes the bug and also cleans up the way stat cache is updated. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 1b444007b8b..449f38d1706 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -1178,7 +1178,10 @@ libgf_client_lookup (libglusterfs_client_ctx_t *ctx,
inode = stub->args.lookup_cbk.inode;
if (!(libgf_get_inode_ctx (inode)))
libgf_alloc_inode_ctx (ctx, inode);
- libgf_update_iattr_cache (inode, LIBGF_UPDATE_ALL, stbuf);
+ libgf_update_iattr_cache (inode, LIBGF_UPDATE_ALL,
+ &stub->args.lookup_cbk.buf);
+ if (stbuf)
+ *stbuf = stub->args.lookup_cbk.buf;
if (dict)
*dict = dict_ref (stub->args.lookup_cbk.dict);
@@ -3326,9 +3329,11 @@ libgf_client_stat (libglusterfs_client_ctx_t *ctx,
op_ret = stub->args.stat_cbk.op_ret;
errno = stub->args.stat_cbk.op_errno;
- *stbuf = stub->args.stat_cbk.buf;
+ if (stbuf)
+ *stbuf = stub->args.stat_cbk.buf;
- libgf_update_iattr_cache (loc->inode, LIBGF_UPDATE_STAT, stbuf);
+ libgf_update_iattr_cache (loc->inode, LIBGF_UPDATE_STAT,
+ &stub->args.stat_cbk.buf);
call_stub_destroy (stub);
out:
@@ -3519,9 +3524,11 @@ libgf_client_fstat (libglusterfs_client_ctx_t *ctx,
op_ret = stub->args.fstat_cbk.op_ret;
errno = stub->args.fstat_cbk.op_errno;
- *buf = stub->args.fstat_cbk.buf;
+ if (buf)
+ *buf = stub->args.fstat_cbk.buf;
- libgf_update_iattr_cache (fd->inode, LIBGF_UPDATE_STAT, buf);
+ libgf_update_iattr_cache (fd->inode, LIBGF_UPDATE_STAT,
+ &stub->args.fstat_cbk.buf);
call_stub_destroy (stub);
out: