-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove zpl_revalidate: fix snapshot rollback
Open files, which aren't present in the snapshot, which is being roll-backed to, need to disappear from the visible VFS image of the dataset. Kernel provides __d_drop function to locklessly drop invalid entry from the dcache, but inode can be referenced by multiple dentries. The introduced spl_d_drop_aliases function locklessly walks and invalidates all aliases of an inode; the lockless approach assumes the function is only called when z_teardown_lock is active or the inode in question is locked. Signed-off-by: Pavel Snajdr <[email protected]>
- Loading branch information
Showing
9 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
]) | ||
]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (C) 2019 OpenZFS Project | ||
* Written by Pavel Snajdr <[email protected]> | ||
* | ||
* This file is part of the SPL, Solaris Porting Layer. | ||
* For details, see <http://zfsonlinux.org/>. | ||
* | ||
* The SPL is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* The SPL is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with the SPL. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _SPL_DCACHE_H | ||
#define _SPL_DCACHE_H | ||
|
||
#include <linux/file.h> | ||
#include <linux/fs.h> | ||
#include <linux/fs_struct.h> | ||
|
||
extern void spl_d_drop_aliases(struct inode *inode); | ||
#endif /* SPL_DCACHE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) 2019 OpenZFS Project | ||
* Written by Pavel Snajdr <[email protected]> | ||
* | ||
* This file is part of the SPL, Solaris Porting Layer. | ||
* For details, see <http://zfsonlinux.org/>. | ||
* | ||
* The SPL is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* The SPL is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with the SPL. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <sys/debug.h> | ||
#include <sys/dcache.h> | ||
#include <sys/sysmacros.h> | ||
#include <sys/kmem.h> | ||
#include <sys/vmem.h> | ||
#include <linux/mm.h> | ||
#include <linux/dcache.h> | ||
#include <linux/list.h> | ||
|
||
/* | ||
* Locklessly walk and invalidate all aliases of an inode; the lockless | ||
* approach assumes the function is only called when z_teardown_lock is | ||
* active or the inode in question is locked. | ||
*/ | ||
void | ||
spl_d_drop_aliases(struct inode *inode) | ||
{ | ||
struct dentry *dentry; | ||
#ifdef HAVE_DENTRY_D_U_ALIASES | ||
hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { | ||
#else | ||
hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { | ||
#endif | ||
__d_drop(dentry); | ||
} | ||
} | ||
EXPORT_SYMBOL(spl_d_drop_aliases); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters