From bb0bbfecd609fff1a3890775b3119a552aba0e18 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Tue, 4 Jun 2013 06:08:24 +0200 Subject: Fix crash in dht_migration_complete_check_task because of NULL fd This is a backport of Ia5a5d40bcea7bfb320ef7096af1e035b8847d4ff BUG: 960055 Change-Id: Ibf3547a775d7ca2f3a097c880cdf38ffafb322da Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.org/5139 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/cluster/dht/src/dht-helper.c | 2 ++ xlators/cluster/dht/src/dht-inode-write.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 9a00fe648..ef29e3f3a 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -799,6 +799,8 @@ dht_migration_complete_check_task (void *data) local->cached_subvol = dst_node; ret = 0; + if (!local->fd) + goto out; /* once we detect the migration complete, the fd-ctx is no more required.. delete the ctx, and do one extra 'fd_unref' for open fd */ ret = fd_ctx_del (local->fd, this, NULL); diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c index d4a3ecc39..5e85ca536 100644 --- a/xlators/cluster/dht/src/dht-inode-write.c +++ b/xlators/cluster/dht/src/dht-inode-write.c @@ -210,7 +210,7 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_iatt_merge (this, &local->stbuf, postbuf, NULL); dht_iatt_merge (this, &local->prebuf, prebuf, NULL); ret = fd_ctx_get (local->fd, this, NULL); - if (!ret) { + if (!ret || !local->fd) { dht_truncate2 (this, frame, 0); return 0; } -- cgit