[Devel] [PATCH rh7] fs/nfs: don't use delayed unmount for nfs.
Andrey Ryabinin
aryabinin at virtuozzo.com
Fri Oct 27 18:31:18 MSK 2017
Delayed nfs unmount causes too much PITA. We must destroy VENET ip after
unmount, but in that case we can't reuse that IP on restarted container
because it migh be still alive.
So let's just unmount NFS synchronously and destroy veip after it.
https://jira.sw.ru/browse/PSBM-76086
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
drivers/net/venetdev.c | 9 ++-------
fs/namespace.c | 3 ++-
fs/nfs/super.c | 1 +
include/linux/fs.h | 4 ++++
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c
index 1c4ae90b7ba8..11f4a66aaf3d 100644
--- a/drivers/net/venetdev.c
+++ b/drivers/net/venetdev.c
@@ -765,7 +765,7 @@ static void venet_dellink(struct net_device *dev, struct list_head *head)
* has VE_FEATURE_NFS enabled. Thus here we have to destroy veip in
* this case.
*/
- if (env->ve_netns || (env->features & VE_FEATURE_NFS))
+ if (env->ve_netns)
veip_shutdown(env);
env->_venet_dev = NULL;
@@ -1182,12 +1182,7 @@ static struct rtnl_link_ops venet_link_ops = {
static void veip_shutdown_fini(void *data)
{
- struct ve_struct *ve = data;
-
- if (ve->features & VE_FEATURE_NFS)
- return;
-
- veip_shutdown(ve);
+ veip_shutdown(data);
}
static struct ve_hook veip_shutdown_hook = {
diff --git a/fs/namespace.c b/fs/namespace.c
index 2c9824985bc5..c2489dd2f520 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1134,7 +1134,8 @@ static void mntput_no_expire(struct mount *mnt)
}
unlock_mount_hash();
- if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))) {
+ if (likely(!(mnt->mnt.mnt_flags & MNT_INTERNAL))
+ && !(mnt->mnt.mnt_sb->s_iflags & SB_I_UMOUNT_SYNC)) {
struct task_struct *task = current;
if (likely(!(task->flags & PF_KTHREAD))) {
init_task_work(&mnt->mnt_rcu, __cleanup_mnt);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 8f29ad17e29e..65a0ac8a3d16 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2414,6 +2414,7 @@ static int nfs_set_super(struct super_block *s, void *data)
int ret;
s->s_flags = sb_mntdata->mntflags;
+ s->s_iflags |= SB_I_UMOUNT_SYNC;
s->s_fs_info = server;
s->s_d_op = server->nfs_client->rpc_ops->dentry_ops;
ret = set_anon_super(s, server);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 79011b4bc040..2f3a983741f8 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1526,6 +1526,9 @@ struct mm_struct;
#define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */
#define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */
+/* sb->s_iflags */
+#define SB_I_UMOUNT_SYNC 0x10000000 /* don't use delayed unmount */
+
extern struct list_head super_blocks;
extern spinlock_t sb_lock;
@@ -1566,6 +1569,7 @@ struct super_block {
const struct quotactl_ops *s_qcop;
const struct export_operations *s_export_op;
unsigned long s_flags;
+ unsigned long s_iflags; /* internal SB_I_* flags */
unsigned long s_magic;
struct dentry *s_root;
struct rw_semaphore s_umount;
--
2.13.6
More information about the Devel
mailing list