Skip to content

Commit

Permalink
ZTS: Fix rollback_003_pos.ksh
Browse files Browse the repository at this point in the history
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 openzfs#6143.

Reviewed-by: George Melikov <[email protected]>
Reviewed-by: John Kennedy <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#12898 
Issue openzfs#6143
  • Loading branch information
behlendorf authored and tonyhutter committed Feb 16, 2022
1 parent b14fb4e commit d1a0b15
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 0 additions & 1 deletion tests/test-runner/bin/zts-report.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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],
})
Expand Down
7 changes: 7 additions & 0 deletions tests/zfs-tests/tests/functional/rsend/rsend.kshlib
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 10 additions & 7 deletions tests/zfs-tests/tests/functional/snapshot/rollback_003_pos.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."

0 comments on commit d1a0b15

Please sign in to comment.