Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345719
b: refs/heads/master
c: e77a0a5
h: refs/heads/master
i:
  345717: 2a257cc
  345715: 5cb0860
  345711: 37b4f27
v: v3
  • Loading branch information
Andreas Gruenbacher authored and Philipp Reisner committed Aug 29, 2011
1 parent 6116d8e commit 5d131b1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8554df1c6d3bb7686b39ed775772f507fa857c19
refs/heads/master: e77a0a5cc1e6961f485b5623ef42f3b910969675
8 changes: 4 additions & 4 deletions trunk/drivers/block/drbd/drbd_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,10 @@ union p_polymorph {

/**********************************************************************/
enum drbd_thread_state {
None,
Running,
Exiting,
Restarting
NONE,
RUNNING,
EXITING,
RESTARTING
};

struct drbd_thread {
Expand Down
38 changes: 19 additions & 19 deletions trunk/drivers/block/drbd/drbd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1627,25 +1627,25 @@ static int drbd_thread_setup(void *arg)

spin_lock_irqsave(&thi->t_lock, flags);

/* if the receiver has been "Exiting", the last thing it did
/* if the receiver has been "EXITING", the last thing it did
* was set the conn state to "StandAlone",
* if now a re-connect request comes in, conn state goes C_UNCONNECTED,
* and receiver thread will be "started".
* drbd_thread_start needs to set "Restarting" in that case.
* drbd_thread_start needs to set "RESTARTING" in that case.
* t_state check and assignment needs to be within the same spinlock,
* so either thread_start sees Exiting, and can remap to Restarting,
* or thread_start see None, and can proceed as normal.
* so either thread_start sees EXITING, and can remap to RESTARTING,
* or thread_start see NONE, and can proceed as normal.
*/

if (thi->t_state == Restarting) {
if (thi->t_state == RESTARTING) {
dev_info(DEV, "Restarting %s\n", current->comm);
thi->t_state = Running;
thi->t_state = RUNNING;
spin_unlock_irqrestore(&thi->t_lock, flags);
goto restart;
}

thi->task = NULL;
thi->t_state = None;
thi->t_state = NONE;
smp_mb();
complete(&thi->stop);
spin_unlock_irqrestore(&thi->t_lock, flags);
Expand All @@ -1662,7 +1662,7 @@ static void drbd_thread_init(struct drbd_conf *mdev, struct drbd_thread *thi,
{
spin_lock_init(&thi->t_lock);
thi->task = NULL;
thi->t_state = None;
thi->t_state = NONE;
thi->function = func;
thi->mdev = mdev;
}
Expand All @@ -1683,7 +1683,7 @@ int drbd_thread_start(struct drbd_thread *thi)
spin_lock_irqsave(&thi->t_lock, flags);

switch (thi->t_state) {
case None:
case NONE:
dev_info(DEV, "Starting %s thread (from %s [%d])\n",
me, current->comm, current->pid);

Expand All @@ -1697,7 +1697,7 @@ int drbd_thread_start(struct drbd_thread *thi)
init_completion(&thi->stop);
D_ASSERT(thi->task == NULL);
thi->reset_cpu_mask = 1;
thi->t_state = Running;
thi->t_state = RUNNING;
spin_unlock_irqrestore(&thi->t_lock, flags);
flush_signals(current); /* otherw. may get -ERESTARTNOINTR */

Expand All @@ -1712,17 +1712,17 @@ int drbd_thread_start(struct drbd_thread *thi)
}
spin_lock_irqsave(&thi->t_lock, flags);
thi->task = nt;
thi->t_state = Running;
thi->t_state = RUNNING;
spin_unlock_irqrestore(&thi->t_lock, flags);
wake_up_process(nt);
break;
case Exiting:
thi->t_state = Restarting;
case EXITING:
thi->t_state = RESTARTING;
dev_info(DEV, "Restarting %s thread (from %s [%d])\n",
me, current->comm, current->pid);
/* fall through */
case Running:
case Restarting:
case RUNNING:
case RESTARTING:
default:
spin_unlock_irqrestore(&thi->t_lock, flags);
break;
Expand All @@ -1736,12 +1736,12 @@ void _drbd_thread_stop(struct drbd_thread *thi, int restart, int wait)
{
unsigned long flags;

enum drbd_thread_state ns = restart ? Restarting : Exiting;
enum drbd_thread_state ns = restart ? RESTARTING : EXITING;

/* may be called from state engine, holding the req lock irqsave */
spin_lock_irqsave(&thi->t_lock, flags);

if (thi->t_state == None) {
if (thi->t_state == NONE) {
spin_unlock_irqrestore(&thi->t_lock, flags);
if (restart)
drbd_thread_start(thi);
Expand Down Expand Up @@ -2504,7 +2504,7 @@ static int we_should_drop_the_connection(struct drbd_conf *mdev, struct socket *

drop_it = mdev->meta.socket == sock
|| !mdev->asender.task
|| get_t_state(&mdev->asender) != Running
|| get_t_state(&mdev->asender) != RUNNING
|| mdev->state.conn < C_CONNECTED;

if (drop_it)
Expand Down Expand Up @@ -3046,7 +3046,7 @@ void drbd_init_set_defaults(struct drbd_conf *mdev)
void drbd_mdev_cleanup(struct drbd_conf *mdev)
{
int i;
if (mdev->receiver.t_state != None)
if (mdev->receiver.t_state != NONE)
dev_err(DEV, "ASSERT FAILED: receiver t_state == %d expected 0.\n",
mdev->receiver.t_state);

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/drbd/drbd_receiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ static int drbd_connect(struct drbd_conf *mdev)
if (signal_pending(current)) {
flush_signals(current);
smp_rmb();
if (get_t_state(&mdev->receiver) == Exiting)
if (get_t_state(&mdev->receiver) == EXITING)
goto out_release_sockets;
}

Expand Down Expand Up @@ -3700,7 +3700,7 @@ static void drbdd(struct drbd_conf *mdev)
size_t shs; /* sub header size */
int rv;

while (get_t_state(&mdev->receiver) == Running) {
while (get_t_state(&mdev->receiver) == RUNNING) {
drbd_thread_current_set_cpu(mdev);
if (!drbd_recv_header(mdev, &cmd, &packet_size))
goto err_out;
Expand Down Expand Up @@ -4490,7 +4490,7 @@ int drbd_asender(struct drbd_thread *thi)
current->policy = SCHED_RR; /* Make this a realtime task! */
current->rt_priority = 2; /* more important than all other tasks */

while (get_t_state(thi) == Running) {
while (get_t_state(thi) == RUNNING) {
drbd_thread_current_set_cpu(mdev);
if (test_and_clear_bit(SEND_PING, &mdev->flags)) {
ERR_IF(!drbd_send_ping(mdev)) goto reconnect;
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/block/drbd/drbd_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ int drbd_worker(struct drbd_thread *thi)

sprintf(current->comm, "drbd%d_worker", mdev_to_minor(mdev));

while (get_t_state(thi) == Running) {
while (get_t_state(thi) == RUNNING) {
drbd_thread_current_set_cpu(mdev);

if (down_trylock(&mdev->data.work.s)) {
Expand All @@ -1637,12 +1637,12 @@ int drbd_worker(struct drbd_thread *thi)
if (intr) {
D_ASSERT(intr == -EINTR);
flush_signals(current);
ERR_IF (get_t_state(thi) == Running)
ERR_IF (get_t_state(thi) == RUNNING)
continue;
break;
}

if (get_t_state(thi) != Running)
if (get_t_state(thi) != RUNNING)
break;
/* With this break, we have done a down() but not consumed
the entry from the list. The cleanup code takes care of
Expand Down Expand Up @@ -1704,7 +1704,7 @@ int drbd_worker(struct drbd_thread *thi)

D_ASSERT(mdev->state.disk == D_DISKLESS && mdev->state.conn == C_STANDALONE);
/* _drbd_set_state only uses stop_nowait.
* wait here for the Exiting receiver. */
* wait here for the EXITING receiver. */
drbd_thread_stop(&mdev->receiver);
drbd_mdev_cleanup(mdev);

Expand Down

0 comments on commit 5d131b1

Please sign in to comment.