[PATCH 20/32] vfs: Make close() unmount the attached mount if so flagged [ver #8]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---

 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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux