summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2009-12-18 07:51:12 +0000
committerVijay Bellur <vijay@dev.gluster.com>2009-12-18 08:41:37 -0800
commitea18fce5cd759a19aa928393a4b30cb87d33beec (patch)
treecf25061c7849f26fe0b778ff29223a440728b931
parent40541428c7df4192d93b6bc61a92784ca56c8b3f (diff)
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 <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> 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
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index aaf8c99cc25..9b2c43fc268 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,