From: Sebastien Buisson Date: Mon, 19 Oct 2020 08:56:37 +0000 (+0000) Subject: LU-14045 sec: fix O_DIRECT and encrypted files X-Git-Tag: 2.13.57~80 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e07d0516dcde4b23375881077875b4cf96c90cd5 LU-14045 sec: fix O_DIRECT and encrypted files Sometimes, we can end up in a situation where osc_release_bounce_pages() mistakenly consider pages as fscrypt bounce pages, and tries to free them. Fix the way we consider bounce pages by always setting the PageChecked flag on them. Also remove sanity test_426 from the ALWAYS_EXCEPT list. Test-Parameters: testlist=sanity-sec envdefinitions=ONLY="36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 52 53 54" clientdistro=ubuntu2004 fstype=ldiskfs mdscount=2 mdtcount=4 Test-Parameters: testlist=sanity-sec envdefinitions=ONLY="36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 52 53 54" clientdistro=ubuntu2004 fstype=zfs mdscount=2 mdtcount=4 Fixes: 728036f256 ("LU-12275 sec: O_DIRECT for encrypted file") Signed-off-by: Sebastien Buisson Change-Id: Ic54ae031c3b0baa17ffed8a6b6b90ff44f87ff58 Reviewed-on: https://review.whamcloud.com/40295 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: Neil Brown Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 4bebfaa..0043b83 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1361,8 +1361,11 @@ static inline void osc_release_bounce_pages(struct brw_page **pga, int i; for (i = 0; i < page_count; i++) { - if (!pga[i]->pg->mapping) - /* bounce pages are unmapped */ + /* Bounce pages allocated by a call to + * llcrypt_encrypt_pagecache_blocks() in osc_brw_prep_request() + * are identified thanks to the PageChecked flag. + */ + if (PageChecked(pga[i]->pg)) llcrypt_finalize_bounce_page(&pga[i]->pg); pga[i]->count -= pga[i]->bp_count_diff; pga[i]->off += pga[i]->bp_off_diff; @@ -1445,6 +1448,10 @@ retry_encrypt: ptlrpc_request_free(req); RETURN(rc); } + /* Set PageChecked flag on bounce page for + * disambiguation in osc_release_bounce_pages(). + */ + SetPageChecked(data_page); pg->pg = data_page; /* there should be no gap in the middle of page array */ if (i == page_count - 1) { diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 01229b1..3fcbc65 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -60,11 +60,6 @@ if [[ $(uname -m) = aarch64 ]]; then ALWAYS_EXCEPT+=" 400a 400b" fi -# skip splice tests on kernels >= 4.15.0 until they are fixed -if [ $LINUX_VERSION_CODE -ge $(version_code 4.15.0) ]; then - # bug number: LU-14045 - ALWAYS_EXCEPT+=" 426" -fi # skip nfs tests on kernels >= 4.12.0 until they are fixed if [ $LINUX_VERSION_CODE -ge $(version_code 4.12.0) ]; then # bug number: LU-12661