summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-open.c
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2011-03-11 05:02:15 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-22 04:20:21 -0700
commita4233a41bf6a2f9ddbce15a530b1678c55ba24a5 (patch)
treed73519669b6f54d0550c05f89082d07e5b4d7295 /xlators/cluster/afr/src/afr-open.c
parente115072f4b654d407fcf435256334645ab471776 (diff)
cluster/afr: skip openfd flush when the file is already deleted
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2497 (client crashes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2497
Diffstat (limited to 'xlators/cluster/afr/src/afr-open.c')
-rw-r--r--xlators/cluster/afr/src/afr-open.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
index 074a9d32c..8c87ce893 100644
--- a/xlators/cluster/afr/src/afr-open.c
+++ b/xlators/cluster/afr/src/afr-open.c
@@ -367,13 +367,17 @@ afr_prepare_loc (call_frame_t *frame, fd_t *fd)
char *path = NULL;
int ret = 0;
- if (!fd)
+ if ((!fd) || (!fd->inode))
return -1;
local = frame->local;
ret = inode_path (fd->inode, NULL, (char **)&path);
- if (ret <= 0)
+ if (ret <= 0) {
+ gf_log (frame->this->name, GF_LOG_DEBUG,
+ "Unable to get path for gfid: %s",
+ uuid_utoa (fd->inode->gfid));
return -1;
+ }
if (local->loc.path) {
if (strcmp (path, local->loc.path))
@@ -414,8 +418,7 @@ afr_openfd_sh (call_frame_t *frame, xlator_t *this)
local = frame->local;
sh = &local->self_heal;
- afr_prepare_loc (frame, local->fd);
-
+ GF_ASSERT (local->loc.path);
/* forcibly trigger missing-entries self-heal */
local->success_count = 1;
@@ -583,6 +586,16 @@ afr_openfd_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
local = frame->local;
/*
+ * If the file is already deleted while the fd is open, no need to
+ * perform the openfd flush, call the flush_cbk and get out.
+ */
+ ret = afr_prepare_loc (frame, fd);
+ if (ret < 0) {
+ local->openfd_flush_cbk (frame, this);
+ goto out;
+ }
+
+ /*
* Some subvolumes might have come up on which we never
* opened this fd in the first place. Re-open fd's on those
* subvolumes now.
@@ -612,8 +625,6 @@ afr_openfd_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
goto out;
}
- afr_prepare_loc (frame, fd);
-
local->call_count = call_count;
for (i = 0; i < priv->child_count; i++) {