Skip to content

Commit

Permalink
[AFS]: Fix VLocation record update wakeup
Browse files Browse the repository at this point in the history
Fix the wakeup transitions after a VLocation record update completes
one way or another.  This builds on Dave Miller's partial fix.

Also move wakeups outside the spinlocked sections.

Signed-off-by: David Howells <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
dhowells authored and davem330 committed Apr 27, 2007
1 parent 1a028e5 commit 47051a2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions fs/afs/vlocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ struct afs_vlocation *afs_vlocation_lookup(struct afs_cell *cell,
goto error_abandon;
spin_lock(&vl->lock);
vl->state = AFS_VL_VALID;
wake_up(&vl->waitq);
spin_unlock(&vl->lock);
wake_up(&vl->waitq);

/* schedule for regular updates */
afs_vlocation_queue_for_updates(vl);
Expand All @@ -442,7 +442,7 @@ struct afs_vlocation *afs_vlocation_lookup(struct afs_cell *cell,

_debug("invalid [state %d]", state);

if ((state == AFS_VL_NEW || state == AFS_VL_NO_VOLUME)) {
if (state == AFS_VL_NEW || state == AFS_VL_NO_VOLUME) {
vl->state = AFS_VL_CREATING;
spin_unlock(&vl->lock);
goto fill_in_record;
Expand All @@ -453,11 +453,10 @@ struct afs_vlocation *afs_vlocation_lookup(struct afs_cell *cell,
_debug("wait");

spin_unlock(&vl->lock);
ret = wait_event_interruptible(
vl->waitq,
vl->state == AFS_VL_NEW ||
vl->state == AFS_VL_VALID ||
vl->state == AFS_VL_NO_VOLUME);
ret = wait_event_interruptible(vl->waitq,
vl->state == AFS_VL_NEW ||
vl->state == AFS_VL_VALID ||
vl->state == AFS_VL_NO_VOLUME);
if (ret < 0)
goto error;
spin_lock(&vl->lock);
Expand All @@ -471,8 +470,8 @@ struct afs_vlocation *afs_vlocation_lookup(struct afs_cell *cell,
error_abandon:
spin_lock(&vl->lock);
vl->state = AFS_VL_NEW;
wake_up(&vl->waitq);
spin_unlock(&vl->lock);
wake_up(&vl->waitq);
error:
ASSERT(vl != NULL);
afs_put_vlocation(vl);
Expand Down Expand Up @@ -675,7 +674,6 @@ static void afs_vlocation_updater(struct work_struct *work)
case 0:
afs_vlocation_apply_update(vl, &vldb);
vl->state = AFS_VL_VALID;
wake_up(&vl->waitq);
break;
case -ENOMEDIUM:
vl->state = AFS_VL_VOLUME_DELETED;
Expand All @@ -685,6 +683,7 @@ static void afs_vlocation_updater(struct work_struct *work)
break;
}
spin_unlock(&vl->lock);
wake_up(&vl->waitq);

/* and then reschedule */
_debug("reschedule");
Expand Down

0 comments on commit 47051a2

Please sign in to comment.