-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove zpl_revalidate: fix snapshot rollback #9600
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
dnl # | ||
dnl # 3.18 API change | ||
dnl # Dentry aliases are in d_u struct dentry member | ||
dnl # | ||
AC_DEFUN([ZFS_AC_KERNEL_SRC_DENTRY_ALIAS_D_U], [ | ||
ZFS_LINUX_TEST_SRC([dentry_alias_d_u], [ | ||
#include <linux/fs.h> | ||
#include <linux/dcache.h> | ||
#include <linux/list.h> | ||
], [ | ||
struct inode *inode __attribute__ ((unused)) = NULL; | ||
struct dentry *dentry __attribute__ ((unused)) = NULL; | ||
hlist_for_each_entry(dentry, &inode->i_dentry, | ||
d_u.d_alias) { | ||
d_drop(dentry); | ||
} | ||
]) | ||
]) | ||
|
||
AC_DEFUN([ZFS_AC_KERNEL_DENTRY_ALIAS_D_U], [ | ||
AC_MSG_CHECKING([whether dentry aliases are in d_u member]) | ||
ZFS_LINUX_TEST_RESULT([dentry_alias_d_u], [ | ||
AC_MSG_RESULT(yes) | ||
AC_DEFINE(HAVE_DENTRY_D_U_ALIASES, 1, | ||
[dentry aliases are in d_u member]) | ||
],[ | ||
AC_MSG_RESULT(no) | ||
]) | ||
]) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1926,7 +1926,6 @@ zfs_domount(struct super_block *sb, zfs_mnt_t *zm, int silent) | |
sb->s_op = &zpl_super_operations; | ||
sb->s_xattr = zpl_xattr_handlers; | ||
sb->s_export_op = &zpl_export_operations; | ||
sb->s_d_op = &zpl_dentry_operations; | ||
|
||
/* Set features for file system. */ | ||
zfs_set_fuid_feature(zfsvfs); | ||
|
@@ -2275,6 +2274,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) | |
zp = list_next(&zfsvfs->z_all_znodes, zp)) { | ||
err2 = zfs_rezget(zp); | ||
if (err2) { | ||
zpl_d_drop_aliases(ZTOI(zp)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After giving this some more thought I think we need to always drop all of the aliases, even when the The
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No problem, would you have any hints & recommendations wrt/ testing environment? I'd try some ACL changes between the snapshot and rollback too; is it OK to add and remove users in the test suite? So I'll try:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Great. Yes, you can add and remove users in the ZTS with the I think we should verify all of the following for correctness after an online rollback.
Additionally, I think we would get a lot of value stressing the code by including a test case which runs for a minute or two and randomly performs snapshots and rollbacks of an active filesystem. In particular, this would be a good way to test open file handles and unlinks are handled properly. Related to exactly this I opened #9739 with a proposed fix. [edit] See also #9741 which is similarly related. Though in this case it's due to an inode hash collision. See comment in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've been trying to figure out, how to do the stress test part, but I can't come up with an elegant solution, which I could really call 'stress' test. For one, writing a multithreaded beast in userspace C is something I'd rather avoid, but even if I bite the bullet, what should the threads do, so that it be considered stress testing stuff and not just repeating the same workload over? So I'm thinking it's best to admit, that I'm stuck and ask for help, so that we can move on with this :) Maybe let's skip the 'stress' test part, only do various permutations of ^ what you listed, perhaps repeat that process a few times and check the status of things in-between the steps - opening a file and leaving it open should be possible directly in the Korn shell. That's a fallback solution, so that we get at least somewhere, to move the whole OverlayFS thing forward in reasonable time frame. Would that work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds like a reasonable path forward to me. We can always add additional test case as we come up with specific scenarios. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @didrocks says I might be able to get some help from the Docker guys with writing the tests - for which I'm sorry, but I can't seem to find the time ... bugs are popping up in weird places and we desperately need to finish the kernel upgrade @ our infra. Sh*t. I can understand the pain of not having the overlay2 Docker storage driver available... |
||
remove_inode_hash(ZTOI(zp)); | ||
zp->z_is_stale = B_TRUE; | ||
snajpa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this inode's dentry list only contain dentries for this inode?
In any case, I agree with @behlendorf that we should remove everything about this filesystem from the directory entry cache, since a
rename
could result in invalid dentry cache even though zfs_rezget() would succeed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Negative dentries used be identified by setting
dentry->d_inode == NULL
. Though, I'm not certain if they ever were include in the->i_dentry
, they may only have been hashed. Looking at more recent kernels they've add someDCACHE_ENTRY_TYPE
bits to->d_flags
since there are now more dentry types. Regardless, unless there's some reason we can't we should drop everything to force a new lookup.