Commit 088bd41
btrfs: handle user interrupt properly in btrfs_trim_fs()
When a fatal signal is pending or the process is freezing,
btrfs_trim_block_group() and btrfs_trim_free_extents() return -ERESTARTSYS.
Currently this is treated as a regular error: the loops continue to the
next iteration and count it as a block group or device failure.
Instead, break out of the loops immediately and return -ERESTARTSYS to
userspace without counting it as a failure. Also skip the device loop
entirely if the block group loop was interrupted.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Robbie Ko <robbieko@synology.com>
Signed-off-by: jinbaohong <jinbaohong@synology.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>1 parent 4bef0f5 commit 088bd41
1 file changed
+11
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6665 | 6665 | | |
6666 | 6666 | | |
6667 | 6667 | | |
| 6668 | + | |
| 6669 | + | |
| 6670 | + | |
| 6671 | + | |
6668 | 6672 | | |
6669 | 6673 | | |
6670 | 6674 | | |
| |||
6679 | 6683 | | |
6680 | 6684 | | |
6681 | 6685 | | |
| 6686 | + | |
| 6687 | + | |
| 6688 | + | |
6682 | 6689 | | |
6683 | 6690 | | |
6684 | 6691 | | |
| |||
6687 | 6694 | | |
6688 | 6695 | | |
6689 | 6696 | | |
| 6697 | + | |
| 6698 | + | |
6690 | 6699 | | |
6691 | 6700 | | |
6692 | 6701 | | |
| |||
6701 | 6710 | | |
6702 | 6711 | | |
6703 | 6712 | | |
| 6713 | + | |
| 6714 | + | |
6704 | 6715 | | |
6705 | 6716 | | |
6706 | 6717 | | |
| |||
0 commit comments