| .. | .. |
|---|
| 985 | 985 | if (get_cache_mode(cache) >= CM_READ_ONLY) |
|---|
| 986 | 986 | return; |
|---|
| 987 | 987 | |
|---|
| 988 | | - if (dm_cache_metadata_set_needs_check(cache->cmd)) { |
|---|
| 989 | | - DMERR("%s: failed to set 'needs_check' flag in metadata", dev_name); |
|---|
| 990 | | - set_cache_mode(cache, CM_FAIL); |
|---|
| 991 | | - } |
|---|
| 992 | | - |
|---|
| 993 | 988 | DMERR_LIMIT("%s: aborting current metadata transaction", dev_name); |
|---|
| 994 | 989 | if (dm_cache_metadata_abort(cache->cmd)) { |
|---|
| 995 | 990 | DMERR("%s: failed to abort metadata transaction", dev_name); |
|---|
| 991 | + set_cache_mode(cache, CM_FAIL); |
|---|
| 992 | + } |
|---|
| 993 | + |
|---|
| 994 | + if (dm_cache_metadata_set_needs_check(cache->cmd)) { |
|---|
| 995 | + DMERR("%s: failed to set 'needs_check' flag in metadata", dev_name); |
|---|
| 996 | 996 | set_cache_mode(cache, CM_FAIL); |
|---|
| 997 | 997 | } |
|---|
| 998 | 998 | } |
|---|
| .. | .. |
|---|
| 1883 | 1883 | |
|---|
| 1884 | 1884 | else |
|---|
| 1885 | 1885 | commit_needed = process_bio(cache, bio) || commit_needed; |
|---|
| 1886 | + cond_resched(); |
|---|
| 1886 | 1887 | } |
|---|
| 1887 | 1888 | |
|---|
| 1888 | 1889 | if (commit_needed) |
|---|
| .. | .. |
|---|
| 1905 | 1906 | while ((bio = bio_list_pop(&bios))) { |
|---|
| 1906 | 1907 | bio->bi_status = BLK_STS_DM_REQUEUE; |
|---|
| 1907 | 1908 | bio_endio(bio); |
|---|
| 1909 | + cond_resched(); |
|---|
| 1908 | 1910 | } |
|---|
| 1909 | 1911 | } |
|---|
| 1910 | 1912 | |
|---|
| .. | .. |
|---|
| 1945 | 1947 | r = mg_start(cache, op, NULL); |
|---|
| 1946 | 1948 | if (r) |
|---|
| 1947 | 1949 | break; |
|---|
| 1950 | + |
|---|
| 1951 | + cond_resched(); |
|---|
| 1948 | 1952 | } |
|---|
| 1949 | 1953 | } |
|---|
| 1950 | 1954 | |
|---|
| .. | .. |
|---|
| 1965 | 1969 | if (cache->prison) |
|---|
| 1966 | 1970 | dm_bio_prison_destroy_v2(cache->prison); |
|---|
| 1967 | 1971 | |
|---|
| 1972 | + cancel_delayed_work_sync(&cache->waker); |
|---|
| 1968 | 1973 | if (cache->wq) |
|---|
| 1969 | 1974 | destroy_workqueue(cache->wq); |
|---|
| 1970 | 1975 | |
|---|