From c454e46336c31d3fe2c6491c57b1e71963ca7ed6 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 22 Dec 2021 11:05:07 -0800 Subject: [PATCH] ZTS: Fix rollback_003_pos.ksh Under Linux when rolling back a mounted filesystem negative dentries may not be dropped from the cache. This can result in an ENOENT being incorrectly returned on first access. Issuing a `df` before the unmount results in the negative dentries being invalidated and side steps the issue. This is solely a workaround for the test case on Linux and not correct behavior. The core issue of invalidating negative dentries needs to be handled with a kernel side change. This is being tracked as issue #6143. Reviewed-by: George Melikov Reviewed-by: John Kennedy Signed-off-by: Brian Behlendorf Closes #12898 Issue #6143 --- tests/test-runner/bin/zts-report.py.in | 1 - .../tests/functional/rsend/rsend.kshlib | 7 +++++++ .../functional/snapshot/rollback_003_pos.ksh | 17 ++++++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/tests/test-runner/bin/zts-report.py.in b/tests/test-runner/bin/zts-report.py.in index 414e266568..d306e04760 100755 --- a/tests/test-runner/bin/zts-report.py.in +++ b/tests/test-runner/bin/zts-report.py.in @@ -294,7 +294,6 @@ elif sys.platform.startswith('linux'): 'mmp/mmp_active_import': ['FAIL', known_reason], 'mmp/mmp_exported_import': ['FAIL', known_reason], 'mmp/mmp_inactive_import': ['FAIL', known_reason], - 'snapshot/rollback_003_pos': ['FAIL', known_reason], 'zvol/zvol_misc/zvol_misc_snapdev': ['FAIL', '12621'], 'zvol/zvol_misc/zvol_misc_volmode': ['FAIL', known_reason], }) diff --git a/tests/zfs-tests/tests/functional/rsend/rsend.kshlib b/tests/zfs-tests/tests/functional/rsend/rsend.kshlib index 8cd35e4afd..516d412632 100644 --- a/tests/zfs-tests/tests/functional/rsend/rsend.kshlib +++ b/tests/zfs-tests/tests/functional/rsend/rsend.kshlib @@ -121,6 +121,13 @@ function cleanup_pool log_must rm -rf $BACKDIR/* if is_global_zone ; then + # + # Linux: Issuing a `df` seems to properly force any negative + # dcache entries to be invalidated preventing failures when + # accessing the mount point. Additional investigation required. + # + # https://github.com/openzfs/zfs/issues/6143 + # log_must df >/dev/null log_must_busy zfs destroy -Rf $pool else diff --git a/tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh b/tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh index 59e7c110dd..036e71410c 100755 --- a/tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh +++ b/tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh @@ -92,6 +92,15 @@ log_note "Verify rollback of multiple nested file systems succeeds." log_must zfs snapshot $TESTPOOL/$TESTFILE@$TESTSNAP log_must zfs snapshot $SNAPPOOL.1 +# +# Linux: Issuing a `df` seems to properly force any negative dcache entries to +# be invalidated preventing failures when accessing the mount point. Additional +# investigation required. +# +# https://github.com/openzfs/zfs/issues/6143 +# +log_must df >/dev/null + export __ZFS_POOL_RESTRICT="$TESTPOOL" log_must zfs unmount -a log_must zfs mount -a @@ -100,12 +109,6 @@ unset __ZFS_POOL_RESTRICT log_must touch /$TESTPOOL/$TESTFILE/$TESTFILE.1 log_must zfs rollback $SNAPPOOL.1 - -# -# Workaround for issue #6143. Issuing a `df` seems to properly force any -# negative dcache entries to be invalidated preventing subsequent failures -# when accessing the mount point. Additional investigation required. -# -log_must df +log_must df >/dev/null log_pass "Rollbacks succeed when nested file systems are present."