Skip to content

Commit 47051a2

Browse files
dhowellsdavem330
authored andcommitted
[AFS]: Fix VLocation record update wakeup
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 <dhowells@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1a028e5 commit 47051a2

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

‎fs/afs/vlocation.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ struct afs_vlocation *afs_vlocation_lookup(struct afs_cell *cell,
416416
goto error_abandon;
417417
spin_lock(&vl->lock);
418418
vl->state = AFS_VL_VALID;
419-
wake_up(&vl->waitq);
420419
spin_unlock(&vl->lock);
420+
wake_up(&vl->waitq);
421421

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

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

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

455455
spin_unlock(&vl->lock);
456-
ret = wait_event_interruptible(
457-
vl->waitq,
458-
vl->state == AFS_VL_NEW ||
459-
vl->state == AFS_VL_VALID ||
460-
vl->state == AFS_VL_NO_VOLUME);
456+
ret = wait_event_interruptible(vl->waitq,
457+
vl->state == AFS_VL_NEW ||
458+
vl->state == AFS_VL_VALID ||
459+
vl->state == AFS_VL_NO_VOLUME);
461460
if (ret < 0)
462461
goto error;
463462
spin_lock(&vl->lock);
@@ -471,8 +470,8 @@ struct afs_vlocation *afs_vlocation_lookup(struct afs_cell *cell,
471470
error_abandon:
472471
spin_lock(&vl->lock);
473472
vl->state = AFS_VL_NEW;
474-
wake_up(&vl->waitq);
475473
spin_unlock(&vl->lock);
474+
wake_up(&vl->waitq);
476475
error:
477476
ASSERT(vl != NULL);
478477
afs_put_vlocation(vl);
@@ -675,7 +674,6 @@ static void afs_vlocation_updater(struct work_struct *work)
675674
case 0:
676675
afs_vlocation_apply_update(vl, &vldb);
677676
vl->state = AFS_VL_VALID;
678-
wake_up(&vl->waitq);
679677
break;
680678
case -ENOMEDIUM:
681679
vl->state = AFS_VL_VOLUME_DELETED;
@@ -685,6 +683,7 @@ static void afs_vlocation_updater(struct work_struct *work)
685683
break;
686684
}
687685
spin_unlock(&vl->lock);
686+
wake_up(&vl->waitq);
688687

689688
/* and then reschedule */
690689
_debug("reschedule");

0 commit comments

Comments
 (0)