From ea18fce5cd759a19aa928393a4b30cb87d33beec Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Fri, 18 Dec 2009 07:51:12 +0000 Subject: fuse-bridge: Don't try to fill a loc in setattr when we can proceed on with an fd. This fixes broken ftruncate on unlinked files. Signed-off-by: Csaba Henk Signed-off-by: Vijay Bellur BUG: 472 (OpenOffice fails on GlusterFS $HOME due to fuse_loc_fill error) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=472 --- xlators/mount/fuse/src/fuse-bridge.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'xlators/mount/fuse') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index aaf8c99cc..9b2c43fc2 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -991,7 +991,14 @@ fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg) GET_STATE (this, finh, state); - ret = fuse_loc_fill (&state->loc, state, finh->nodeid, 0, NULL); + if (fsi->valid & FATTR_FH && + !(fsi->valid & (FATTR_ATIME|FATTR_MTIME))) + /* We need no loc if kernel sent us an fd and + * we are not fiddling with times */ + ret = 1; + else + ret = fuse_loc_fill (&state->loc, state, finh->nodeid, 0, + NULL); /* * This is just stub code demonstrating how to retrieve @@ -1010,7 +1017,7 @@ fuse_setattr (xlator_t *this, fuse_in_header_t *finh, void *msg) if (priv->proto_minor >= 9 && fsi->valid & FATTR_LOCKOWNER) state->lk_owner = fsi->lock_owner; - if ((state->loc.inode == NULL) || + if ((state->loc.inode == NULL && ret == 0) || (ret < 0)) { gf_log ("glusterfs-fuse", GF_LOG_WARNING, -- cgit