summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2014-10-13 14:08:59 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2014-10-13 14:08:59 +1100
commit6560206322ae9612f38e487af83e704c1f1e2f7c (patch)
treeed217e317e3024e85597dfe7c6ac68416ca62de0 /fs
parentc160501d7d9cded9ab6f53ccf03120aff242cca5 (diff)
parent668044a5d632e979ae3cf850f269f8dbbcb3c396 (diff)
Merge remote-tracking branch 'aio/master'
Diffstat (limited to 'fs')
-rw-r--r--fs/aio.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 84a751005f5b..47e1acca3b08 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -273,12 +273,37 @@ static void aio_free_ring(struct kioctx *ctx)
static int aio_ring_mmap(struct file *file, struct vm_area_struct *vma)
{
+ vma->vm_flags |= VM_DONTEXPAND;
vma->vm_ops = &generic_file_vm_ops;
return 0;
}
+static void aio_ring_remap(struct file *file, struct vm_area_struct *vma)
+{
+ struct mm_struct *mm = vma->vm_mm;
+ struct kioctx_table *table;
+ int i;
+
+ spin_lock(&mm->ioctx_lock);
+ rcu_read_lock();
+ table = rcu_dereference(mm->ioctx_table);
+ for (i = 0; i < table->nr; i++) {
+ struct kioctx *ctx;
+
+ ctx = table->table[i];
+ if (ctx && ctx->aio_ring_file == file) {
+ ctx->user_id = ctx->mmap_base = vma->vm_start;
+ break;
+ }
+ }
+
+ rcu_read_unlock();
+ spin_unlock(&mm->ioctx_lock);
+}
+
static const struct file_operations aio_ring_fops = {
.mmap = aio_ring_mmap,
+ .mremap = aio_ring_remap,
};
static int aio_set_page_dirty(struct page *page)