Commit 90fa1527bddc7147dc0d590ee6184ca88bc50ecf

Authored by Mikulas Patocka
Committed by Alasdair G Kergon
1 parent a1b51e9867

dm snapshot: change yield to msleep

Change yield() to msleep(1). If the thread had realtime priority,
yield() doesn't really yield, so the yielding process would loop
indefinitely and cause machine lockup.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff

drivers/md/dm-snap.c
... ... @@ -9,6 +9,7 @@
9 9 #include <linux/blkdev.h>
10 10 #include <linux/ctype.h>
11 11 #include <linux/device-mapper.h>
  12 +#include <linux/delay.h>
12 13 #include <linux/fs.h>
13 14 #include <linux/init.h>
14 15 #include <linux/kdev_t.h>
... ... @@ -735,7 +736,7 @@
735 736 unregister_snapshot(s);
736 737  
737 738 while (atomic_read(&s->pending_exceptions_count))
738   - yield();
  739 + msleep(1);
739 740 /*
740 741 * Ensure instructions in mempool_destroy aren't reordered
741 742 * before atomic_read.
742 743  
... ... @@ -888,10 +889,10 @@
888 889  
889 890 /*
890 891 * Check for conflicting reads. This is extremely improbable,
891   - * so yield() is sufficient and there is no need for a wait queue.
  892 + * so msleep(1) is sufficient and there is no need for a wait queue.
892 893 */
893 894 while (__chunk_is_tracked(s, pe->e.old_chunk))
894   - yield();
  895 + msleep(1);
895 896  
896 897 /*
897 898 * Add a proper exception, and remove the