[Devel,PATCH:vz7] ext4: fix seek_data soft lookup on sparse files

Submitted by Dmitry Monakhov on Feb. 25, 2017, 12:20 p.m.

Details

Message ID 1488025215-27123-1-git-send-email-dmonakhov@openvz.org
State New
Series "ext4: fix seek_data soft lookup on sparse files"
Headers show

Commit Message

Dmitry Monakhov Feb. 25, 2017, 12:20 p.m.
Good fix requires optimal implementation of next_extent like it was
done in 14516bb or 2d90c160, but this makes patch huge, let's
just break the loop when necessery.

https://jira.sw.ru/browse/PSBM-55818
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 fs/ext4/file.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index c63d937..167e262 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -612,7 +612,17 @@  static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
 			if (unwritten)
 				break;
 		}
-
+		if (signal_pending(current)) {
+			mutex_unlock(&inode->i_mutex);
+			return -EINTR;
+		}
+		if (need_resched()) {
+			mutex_unlock(&inode->i_mutex);
+			cond_resched();
+			mutex_lock(&inode->i_mutex);
+			isize = inode->i_size;
+			end = isize >> blkbits;
+		}
 		last++;
 		dataoff = (loff_t)last << blkbits;
 	} while (last <= end);