Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

David Howells and committed by
David S. Miller
47051a21 1a028e50

+8 -9
+8 -9
fs/afs/vlocation.c
··· 416 416 goto error_abandon; 417 417 spin_lock(&vl->lock); 418 418 vl->state = AFS_VL_VALID; 419 - wake_up(&vl->waitq); 420 419 spin_unlock(&vl->lock); 420 + wake_up(&vl->waitq); 421 421 422 422 /* schedule for regular updates */ 423 423 afs_vlocation_queue_for_updates(vl); ··· 442 442 443 443 _debug("invalid [state %d]", state); 444 444 445 - if ((state == AFS_VL_NEW || state == AFS_VL_NO_VOLUME)) { 445 + if (state == AFS_VL_NEW || state == AFS_VL_NO_VOLUME) { 446 446 vl->state = AFS_VL_CREATING; 447 447 spin_unlock(&vl->lock); 448 448 goto fill_in_record; ··· 453 453 _debug("wait"); 454 454 455 455 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); 461 460 if (ret < 0) 462 461 goto error; 463 462 spin_lock(&vl->lock); ··· 470 471 error_abandon: 471 472 spin_lock(&vl->lock); 472 473 vl->state = AFS_VL_NEW; 473 - wake_up(&vl->waitq); 474 474 spin_unlock(&vl->lock); 475 + wake_up(&vl->waitq); 475 476 error: 476 477 ASSERT(vl != NULL); 477 478 afs_put_vlocation(vl); ··· 674 675 case 0: 675 676 afs_vlocation_apply_update(vl, &vldb); 676 677 vl->state = AFS_VL_VALID; 677 - wake_up(&vl->waitq); 678 678 break; 679 679 case -ENOMEDIUM: 680 680 vl->state = AFS_VL_VOLUME_DELETED; ··· 683 685 break; 684 686 } 685 687 spin_unlock(&vl->lock); 688 + wake_up(&vl->waitq); 686 689 687 690 /* and then reschedule */ 688 691 _debug("reschedule");