fuse: use postbuf in truncate_cbk for attributes to return

this causes a problem where inodes even after truncate show old
file size for a short time (till attributes are expired in fuse kernel module)

Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

BUG: 146 (Add setattr FOP)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=146
This commit is contained in:
Anand Avati 2009-10-28 05:40:12 +00:00 committed by Anand V. Avati
parent 1f4e97c01a
commit ef7524ec1e

View File

@ -673,7 +673,7 @@ fuse_forget (xlator_t *this, fuse_in_header_t *finh, void *msg)
static int
fuse_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct stat *buf,
int32_t op_ret, int32_t op_errno, struct stat *prebuf,
struct stat *postbuf)
{
fuse_state_t *state;
@ -690,12 +690,12 @@ fuse_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
"%"PRIu64": %s() %s => %"PRId64, frame->root->unique,
gf_fop_list[frame->root->op],
state->loc.path ? state->loc.path : "ERR",
buf->st_ino);
prebuf->st_ino);
/* TODO: make these timeouts configurable via meta */
/* TODO: what if the inode number has changed by now */
buf->st_blksize = this->ctx->page_size;
stat2attr (buf, &fao.attr);
postbuf->st_blksize = this->ctx->page_size;
stat2attr (postbuf, &fao.attr);
fao.attr_valid = calc_timeout_sec (priv->attribute_timeout);
fao.attr_valid_nsec =