|
|
d1681e |
From 53ecd916d5ef56e164228ba123b078d4b30bfa81 Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
d1681e |
Date: Thu, 12 Jul 2018 13:29:48 +0530
|
|
|
d1681e |
Subject: [PATCH 333/333] glusterd: Add multiple checks before attach/start a
|
|
|
d1681e |
brick
|
|
|
d1681e |
|
|
|
d1681e |
Problem: In brick mux scenario sometime glusterd is not able
|
|
|
d1681e |
to start/attach a brick and gluster v status shows
|
|
|
d1681e |
brick is already running
|
|
|
d1681e |
|
|
|
d1681e |
Solution:
|
|
|
d1681e |
1) To make sure brick is running check brick_path in
|
|
|
d1681e |
/proc/<pid>/fd , if a brick is consumed by the brick
|
|
|
d1681e |
process it means brick stack is come up otherwise not
|
|
|
d1681e |
2) Before start/attach a brick check if a brick is mounted
|
|
|
d1681e |
or not
|
|
|
d1681e |
3) At the time of printing volume status check brick is
|
|
|
d1681e |
consumed by any brick process
|
|
|
d1681e |
|
|
|
d1681e |
Test: To test the same followed procedure
|
|
|
d1681e |
1) Setup brick mux environment on a vm
|
|
|
d1681e |
2) Put a breaking point in gdb in function posix_health_check_thread_proc
|
|
|
d1681e |
at the time of notify GF_EVENT_CHILD_DOWN event
|
|
|
d1681e |
3) unmount anyone brick path forcefully
|
|
|
d1681e |
4) check gluster v status it will show N/A for the brick
|
|
|
d1681e |
5) Try to start volume with force option, glusterd throw
|
|
|
d1681e |
message "No device available for mount brick"
|
|
|
d1681e |
6) Mount the brick_root path
|
|
|
d1681e |
7) Try to start volume with force option
|
|
|
d1681e |
8) down brick is started successfully
|
|
|
d1681e |
|
|
|
d1681e |
> Change-Id: I91898dad21d082ebddd12aa0d1f7f0ed012bdf69
|
|
|
d1681e |
> fixes: bz#1595320
|
|
|
d1681e |
> (cherry picked from commit 9400b6f2c8aa219a493961e0ab9770b7f12e80d2)
|
|
|
d1681e |
> (Reviewed on upstream link https://review.gluster.org/#/c/20202/)
|
|
|
d1681e |
|
|
|
d1681e |
Change-Id: I62459910272754e4e062b2725fea2a1e68d743f1
|
|
|
d1681e |
BUG: 1589279
|
|
|
d1681e |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/145269
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
glusterfsd/src/glusterfsd-mgmt.c | 3 +
|
|
|
d1681e |
tests/basic/bug-1595320.t | 92 +++++++++
|
|
|
d1681e |
tests/basic/posix/shared-statfs.t | 2 +
|
|
|
d1681e |
tests/bitrot/bug-1373520.t | 1 +
|
|
|
d1681e |
tests/bugs/distribute/bug-1368012.t | 2 +
|
|
|
d1681e |
tests/bugs/distribute/bug-853258.t | 1 +
|
|
|
d1681e |
tests/bugs/quota/bug-1293601.t | 3 +-
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-snapshot.c | 2 +-
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-utils.c | 261 ++++++++++++++++++++----
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-utils.h | 6 +-
|
|
|
d1681e |
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 7 +-
|
|
|
d1681e |
11 files changed, 329 insertions(+), 51 deletions(-)
|
|
|
d1681e |
create mode 100644 tests/basic/bug-1595320.t
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
|
|
|
d1681e |
index 30a717f..cbd436a 100644
|
|
|
d1681e |
--- a/glusterfsd/src/glusterfsd-mgmt.c
|
|
|
d1681e |
+++ b/glusterfsd/src/glusterfsd-mgmt.c
|
|
|
d1681e |
@@ -1010,6 +1010,9 @@ glusterfs_handle_attach (rpcsvc_request_t *req)
|
|
|
d1681e |
"got attach for %s but no active graph",
|
|
|
d1681e |
xlator_req.name);
|
|
|
d1681e |
}
|
|
|
d1681e |
+ if (ret) {
|
|
|
d1681e |
+ ret = -1;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
|
|
|
d1681e |
glusterfs_translator_info_response_send (req, ret, NULL, NULL);
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/tests/basic/bug-1595320.t b/tests/basic/bug-1595320.t
|
|
|
d1681e |
new file mode 100644
|
|
|
d1681e |
index 0000000..9d856ee
|
|
|
d1681e |
--- /dev/null
|
|
|
d1681e |
+++ b/tests/basic/bug-1595320.t
|
|
|
d1681e |
@@ -0,0 +1,92 @@
|
|
|
d1681e |
+#!/bin/bash
|
|
|
d1681e |
+
|
|
|
d1681e |
+. $(dirname $0)/../include.rc
|
|
|
d1681e |
+. $(dirname $0)/../volume.rc
|
|
|
d1681e |
+. $(dirname $0)/../snapshot.rc
|
|
|
d1681e |
+
|
|
|
d1681e |
+cleanup
|
|
|
d1681e |
+
|
|
|
d1681e |
+function count_up_bricks {
|
|
|
d1681e |
+ $CLI --xml volume status $V0 | grep '<status>1' | wc -l
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
+function count_brick_processes {
|
|
|
d1681e |
+ pgrep glusterfsd | wc -l
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Setup 3 LVMS
|
|
|
d1681e |
+LVM_PREFIX="test"
|
|
|
d1681e |
+TEST init_n_bricks 3
|
|
|
d1681e |
+TEST setup_lvm 3
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Start glusterd
|
|
|
d1681e |
+TEST glusterd
|
|
|
d1681e |
+TEST pidof glusterd
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Create volume and enable brick multiplexing
|
|
|
d1681e |
+TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 $H0:$L3
|
|
|
d1681e |
+gluster v set all cluster.brick-multiplex on
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Start the volume
|
|
|
d1681e |
+TEST $CLI volume start $V0
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 3 count_up_bricks
|
|
|
d1681e |
+EXPECT 1 count_brick_processes
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Kill volume ungracefully
|
|
|
d1681e |
+brick_pid=`pgrep glusterfsd`
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Make sure every brick root should be consumed by a brick process
|
|
|
d1681e |
+n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L1 | grep -v ".glusterfs" | wc -l`
|
|
|
d1681e |
+TEST [ $n -eq 1 ]
|
|
|
d1681e |
+n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L2 | grep -v ".glusterfs" | wc -l`
|
|
|
d1681e |
+TEST [ $n -eq 1 ]
|
|
|
d1681e |
+n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L3 | grep -v ".glusterfs" | wc -l`
|
|
|
d1681e |
+TEST [ $n -eq 1 ]
|
|
|
d1681e |
+
|
|
|
d1681e |
+b1_pid_file=$(ls $GLUSTERD_PIDFILEDIR/vols/$V0/*d-backends-1*.pid)
|
|
|
d1681e |
+b2_pid_file=$(ls $GLUSTERD_PIDFILEDIR/vols/$V0/*d-backends-2*.pid)
|
|
|
d1681e |
+b3_pid_file=$(ls $GLUSTERD_PIDFILEDIR/vols/$V0/*d-backends-3*.pid)
|
|
|
d1681e |
+
|
|
|
d1681e |
+kill -9 $brick_pid
|
|
|
d1681e |
+EXPECT 0 count_brick_processes
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Unmount 3rd brick root from node
|
|
|
d1681e |
+brick_root=$L3
|
|
|
d1681e |
+TEST umount -l $brick_root 2>/dev/null
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Start the volume only 2 brick should be start
|
|
|
d1681e |
+TEST $CLI volume start $V0 force
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 2 count_up_bricks
|
|
|
d1681e |
+EXPECT 1 count_brick_processes
|
|
|
d1681e |
+
|
|
|
d1681e |
+brick_pid=`pgrep glusterfsd`
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Make sure only two brick root should be consumed by a brick process
|
|
|
d1681e |
+n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L1 | grep -v ".glusterfs" | wc -l`
|
|
|
d1681e |
+TEST [ $n -eq 1 ]
|
|
|
d1681e |
+n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L2 | grep -v ".glusterfs" | wc -l`
|
|
|
d1681e |
+TEST [ $n -eq 1 ]
|
|
|
d1681e |
+n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L3 | grep -v ".glusterfs" | wc -l`
|
|
|
d1681e |
+TEST [ $n -eq 0 ]
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Mount the brick root
|
|
|
d1681e |
+TEST mount -t xfs -o nouuid /dev/test_vg_3/brick_lvm $brick_root
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Replace brick_pid file to test brick_attach code
|
|
|
d1681e |
+TEST cp $b1_pid_file $b3_pid_file
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Start the volume all brick should be up
|
|
|
d1681e |
+TEST $CLI volume start $V0 force
|
|
|
d1681e |
+
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 3 count_up_bricks
|
|
|
d1681e |
+EXPECT 1 count_brick_processes
|
|
|
d1681e |
+
|
|
|
d1681e |
+# Make sure every brick root should be consumed by a brick process
|
|
|
d1681e |
+n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L1 | grep -v ".glusterfs" | wc -l`
|
|
|
d1681e |
+TEST [ $n -eq 1 ]
|
|
|
d1681e |
+n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L2 | grep -v ".glusterfs" | wc -l`
|
|
|
d1681e |
+TEST [ $n -eq 1 ]
|
|
|
d1681e |
+n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L3 | grep -v ".glusterfs" | wc -l`
|
|
|
d1681e |
+TEST [ $n -eq 1 ]
|
|
|
d1681e |
+
|
|
|
d1681e |
+cleanup
|
|
|
d1681e |
diff --git a/tests/basic/posix/shared-statfs.t b/tests/basic/posix/shared-statfs.t
|
|
|
d1681e |
index 8caa9fa..3343956 100644
|
|
|
d1681e |
--- a/tests/basic/posix/shared-statfs.t
|
|
|
d1681e |
+++ b/tests/basic/posix/shared-statfs.t
|
|
|
d1681e |
@@ -23,6 +23,7 @@ TEST MOUNT_LOOP $LO2 $B0/${V0}2
|
|
|
d1681e |
# Create a subdir in mountpoint and use that for volume.
|
|
|
d1681e |
TEST $CLI volume create $V0 $H0:$B0/${V0}1/1 $H0:$B0/${V0}2/1;
|
|
|
d1681e |
TEST $CLI volume start $V0
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" online_brick_count
|
|
|
d1681e |
TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0
|
|
|
d1681e |
total_space=$(df -P $M0 | tail -1 | awk '{ print $2}')
|
|
|
d1681e |
# Keeping the size less than 200M mainly because XFS will use
|
|
|
d1681e |
@@ -38,6 +39,7 @@ EXPECT 'Stopped' volinfo_field $V0 'Status';
|
|
|
d1681e |
TEST $CLI volume add-brick $V0 $H0:$B0/${V0}1/2 $H0:$B0/${V0}2/2 $H0:$B0/${V0}1/3 $H0:$B0/${V0}2/3
|
|
|
d1681e |
|
|
|
d1681e |
TEST $CLI volume start $V0
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "6" online_brick_count
|
|
|
d1681e |
TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0
|
|
|
d1681e |
total_space=$(df -P $M0 | tail -1 | awk '{ print $2}')
|
|
|
d1681e |
TEST [ $total_space -gt 194000 -a $total_space -lt 200000 ]
|
|
|
d1681e |
diff --git a/tests/bitrot/bug-1373520.t b/tests/bitrot/bug-1373520.t
|
|
|
d1681e |
index 225d3b1..c09d424 100644
|
|
|
d1681e |
--- a/tests/bitrot/bug-1373520.t
|
|
|
d1681e |
+++ b/tests/bitrot/bug-1373520.t
|
|
|
d1681e |
@@ -11,6 +11,7 @@ TEST pidof glusterd
|
|
|
d1681e |
#Create a disperse volume
|
|
|
d1681e |
TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5}
|
|
|
d1681e |
TEST $CLI volume start $V0
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "6" online_brick_count
|
|
|
d1681e |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Started' volinfo_field $V0 'Status'
|
|
|
d1681e |
|
|
|
d1681e |
#Disable md-cache
|
|
|
d1681e |
diff --git a/tests/bugs/distribute/bug-1368012.t b/tests/bugs/distribute/bug-1368012.t
|
|
|
d1681e |
index f89314b..b861554 100644
|
|
|
d1681e |
--- a/tests/bugs/distribute/bug-1368012.t
|
|
|
d1681e |
+++ b/tests/bugs/distribute/bug-1368012.t
|
|
|
d1681e |
@@ -22,6 +22,7 @@ EXPECT "$V0" volinfo_field $V0 'Volume Name';
|
|
|
d1681e |
EXPECT 'Created' volinfo_field $V0 'Status';
|
|
|
d1681e |
## Start volume and verify
|
|
|
d1681e |
TEST $CLI volume start $V0;
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" online_brick_count
|
|
|
d1681e |
TEST $CLI volume set $V0 performance.stat-prefetch off
|
|
|
d1681e |
EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
d1681e |
TEST glusterfs -s $H0 --volfile-id=$V0 $M0
|
|
|
d1681e |
@@ -36,6 +37,7 @@ TEST permission_root=`stat -c "%A" $M0`
|
|
|
d1681e |
TEST echo $permission_root
|
|
|
d1681e |
#Add-brick
|
|
|
d1681e |
TEST $CLI volume add-brick $V0 $H0:/${V0}3
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "3" online_brick_count
|
|
|
d1681e |
|
|
|
d1681e |
#Allow one lookup to happen
|
|
|
d1681e |
TEST pushd $M0
|
|
|
d1681e |
diff --git a/tests/bugs/distribute/bug-853258.t b/tests/bugs/distribute/bug-853258.t
|
|
|
d1681e |
index e39f507..6817d9e 100755
|
|
|
d1681e |
--- a/tests/bugs/distribute/bug-853258.t
|
|
|
d1681e |
+++ b/tests/bugs/distribute/bug-853258.t
|
|
|
d1681e |
@@ -31,6 +31,7 @@ done
|
|
|
d1681e |
|
|
|
d1681e |
# Expand the volume and force assignment of new ranges.
|
|
|
d1681e |
TEST $CLI volume add-brick $V0 $H0:$B0/${V0}3
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" online_brick_count
|
|
|
d1681e |
# Force assignment of initial ranges.
|
|
|
d1681e |
TEST $CLI volume rebalance $V0 fix-layout start
|
|
|
d1681e |
EXPECT_WITHIN $REBALANCE_TIMEOUT "fix-layout completed" fix-layout_status_field $V0
|
|
|
d1681e |
diff --git a/tests/bugs/quota/bug-1293601.t b/tests/bugs/quota/bug-1293601.t
|
|
|
d1681e |
index def4ef9..741758b 100644
|
|
|
d1681e |
--- a/tests/bugs/quota/bug-1293601.t
|
|
|
d1681e |
+++ b/tests/bugs/quota/bug-1293601.t
|
|
|
d1681e |
@@ -9,6 +9,7 @@ TEST glusterd
|
|
|
d1681e |
|
|
|
d1681e |
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4}
|
|
|
d1681e |
TEST $CLI volume start $V0
|
|
|
d1681e |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" online_brick_count
|
|
|
d1681e |
TEST $CLI volume quota $V0 enable
|
|
|
d1681e |
|
|
|
d1681e |
TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0;
|
|
|
d1681e |
@@ -27,6 +28,6 @@ EXPECT_WITHIN $MARKER_UPDATE_TIMEOUT "1.0MB" quotausage "/"
|
|
|
d1681e |
TEST $CLI volume quota $V0 disable
|
|
|
d1681e |
TEST $CLI volume quota $V0 enable
|
|
|
d1681e |
|
|
|
d1681e |
-EXPECT_WITHIN 40 "1.0MB" quotausage "/"
|
|
|
d1681e |
+EXPECT_WITHIN 60 "1.0MB" quotausage "/"
|
|
|
d1681e |
|
|
|
d1681e |
cleanup;
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
|
|
|
d1681e |
index 304cef6..09e10bf 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
|
|
|
d1681e |
@@ -2844,7 +2844,7 @@ glusterd_do_lvm_snapshot_remove (glusterd_volinfo_t *snap_vol,
|
|
|
d1681e |
GLUSTERD_GET_BRICK_PIDFILE (pidfile, snap_vol, brickinfo, priv);
|
|
|
d1681e |
if (gf_is_service_running (pidfile, &pid)) {
|
|
|
d1681e |
(void) send_attach_req (this, brickinfo->rpc,
|
|
|
d1681e |
- brickinfo->path, NULL,
|
|
|
d1681e |
+ brickinfo->path, NULL, NULL,
|
|
|
d1681e |
GLUSTERD_BRICK_TERMINATE);
|
|
|
d1681e |
brickinfo->status = GF_BRICK_STOPPED;
|
|
|
d1681e |
}
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
d1681e |
index 95df889..fe9cc75 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
d1681e |
@@ -2186,7 +2186,7 @@ retry:
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
- ret = glusterd_brick_process_add_brick (brickinfo, volinfo);
|
|
|
d1681e |
+ ret = glusterd_brick_process_add_brick (brickinfo);
|
|
|
d1681e |
if (ret) {
|
|
|
d1681e |
gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
GD_MSG_BRICKPROC_ADD_BRICK_FAILED, "Adding brick %s:%s "
|
|
|
d1681e |
@@ -2372,8 +2372,7 @@ out:
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
-glusterd_brick_process_add_brick (glusterd_brickinfo_t *brickinfo,
|
|
|
d1681e |
- glusterd_volinfo_t *volinfo)
|
|
|
d1681e |
+glusterd_brick_process_add_brick (glusterd_brickinfo_t *brickinfo)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = -1;
|
|
|
d1681e |
xlator_t *this = NULL;
|
|
|
d1681e |
@@ -2500,7 +2499,7 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
brickinfo->hostname, brickinfo->path);
|
|
|
d1681e |
|
|
|
d1681e |
(void) send_attach_req (this, brickinfo->rpc,
|
|
|
d1681e |
- brickinfo->path, NULL,
|
|
|
d1681e |
+ brickinfo->path, NULL, NULL,
|
|
|
d1681e |
GLUSTERD_BRICK_TERMINATE);
|
|
|
d1681e |
} else {
|
|
|
d1681e |
gf_msg_debug (this->name, 0, "About to stop glusterfsd"
|
|
|
d1681e |
@@ -5426,23 +5425,92 @@ static int32_t
|
|
|
d1681e |
attach_brick_callback (struct rpc_req *req, struct iovec *iov, int count,
|
|
|
d1681e |
void *v_frame)
|
|
|
d1681e |
{
|
|
|
d1681e |
- call_frame_t *frame = v_frame;
|
|
|
d1681e |
- glusterd_conf_t *conf = frame->this->private;
|
|
|
d1681e |
- glusterd_brickinfo_t *brickinfo = frame->local;
|
|
|
d1681e |
+ call_frame_t *frame = v_frame;
|
|
|
d1681e |
+ glusterd_conf_t *conf = frame->this->private;
|
|
|
d1681e |
+ glusterd_brickinfo_t *brickinfo = frame->local;
|
|
|
d1681e |
+ glusterd_brickinfo_t *other_brick = frame->cookie;
|
|
|
d1681e |
+ glusterd_volinfo_t *volinfo = NULL;
|
|
|
d1681e |
+ xlator_t *this = THIS;
|
|
|
d1681e |
+ int ret = -1;
|
|
|
d1681e |
+ char pidfile1[PATH_MAX] = {0};
|
|
|
d1681e |
+ char pidfile2[PATH_MAX] = {0};
|
|
|
d1681e |
+ gf_getspec_rsp rsp = {0,};
|
|
|
d1681e |
|
|
|
d1681e |
frame->local = NULL;
|
|
|
d1681e |
- brickinfo->port_registered = _gf_true;
|
|
|
d1681e |
+ frame->cookie = NULL;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_getspec_rsp);
|
|
|
d1681e |
+ if (ret < 0) {
|
|
|
d1681e |
+ gf_log (frame->this->name, GF_LOG_ERROR, "XDR decoding error");
|
|
|
d1681e |
+ ret = -1;
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+
|
|
|
d1681e |
+ ret = glusterd_get_volinfo_from_brick (other_brick->path,
|
|
|
d1681e |
+ &volinfo);
|
|
|
d1681e |
+ if (ret) {
|
|
|
d1681e |
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
+ GD_MSG_VOLINFO_GET_FAIL, "Failed to get volinfo"
|
|
|
d1681e |
+ " from brick(%s) so pidfile copying/unlink will fail",
|
|
|
d1681e |
+ other_brick->path);
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ GLUSTERD_GET_BRICK_PIDFILE (pidfile1, volinfo, other_brick, conf);
|
|
|
d1681e |
+ volinfo = NULL;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ ret = glusterd_get_volinfo_from_brick (brickinfo->path,
|
|
|
d1681e |
+ &volinfo);
|
|
|
d1681e |
+ if (ret) {
|
|
|
d1681e |
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
+ GD_MSG_VOLINFO_GET_FAIL, "Failed to get volinfo"
|
|
|
d1681e |
+ " from brick(%s) so pidfile copying/unlink will fail",
|
|
|
d1681e |
+ brickinfo->path);
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ GLUSTERD_GET_BRICK_PIDFILE (pidfile2, volinfo, brickinfo, conf);
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if (rsp.op_ret == 0) {
|
|
|
d1681e |
+ brickinfo->port_registered = _gf_true;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ /* PID file is copied once brick has attached
|
|
|
d1681e |
+ successfully
|
|
|
d1681e |
+ */
|
|
|
d1681e |
+ glusterd_copy_file (pidfile1, pidfile2);
|
|
|
d1681e |
+ brickinfo->status = GF_BRICK_STARTED;
|
|
|
d1681e |
+ brickinfo->rpc = rpc_clnt_ref (other_brick->rpc);
|
|
|
d1681e |
+ gf_log (THIS->name, GF_LOG_INFO, "brick %s is attached successfully",
|
|
|
d1681e |
+ brickinfo->path);
|
|
|
d1681e |
+ } else {
|
|
|
d1681e |
+ gf_log (THIS->name, GF_LOG_INFO, "attach_brick failed pidfile"
|
|
|
d1681e |
+ " is %s for brick_path %s", pidfile2, brickinfo->path);
|
|
|
d1681e |
+ brickinfo->port = 0;
|
|
|
d1681e |
+ brickinfo->status = GF_BRICK_STOPPED;
|
|
|
d1681e |
+ ret = glusterd_brick_process_remove_brick (brickinfo);
|
|
|
d1681e |
+ if (ret)
|
|
|
d1681e |
+ gf_msg_debug (this->name, 0, "Couldn't remove brick from"
|
|
|
d1681e |
+ " brick process");
|
|
|
d1681e |
+ LOCK (&volinfo->lock);
|
|
|
d1681e |
+ ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
d1681e |
+ UNLOCK (&volinfo->lock);
|
|
|
d1681e |
+ if (ret) {
|
|
|
d1681e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
+ GD_MSG_VOLINFO_SET_FAIL,
|
|
|
d1681e |
+ "Failed to store volinfo of "
|
|
|
d1681e |
+ "%s volume", volinfo->volname);
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+out:
|
|
|
d1681e |
synclock_lock (&conf->big_lock);
|
|
|
d1681e |
--(conf->blockers);
|
|
|
d1681e |
synclock_unlock (&conf->big_lock);
|
|
|
d1681e |
-
|
|
|
d1681e |
STACK_DESTROY (frame->root);
|
|
|
d1681e |
return 0;
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
send_attach_req (xlator_t *this, struct rpc_clnt *rpc, char *path,
|
|
|
d1681e |
- glusterd_brickinfo_t *brickinfo, int op)
|
|
|
d1681e |
+ glusterd_brickinfo_t *brickinfo, glusterd_brickinfo_t *other_brick, int op)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = -1;
|
|
|
d1681e |
struct iobuf *iobuf = NULL;
|
|
|
d1681e |
@@ -5516,6 +5584,7 @@ send_attach_req (xlator_t *this, struct rpc_clnt *rpc, char *path,
|
|
|
d1681e |
|
|
|
d1681e |
if (op == GLUSTERD_BRICK_ATTACH) {
|
|
|
d1681e |
frame->local = brickinfo;
|
|
|
d1681e |
+ frame->cookie = other_brick;
|
|
|
d1681e |
cbkfn = attach_brick_callback;
|
|
|
d1681e |
}
|
|
|
d1681e |
/* Send the msg */
|
|
|
d1681e |
@@ -5582,27 +5651,19 @@ attach_brick (xlator_t *this,
|
|
|
d1681e |
rpc = rpc_clnt_ref (other_brick->rpc);
|
|
|
d1681e |
if (rpc) {
|
|
|
d1681e |
ret = send_attach_req (this, rpc, path, brickinfo,
|
|
|
d1681e |
+ other_brick,
|
|
|
d1681e |
GLUSTERD_BRICK_ATTACH);
|
|
|
d1681e |
rpc_clnt_unref (rpc);
|
|
|
d1681e |
if (!ret) {
|
|
|
d1681e |
ret = pmap_registry_extend (this, other_brick->port,
|
|
|
d1681e |
- brickinfo->path);
|
|
|
d1681e |
+ brickinfo->path);
|
|
|
d1681e |
if (ret != 0) {
|
|
|
d1681e |
gf_log (this->name, GF_LOG_ERROR,
|
|
|
d1681e |
"adding brick to process failed");
|
|
|
d1681e |
- return ret;
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
}
|
|
|
d1681e |
-
|
|
|
d1681e |
- /* PID file is copied once brick has attached
|
|
|
d1681e |
- successfully
|
|
|
d1681e |
- */
|
|
|
d1681e |
- glusterd_copy_file (pidfile1, pidfile2);
|
|
|
d1681e |
brickinfo->port = other_brick->port;
|
|
|
d1681e |
- brickinfo->status = GF_BRICK_STARTED;
|
|
|
d1681e |
- brickinfo->rpc =
|
|
|
d1681e |
- rpc_clnt_ref (other_brick->rpc);
|
|
|
d1681e |
- ret = glusterd_brick_process_add_brick (brickinfo,
|
|
|
d1681e |
- volinfo);
|
|
|
d1681e |
+ ret = glusterd_brick_process_add_brick (brickinfo);
|
|
|
d1681e |
if (ret) {
|
|
|
d1681e |
gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
GD_MSG_BRICKPROC_ADD_BRICK_FAILED,
|
|
|
d1681e |
@@ -5611,29 +5672,23 @@ attach_brick (xlator_t *this,
|
|
|
d1681e |
brickinfo->path);
|
|
|
d1681e |
return ret;
|
|
|
d1681e |
}
|
|
|
d1681e |
-
|
|
|
d1681e |
- if (ret) {
|
|
|
d1681e |
- gf_msg_debug (this->name, 0, "Add brick"
|
|
|
d1681e |
- " to brick process failed");
|
|
|
d1681e |
- return ret;
|
|
|
d1681e |
- }
|
|
|
d1681e |
-
|
|
|
d1681e |
return 0;
|
|
|
d1681e |
}
|
|
|
d1681e |
}
|
|
|
d1681e |
/*
|
|
|
d1681e |
- * It might not actually be safe to manipulate the lock like
|
|
|
d1681e |
- * this, but if we don't then the connection can never actually
|
|
|
d1681e |
- * complete and retries are useless. Unfortunately, all of the
|
|
|
d1681e |
- * alternatives (e.g. doing all of this in a separate thread)
|
|
|
d1681e |
- * are much more complicated and risky. TBD: see if there's a
|
|
|
d1681e |
- * better way
|
|
|
d1681e |
+ * It might not actually be safe to manipulate the lock
|
|
|
d1681e |
+ * like this, but if we don't then the connection can
|
|
|
d1681e |
+ * never actually complete and retries are useless.
|
|
|
d1681e |
+ * Unfortunately, all of the alternatives (e.g. doing
|
|
|
d1681e |
+ * all of this in a separate thread) are much more
|
|
|
d1681e |
+ * complicated and risky.
|
|
|
d1681e |
+ * TBD: see if there's a better way
|
|
|
d1681e |
*/
|
|
|
d1681e |
synclock_unlock (&conf->big_lock);
|
|
|
d1681e |
sleep (1);
|
|
|
d1681e |
synclock_lock (&conf->big_lock);
|
|
|
d1681e |
}
|
|
|
d1681e |
-
|
|
|
d1681e |
+out:
|
|
|
d1681e |
gf_log (this->name, GF_LOG_WARNING,
|
|
|
d1681e |
"attach failed for %s", brickinfo->path);
|
|
|
d1681e |
return ret;
|
|
|
d1681e |
@@ -5855,6 +5910,7 @@ find_compatible_brick (glusterd_conf_t *conf,
|
|
|
d1681e |
return NULL;
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
+
|
|
|
d1681e |
/* Below function is use to populate sockpath based on passed pid
|
|
|
d1681e |
value as a argument after check the value from proc and also
|
|
|
d1681e |
check if passed pid is match with running glusterfs process
|
|
|
d1681e |
@@ -5941,6 +5997,62 @@ glusterd_get_sock_from_brick_pid (int pid, char *sockpath, size_t len)
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
|
|
|
d1681e |
+char *
|
|
|
d1681e |
+search_brick_path_from_proc (pid_t brick_pid, char *brickpath)
|
|
|
d1681e |
+{
|
|
|
d1681e |
+ struct dirent *dp = NULL;
|
|
|
d1681e |
+ DIR *dirp = NULL;
|
|
|
d1681e |
+ size_t len = 0;
|
|
|
d1681e |
+ int fd = -1;
|
|
|
d1681e |
+ char path[PATH_MAX] = {0,};
|
|
|
d1681e |
+ char sym[PATH_MAX] = {0,};
|
|
|
d1681e |
+ struct dirent scratch[2] = {{0,},};
|
|
|
d1681e |
+ char *brick_path = NULL;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if (!brickpath)
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ sprintf(path, "/proc/%d/fd/", brick_pid);
|
|
|
d1681e |
+ dirp = sys_opendir (path);
|
|
|
d1681e |
+ if (!dirp)
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ len = strlen (path);
|
|
|
d1681e |
+ if (len >= (sizeof(path) - 2))
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ fd = dirfd (dirp);
|
|
|
d1681e |
+ if (fd < 0)
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ memset(path, 0, sizeof(path));
|
|
|
d1681e |
+ memset(sym, 0, sizeof(sym));
|
|
|
d1681e |
+
|
|
|
d1681e |
+ while ((dp = sys_readdir(dirp, scratch))) {
|
|
|
d1681e |
+ if (!strcmp(dp->d_name, ".") ||
|
|
|
d1681e |
+ !strcmp(dp->d_name, ".."))
|
|
|
d1681e |
+ continue;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ /* check for non numerical descriptors */
|
|
|
d1681e |
+ if (!strtol(dp->d_name, (char **)NULL, 10))
|
|
|
d1681e |
+ continue;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ len = readlinkat (fd, dp->d_name, sym, sizeof(sym) - 1);
|
|
|
d1681e |
+ if (len > 1) {
|
|
|
d1681e |
+ sym[len] = '\0';
|
|
|
d1681e |
+ if (!strcmp (sym, brickpath)) {
|
|
|
d1681e |
+ brick_path = gf_strdup(sym);
|
|
|
d1681e |
+ break;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ memset (sym, 0, sizeof (sym));
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+out:
|
|
|
d1681e |
+ sys_closedir(dirp);
|
|
|
d1681e |
+ return brick_path;
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
+
|
|
|
d1681e |
int
|
|
|
d1681e |
glusterd_brick_start (glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
glusterd_brickinfo_t *brickinfo,
|
|
|
d1681e |
@@ -5954,7 +6066,9 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
int32_t pid = -1;
|
|
|
d1681e |
char pidfile[PATH_MAX] = {0};
|
|
|
d1681e |
char socketpath[PATH_MAX] = {0};
|
|
|
d1681e |
+ char *brickpath = NULL;
|
|
|
d1681e |
glusterd_volinfo_t *other_vol;
|
|
|
d1681e |
+ struct statvfs brickstat = {0,};
|
|
|
d1681e |
|
|
|
d1681e |
this = THIS;
|
|
|
d1681e |
GF_ASSERT (this);
|
|
|
d1681e |
@@ -6000,6 +6114,28 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
brickinfo->start_triggered = _gf_true;
|
|
|
d1681e |
|
|
|
d1681e |
GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, conf);
|
|
|
d1681e |
+
|
|
|
d1681e |
+ ret = sys_statvfs (brickinfo->path, &brickstat);
|
|
|
d1681e |
+ if (ret) {
|
|
|
d1681e |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
d1681e |
+ errno, GD_MSG_BRICKINFO_CREATE_FAIL,
|
|
|
d1681e |
+ "failed to get statfs() call on brick %s",
|
|
|
d1681e |
+ brickinfo->path);
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+
|
|
|
d1681e |
+ /* Compare fsid is helpful to ensure the existence of a brick_root
|
|
|
d1681e |
+ path before the start/attach a brick
|
|
|
d1681e |
+ */
|
|
|
d1681e |
+ if (brickinfo->statfs_fsid &&
|
|
|
d1681e |
+ (brickinfo->statfs_fsid != brickstat.f_fsid)) {
|
|
|
d1681e |
+ gf_log (this->name, GF_LOG_ERROR,
|
|
|
d1681e |
+ "fsid comparison is failed it means Brick root path"
|
|
|
d1681e |
+ " %s is not created by glusterd, start/attach will also fail",
|
|
|
d1681e |
+ brickinfo->path);
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+
|
|
|
d1681e |
if (gf_is_service_running (pidfile, &pid)) {
|
|
|
d1681e |
if (brickinfo->status != GF_BRICK_STARTING &&
|
|
|
d1681e |
brickinfo->status != GF_BRICK_STARTED) {
|
|
|
d1681e |
@@ -6019,12 +6155,29 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
* TBD: re-use RPC connection across bricks
|
|
|
d1681e |
*/
|
|
|
d1681e |
if (is_brick_mx_enabled ()) {
|
|
|
d1681e |
+ brickpath = search_brick_path_from_proc (pid, brickinfo->path);
|
|
|
d1681e |
+ if (!brickpath) {
|
|
|
d1681e |
+ gf_log (this->name, GF_LOG_INFO,
|
|
|
d1681e |
+ "Either pid %d is not running or brick"
|
|
|
d1681e |
+ " path %s is not consumed so cleanup pidfile",
|
|
|
d1681e |
+ pid, brickinfo->path);
|
|
|
d1681e |
+ /* search brick is failed so unlink pidfile */
|
|
|
d1681e |
+ if (sys_access (pidfile , R_OK) == 0) {
|
|
|
d1681e |
+ sys_unlink (pidfile);
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ goto run;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ GF_FREE (brickpath);
|
|
|
d1681e |
ret = glusterd_get_sock_from_brick_pid (pid, socketpath,
|
|
|
d1681e |
sizeof(socketpath));
|
|
|
d1681e |
if (ret) {
|
|
|
d1681e |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
d1681e |
+ gf_log (this->name, GF_LOG_INFO,
|
|
|
d1681e |
"Either pid %d is not running or is not match"
|
|
|
d1681e |
" with any running brick process ", pid);
|
|
|
d1681e |
+ /* Fetch unix socket is failed so unlink pidfile */
|
|
|
d1681e |
+ if (sys_access (pidfile , R_OK) == 0) {
|
|
|
d1681e |
+ sys_unlink (pidfile);
|
|
|
d1681e |
+ }
|
|
|
d1681e |
goto run;
|
|
|
d1681e |
}
|
|
|
d1681e |
} else {
|
|
|
d1681e |
@@ -6039,7 +6192,7 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
(void) glusterd_brick_connect (volinfo, brickinfo,
|
|
|
d1681e |
socketpath);
|
|
|
d1681e |
|
|
|
d1681e |
- ret = glusterd_brick_process_add_brick (brickinfo, volinfo);
|
|
|
d1681e |
+ ret = glusterd_brick_process_add_brick (brickinfo);
|
|
|
d1681e |
if (ret) {
|
|
|
d1681e |
gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
GD_MSG_BRICKPROC_ADD_BRICK_FAILED,
|
|
|
d1681e |
@@ -6079,6 +6232,10 @@ run:
|
|
|
d1681e |
if (ret == 0) {
|
|
|
d1681e |
goto out;
|
|
|
d1681e |
}
|
|
|
d1681e |
+ /* Attach_brick is failed so unlink pidfile */
|
|
|
d1681e |
+ if (sys_access (pidfile , R_OK) == 0) {
|
|
|
d1681e |
+ sys_unlink (pidfile);
|
|
|
d1681e |
+ }
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
/*
|
|
|
d1681e |
@@ -7063,14 +7220,15 @@ glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
dict_t *dict, int32_t count)
|
|
|
d1681e |
{
|
|
|
d1681e |
|
|
|
d1681e |
- int ret = -1;
|
|
|
d1681e |
- int32_t pid = -1;
|
|
|
d1681e |
- char key[1024] = {0};
|
|
|
d1681e |
- char base_key[1024] = {0};
|
|
|
d1681e |
- char pidfile[PATH_MAX] = {0};
|
|
|
d1681e |
+ int ret = -1;
|
|
|
d1681e |
+ int32_t pid = -1;
|
|
|
d1681e |
+ char key[1024] = {0};
|
|
|
d1681e |
+ char base_key[1024] = {0};
|
|
|
d1681e |
+ char pidfile[PATH_MAX] = {0};
|
|
|
d1681e |
xlator_t *this = NULL;
|
|
|
d1681e |
glusterd_conf_t *priv = NULL;
|
|
|
d1681e |
- gf_boolean_t brick_online = _gf_false;
|
|
|
d1681e |
+ gf_boolean_t brick_online = _gf_false;
|
|
|
d1681e |
+ char *brickpath = NULL;
|
|
|
d1681e |
|
|
|
d1681e |
GF_ASSERT (volinfo);
|
|
|
d1681e |
GF_ASSERT (brickinfo);
|
|
|
d1681e |
@@ -7127,7 +7285,20 @@ glusterd_add_brick_to_dict (glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
if (glusterd_is_brick_started (brickinfo)) {
|
|
|
d1681e |
if (gf_is_service_running (pidfile, &pid) &&
|
|
|
d1681e |
brickinfo->port_registered) {
|
|
|
d1681e |
- brick_online = _gf_true;
|
|
|
d1681e |
+ if (!is_brick_mx_enabled ()) {
|
|
|
d1681e |
+ brick_online = _gf_true;
|
|
|
d1681e |
+ } else {
|
|
|
d1681e |
+ brickpath = search_brick_path_from_proc (pid, brickinfo->path);
|
|
|
d1681e |
+ if (!brickpath) {
|
|
|
d1681e |
+ gf_log (this->name, GF_LOG_INFO,
|
|
|
d1681e |
+ "brick path %s is not consumed",
|
|
|
d1681e |
+ brickinfo->path);
|
|
|
d1681e |
+ brick_online = _gf_false;
|
|
|
d1681e |
+ } else {
|
|
|
d1681e |
+ brick_online = _gf_true;
|
|
|
d1681e |
+ GF_FREE (brickpath);
|
|
|
d1681e |
+ }
|
|
|
d1681e |
+ }
|
|
|
d1681e |
} else {
|
|
|
d1681e |
pid = -1;
|
|
|
d1681e |
}
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
|
|
|
d1681e |
index 4c9561e..4835728 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
|
|
|
d1681e |
@@ -179,8 +179,7 @@ int32_t
|
|
|
d1681e |
glusterd_resolve_brick (glusterd_brickinfo_t *brickinfo);
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
-glusterd_brick_process_add_brick (glusterd_brickinfo_t *brickinfo,
|
|
|
d1681e |
- glusterd_volinfo_t *volinfo);
|
|
|
d1681e |
+glusterd_brick_process_add_brick (glusterd_brickinfo_t *brickinfo);
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
glusterd_brick_process_remove_brick (glusterd_brickinfo_t *brickinfo);
|
|
|
d1681e |
@@ -200,7 +199,8 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,
|
|
|
d1681e |
|
|
|
d1681e |
int
|
|
|
d1681e |
send_attach_req (xlator_t *this, struct rpc_clnt *rpc, char *path,
|
|
|
d1681e |
- glusterd_brickinfo_t *brick, int op);
|
|
|
d1681e |
+ glusterd_brickinfo_t *brick,
|
|
|
d1681e |
+ glusterd_brickinfo_t *other_brick, int op);
|
|
|
d1681e |
|
|
|
d1681e |
glusterd_volinfo_t *
|
|
|
d1681e |
glusterd_volinfo_ref (glusterd_volinfo_t *volinfo);
|
|
|
d1681e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
d1681e |
index e34d58a..8bb0b6d 100644
|
|
|
d1681e |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
d1681e |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
d1681e |
@@ -2585,8 +2585,13 @@ glusterd_start_volume (glusterd_volinfo_t *volinfo, int flags,
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
glusterd_set_volume_status (volinfo, GLUSTERD_STATUS_STARTED);
|
|
|
d1681e |
-
|
|
|
d1681e |
+ /* Update volinfo on disk in critical section because
|
|
|
d1681e |
+ attach_brick_callback can also call store_volinfo for same
|
|
|
d1681e |
+ volume to update volinfo on disk
|
|
|
d1681e |
+ */
|
|
|
d1681e |
+ LOCK (&volinfo->lock);
|
|
|
d1681e |
ret = glusterd_store_volinfo (volinfo, verincrement);
|
|
|
d1681e |
+ UNLOCK (&volinfo->lock);
|
|
|
d1681e |
if (ret) {
|
|
|
d1681e |
gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
d1681e |
GD_MSG_VOLINFO_SET_FAIL,
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|