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 <mail@gmelikov.ru>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #12898 
Issue #6143
This commit is contained in:
Brian Behlendorf 2021-12-22 11:05:07 -08:00 committed by Tony Hutter
parent 306cccca27
commit c454e46336
3 changed files with 17 additions and 8 deletions

View File

@ -294,7 +294,6 @@ elif sys.platform.startswith('linux'):
'mmp/mmp_active_import': ['FAIL', known_reason], 'mmp/mmp_active_import': ['FAIL', known_reason],
'mmp/mmp_exported_import': ['FAIL', known_reason], 'mmp/mmp_exported_import': ['FAIL', known_reason],
'mmp/mmp_inactive_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_snapdev': ['FAIL', '12621'],
'zvol/zvol_misc/zvol_misc_volmode': ['FAIL', known_reason], 'zvol/zvol_misc/zvol_misc_volmode': ['FAIL', known_reason],
}) })

View File

@ -121,6 +121,13 @@ function cleanup_pool
log_must rm -rf $BACKDIR/* log_must rm -rf $BACKDIR/*
if is_global_zone ; then 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 df >/dev/null
log_must_busy zfs destroy -Rf $pool log_must_busy zfs destroy -Rf $pool
else else

View File

@ -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 $TESTPOOL/$TESTFILE@$TESTSNAP
log_must zfs snapshot $SNAPPOOL.1 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" export __ZFS_POOL_RESTRICT="$TESTPOOL"
log_must zfs unmount -a log_must zfs unmount -a
log_must zfs mount -a log_must zfs mount -a
@ -100,12 +109,6 @@ unset __ZFS_POOL_RESTRICT
log_must touch /$TESTPOOL/$TESTFILE/$TESTFILE.1 log_must touch /$TESTPOOL/$TESTFILE/$TESTFILE.1
log_must zfs rollback $SNAPPOOL.1 log_must zfs rollback $SNAPPOOL.1
log_must df >/dev/null
#
# 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_pass "Rollbacks succeed when nested file systems are present." log_pass "Rollbacks succeed when nested file systems are present."