[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <152720685405.9073.17445116582570028610.stgit@warthog.procyon.org.uk>
Date: Fri, 25 May 2018 01:07:34 +0100
From: David Howells <dhowells@...hat.com>
To: viro@...iv.linux.org.uk
Cc: dhowells@...hat.com, linux-fsdevel@...r.kernel.org,
linux-afs@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH 20/32] vfs: Make close() unmount the attached mount if so
flagged [ver #8]
---
fs/file_table.c | 4 ++++
include/linux/fs.h | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/file_table.c b/fs/file_table.c
index 7ec0b3e5f05d..dbbcc563748a 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -30,6 +30,7 @@
#include <linux/atomic.h>
#include "internal.h"
+#include "mount.h"
/* sysctl tunables... */
struct files_stat_struct files_stat = {
@@ -200,6 +201,9 @@ static void __fput(struct file *file)
eventpoll_release(file);
locks_remove_file(file);
+ if (unlikely(file->f_mode & FMODE_NEED_UNMOUNT))
+ __detach_mounts(dentry);
+
ima_file_free(file);
if (unlikely(file->f_flags & FASYNC)) {
if (file->f_op->fasync)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e771803cc8dc..ba571c18e236 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -152,7 +152,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)
/* File is capable of returning -EAGAIN if I/O will block */
-#define FMODE_NOWAIT ((__force fmode_t)0x8000000)
+#define FMODE_NOWAIT ((__force fmode_t)0x8000000)
+/* File represents mount that needs unmounting */
+#define FMODE_NEED_UNMOUNT ((__force fmode_t)0x10000000)
/*
* Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
Powered by blists - more mailing lists