@@ -26,6 +26,7 @@
#include <linux/hardirq.h>
#include <linux/task_work.h>
#include <linux/ima.h>
+#include <linux/vrange.h>
#include <linux/atomic.h>
@@ -244,6 +245,10 @@ static void __fput(struct file *file)
file->f_op->fasync(-1, file, 0);
}
ima_file_free(file);
+
+ /* drop all vranges on last close */
+ vrange_root_cleanup(&inode->i_mapping->vroot);
+
if (file->f_op && file->f_op->release)
file->f_op->release(inode, file);
security_file_free(file);
@@ -17,6 +17,7 @@
#include <linux/prefetch.h>
#include <linux/buffer_head.h> /* for inode_has_buffers */
#include <linux/ratelimit.h>
+#include <linux/vrange.h>
#include "internal.h"
/*
@@ -350,6 +351,7 @@ void address_space_init_once(struct address_space *mapping)
spin_lock_init(&mapping->private_lock);
mapping->i_mmap = RB_ROOT;
INIT_LIST_HEAD(&mapping->i_mmap_nonlinear);
+ vrange_root_init(&mapping->vroot, VRANGE_FILE);
}
EXPORT_SYMBOL(address_space_init_once);
@@ -27,6 +27,7 @@
#include <linux/lockdep.h>
#include <linux/percpu-rwsem.h>
#include <linux/blk_types.h>
+#include <linux/vrange_types.h>
#include <asm/byteorder.h>
#include <uapi/linux/fs.h>
@@ -411,6 +412,7 @@ struct address_space {
struct rb_root i_mmap; /* tree of private and shared mappings */
struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
struct mutex i_mmap_mutex; /* protect tree, count, list */
+ struct vrange_root vroot;
/* Protected by tree_lock together with the radix tree */
unsigned long nrpages; /* number of total pages */
pgoff_t writeback_index;/* writeback starts here */