]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.16.4/device-dax-allow-map_sync-to-succeed.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.16.4 / device-dax-allow-map_sync-to-succeed.patch
1 From ef8423022324cf79bd1b41d8707c766461e7e555 Mon Sep 17 00:00:00 2001
2 From: Dave Jiang <dave.jiang@intel.com>
3 Date: Thu, 19 Apr 2018 13:39:43 -0700
4 Subject: device-dax: allow MAP_SYNC to succeed
5
6 From: Dave Jiang <dave.jiang@intel.com>
7
8 commit ef8423022324cf79bd1b41d8707c766461e7e555 upstream.
9
10 MAP_SYNC is a nop for device-dax. Allow MAP_SYNC to succeed on device-dax
11 to eliminate special casing between device-dax and fs-dax as to when the
12 flag can be specified. Device-dax users already implicitly assume that they do
13 not need to call fsync(), and this enables them to explicitly check for this
14 capability.
15
16 Cc: <stable@vger.kernel.org>
17 Fixes: b6fb293f2497 ("mm: Define MAP_SYNC and VM_SYNC flags")
18 Signed-off-by: Dave Jiang <dave.jiang@intel.com>
19 Reviewed-by: Dan Williams <dan.j.williams@intel.com>
20 Signed-off-by: Dan Williams <dan.j.williams@intel.com>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23 ---
24 drivers/dax/device.c | 2 ++
25 1 file changed, 2 insertions(+)
26
27 --- a/drivers/dax/device.c
28 +++ b/drivers/dax/device.c
29 @@ -19,6 +19,7 @@
30 #include <linux/dax.h>
31 #include <linux/fs.h>
32 #include <linux/mm.h>
33 +#include <linux/mman.h>
34 #include "dax-private.h"
35 #include "dax.h"
36
37 @@ -534,6 +535,7 @@ static const struct file_operations dax_
38 .release = dax_release,
39 .get_unmapped_area = dax_get_unmapped_area,
40 .mmap = dax_mmap,
41 + .mmap_supported_flags = MAP_SYNC,
42 };
43
44 static void dev_dax_release(struct device *dev)