diff mbox series

[v2,1/3] btrfs: make buffered write to respect fatal signals

Message ID f99ababba49b98b258254fe09a505d4613faa60f.1731396107.git.wqu@suse.com (mailing list archive)
State New
Headers show
Series btrfs: btrfs_buffered_write() cleanups | expand

Commit Message

Qu Wenruo Nov. 12, 2024, 7:23 a.m. UTC
This is to follow the behavior of iomap_write_iter() which calls
iomap_write_begin() to check the fatal signals.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/file.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 10d51c8dd360..a0fa8c36a224 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1142,6 +1142,10 @@  ssize_t btrfs_buffered_write(struct kiocb *iocb, struct iov_iter *i)
 			ret = -EFAULT;
 			break;
 		}
+		if (fatal_signal_pending(current)) {
+			ret = -EINTR;
+			break;
+		}
 
 		only_release_metadata = false;
 		sector_offset = pos & (fs_info->sectorsize - 1);