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

Dmitry Monakhov dmonakhov at openvz.org
Sat Feb 25 07:15:38 PST 2017


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 at openvz.org>
---
 fs/ext4/file.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

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);
-- 
2.9.3



More information about the Devel mailing list