[lustre-devel] [PATCH 105/622] lustre: llite: check truncate race for DOM pages

James Simmons jsimmons at infradead.org
Thu Feb 27 13:09:33 PST 2020


From: Mikhail Pershin <mpershin at whamcloud.com>

In ll_dom_finish_open() check vmpage mapping still
exists after locking and exit otherwise. This can
happen if page has been truncated concurrently.

WC-bug-id: https://jira.whamcloud.com/browse/LU-11275
Lustre-commit: 0f7d7b200b58 ("LU-11275 llite: check truncate race for DOM pages")
Signed-off-by: Mikhail Pershin <mpershin at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/33087
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/llite/file.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index 68fb623..ae39b2c 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -496,6 +496,13 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req,
 			break;
 		}
 		lock_page(vmpage);
+		if (!vmpage->mapping) {
+			unlock_page(vmpage);
+			put_page(vmpage);
+			/* page was truncated */
+			rc = -ENODATA;
+			goto out_io;
+		}
 		clp = cl_page_find(env, obj, vmpage->index, vmpage,
 				   CPT_CACHEABLE);
 		if (IS_ERR(clp)) {
-- 
1.8.3.1



More information about the lustre-devel mailing list