mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Partially revert 5a6ac4c
Reinstate the zpl_revalidate() functionality to resolve a regression where dentries for open files during a rollback are not invalidated. The unrelated functionality for automatically unmounting .zfs/snapshots was not reverted. Nor was the addition of shrink_dcache_sb() to the zfs_resume_fs() function. This issue was not immediately caught by the CI because the test case intended to catch it was included in the list of ZTS tests which may occasionally fail for unrelated reasons. Remove all of the rollback tests from this list to help identify the frequency of any spurious failures. The rollback_003_pos.ksh test case exposes a real issue with the long standing code which needs to be investigated. Regardless, it has been enable with a small workaround in the test case itself. Reviewed-by: Matt Ahrens <matt@delphix.com> Reviewed-by: Pavel Snajdr <snajpa@snajpa.net> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #9587 Closes #9592
This commit is contained in:
parent
41e1aa2a06
commit
7ae3f8dc8f
@ -147,6 +147,28 @@ AC_DEFUN([ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS], [
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # 2.6.38 API change
|
||||||
|
dnl # Added sb->s_d_op default dentry_operations member
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([ZFS_AC_KERNEL_SRC_S_D_OP], [
|
||||||
|
ZFS_LINUX_TEST_SRC([super_block_s_d_op], [
|
||||||
|
#include <linux/fs.h>
|
||||||
|
],[
|
||||||
|
struct super_block sb __attribute__ ((unused));
|
||||||
|
sb.s_d_op = NULL;
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([ZFS_AC_KERNEL_S_D_OP], [
|
||||||
|
AC_MSG_CHECKING([whether super_block has s_d_op])
|
||||||
|
ZFS_LINUX_TEST_RESULT([super_block_s_d_op], [
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
], [
|
||||||
|
ZFS_LINUX_TEST_ERROR([super_block s_d_op])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_SRC_DENTRY], [
|
AC_DEFUN([ZFS_AC_KERNEL_SRC_DENTRY], [
|
||||||
ZFS_AC_KERNEL_SRC_D_MAKE_ROOT
|
ZFS_AC_KERNEL_SRC_D_MAKE_ROOT
|
||||||
ZFS_AC_KERNEL_SRC_D_OBTAIN_ALIAS
|
ZFS_AC_KERNEL_SRC_D_OBTAIN_ALIAS
|
||||||
@ -154,6 +176,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_DENTRY], [
|
|||||||
ZFS_AC_KERNEL_SRC_D_SET_D_OP
|
ZFS_AC_KERNEL_SRC_D_SET_D_OP
|
||||||
ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA
|
ZFS_AC_KERNEL_SRC_D_REVALIDATE_NAMEIDATA
|
||||||
ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS
|
ZFS_AC_KERNEL_SRC_CONST_DENTRY_OPERATIONS
|
||||||
|
ZFS_AC_KERNEL_SRC_S_D_OP
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([ZFS_AC_KERNEL_DENTRY], [
|
AC_DEFUN([ZFS_AC_KERNEL_DENTRY], [
|
||||||
@ -163,4 +186,5 @@ AC_DEFUN([ZFS_AC_KERNEL_DENTRY], [
|
|||||||
ZFS_AC_KERNEL_D_SET_D_OP
|
ZFS_AC_KERNEL_D_SET_D_OP
|
||||||
ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA
|
ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA
|
||||||
ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS
|
ZFS_AC_KERNEL_CONST_DENTRY_OPERATIONS
|
||||||
|
ZFS_AC_KERNEL_S_D_OP
|
||||||
])
|
])
|
||||||
|
@ -45,6 +45,7 @@ extern const struct inode_operations zpl_inode_operations;
|
|||||||
extern const struct inode_operations zpl_dir_inode_operations;
|
extern const struct inode_operations zpl_dir_inode_operations;
|
||||||
extern const struct inode_operations zpl_symlink_inode_operations;
|
extern const struct inode_operations zpl_symlink_inode_operations;
|
||||||
extern const struct inode_operations zpl_special_inode_operations;
|
extern const struct inode_operations zpl_special_inode_operations;
|
||||||
|
extern dentry_operations_t zpl_dentry_operations;
|
||||||
|
|
||||||
/* zpl_file.c */
|
/* zpl_file.c */
|
||||||
extern ssize_t zpl_read_common(struct inode *ip, const char *buf,
|
extern ssize_t zpl_read_common(struct inode *ip, const char *buf,
|
||||||
|
@ -1926,6 +1926,7 @@ zfs_domount(struct super_block *sb, zfs_mnt_t *zm, int silent)
|
|||||||
sb->s_op = &zpl_super_operations;
|
sb->s_op = &zpl_super_operations;
|
||||||
sb->s_xattr = zpl_xattr_handlers;
|
sb->s_xattr = zpl_xattr_handlers;
|
||||||
sb->s_export_op = &zpl_export_operations;
|
sb->s_export_op = &zpl_export_operations;
|
||||||
|
sb->s_d_op = &zpl_dentry_operations;
|
||||||
|
|
||||||
/* Set features for file system. */
|
/* Set features for file system. */
|
||||||
zfs_set_fuid_feature(zfsvfs);
|
zfs_set_fuid_feature(zfsvfs);
|
||||||
|
@ -602,6 +602,46 @@ out:
|
|||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
#ifdef HAVE_D_REVALIDATE_NAMEIDATA
|
||||||
|
zpl_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||||
|
{
|
||||||
|
unsigned int flags = (nd ? nd->flags : 0);
|
||||||
|
#else
|
||||||
|
zpl_revalidate(struct dentry *dentry, unsigned int flags)
|
||||||
|
{
|
||||||
|
#endif /* HAVE_D_REVALIDATE_NAMEIDATA */
|
||||||
|
/* CSTYLED */
|
||||||
|
zfsvfs_t *zfsvfs = dentry->d_sb->s_fs_info;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
if (flags & LOOKUP_RCU)
|
||||||
|
return (-ECHILD);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* After a rollback negative dentries created before the rollback
|
||||||
|
* time must be invalidated. Otherwise they can obscure files which
|
||||||
|
* are only present in the rolled back dataset.
|
||||||
|
*/
|
||||||
|
if (dentry->d_inode == NULL) {
|
||||||
|
spin_lock(&dentry->d_lock);
|
||||||
|
error = time_before(dentry->d_time, zfsvfs->z_rollback_time);
|
||||||
|
spin_unlock(&dentry->d_lock);
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The dentry may reference a stale inode if a mounted file system
|
||||||
|
* was rolled back to a point in time where the object didn't exist.
|
||||||
|
*/
|
||||||
|
if (dentry->d_inode && ITOZ(dentry->d_inode)->z_is_stale)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
const struct inode_operations zpl_inode_operations = {
|
const struct inode_operations zpl_inode_operations = {
|
||||||
.setattr = zpl_setattr,
|
.setattr = zpl_setattr,
|
||||||
.getattr = zpl_getattr,
|
.getattr = zpl_getattr,
|
||||||
@ -690,3 +730,7 @@ const struct inode_operations zpl_special_inode_operations = {
|
|||||||
.get_acl = zpl_get_acl,
|
.get_acl = zpl_get_acl,
|
||||||
#endif /* CONFIG_FS_POSIX_ACL */
|
#endif /* CONFIG_FS_POSIX_ACL */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dentry_operations_t zpl_dentry_operations = {
|
||||||
|
.d_revalidate = zpl_revalidate,
|
||||||
|
};
|
||||||
|
@ -189,7 +189,6 @@ known = {
|
|||||||
'removal/removal_with_zdb': ['SKIP', known_reason],
|
'removal/removal_with_zdb': ['SKIP', known_reason],
|
||||||
'rootpool/setup': ['SKIP', na_reason],
|
'rootpool/setup': ['SKIP', na_reason],
|
||||||
'rsend/rsend_008_pos': ['SKIP', '6066'],
|
'rsend/rsend_008_pos': ['SKIP', '6066'],
|
||||||
'snapshot/rollback_003_pos': ['SKIP', '6143'],
|
|
||||||
'vdev_zaps/vdev_zaps_007_pos': ['FAIL', known_reason],
|
'vdev_zaps/vdev_zaps_007_pos': ['FAIL', known_reason],
|
||||||
'xattr/xattr_008_pos': ['SKIP', na_reason],
|
'xattr/xattr_008_pos': ['SKIP', na_reason],
|
||||||
'xattr/xattr_009_neg': ['SKIP', na_reason],
|
'xattr/xattr_009_neg': ['SKIP', na_reason],
|
||||||
@ -222,8 +221,6 @@ maybe = {
|
|||||||
'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason],
|
'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason],
|
||||||
'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason],
|
'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason],
|
||||||
'cli_root/zfs_get/zfs_get_009_pos': ['SKIP', '5479'],
|
'cli_root/zfs_get/zfs_get_009_pos': ['SKIP', '5479'],
|
||||||
'cli_root/zfs_rollback/zfs_rollback_001_pos': ['FAIL', '6415'],
|
|
||||||
'cli_root/zfs_rollback/zfs_rollback_002_pos': ['FAIL', '6416'],
|
|
||||||
'cli_root/zfs_share/setup': ['SKIP', share_reason],
|
'cli_root/zfs_share/setup': ['SKIP', share_reason],
|
||||||
'cli_root/zfs_snapshot/zfs_snapshot_002_neg': ['FAIL', known_reason],
|
'cli_root/zfs_snapshot/zfs_snapshot_002_neg': ['FAIL', known_reason],
|
||||||
'cli_root/zfs_unshare/setup': ['SKIP', share_reason],
|
'cli_root/zfs_unshare/setup': ['SKIP', share_reason],
|
||||||
|
@ -48,10 +48,6 @@
|
|||||||
|
|
||||||
verify_runnable "both"
|
verify_runnable "both"
|
||||||
|
|
||||||
if is_linux; then
|
|
||||||
log_unsupported "Test case is known to fail on Linux"
|
|
||||||
fi
|
|
||||||
|
|
||||||
function cleanup
|
function cleanup
|
||||||
{
|
{
|
||||||
typeset snap=""
|
typeset snap=""
|
||||||
@ -61,18 +57,16 @@ function cleanup
|
|||||||
log_must zfs mount -a
|
log_must zfs mount -a
|
||||||
unset __ZFS_POOL_RESTRICT
|
unset __ZFS_POOL_RESTRICT
|
||||||
|
|
||||||
for snap in "$SNAPPOOL.1" "$SNAPPOOL"
|
for snap in "$SNAPPOOL.1" "$SNAPPOOL"; do
|
||||||
do
|
if snapexists $snap; then
|
||||||
snapexists $snap
|
destroy_snapshot $snap
|
||||||
[[ $? -eq 0 ]] && \
|
fi
|
||||||
log_must zfs destroy $snap
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for fs in "$TESTPOOL/$TESTFILE/$TESTFILE.1" "$TESTPOOL/$TESTFILE"
|
for fs in "$TESTPOOL/$TESTFILE/$TESTFILE.1" "$TESTPOOL/$TESTFILE"; do
|
||||||
do
|
if datasetexists $fs; then
|
||||||
datasetexists $fs
|
destroy_dataset $fs -r
|
||||||
[[ $? -eq 0 ]] && \
|
fi
|
||||||
log_must zfs destroy -r $fs
|
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ -e /$TESTPOOL ]] && \
|
[[ -e /$TESTPOOL ]] && \
|
||||||
@ -107,4 +101,11 @@ log_must touch /$TESTPOOL/$TESTFILE/$TESTFILE.1
|
|||||||
|
|
||||||
log_must zfs rollback $SNAPPOOL.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_pass "Rollbacks succeed when nested file systems are present."
|
log_pass "Rollbacks succeed when nested file systems are present."
|
||||||
|
Loading…
Reference in New Issue
Block a user