sunxi: add rtl8xxxu into pcduino v3 profile
[openwrt/staging/rmilecki.git] / target / linux / generic / patches-4.4 / 051-0003-ovl-don-t-copy-up-opaqueness.patch
1 From 0956254a2d5b9e2141385514553aeef694dfe3b5 Mon Sep 17 00:00:00 2001
2 From: Miklos Szeredi <mszeredi@redhat.com>
3 Date: Mon, 8 Aug 2016 15:08:49 +0200
4 Subject: [PATCH] ovl: don't copy up opaqueness
5
6 When a copy up of a directory occurs which has the opaque xattr set, the
7 xattr remains in the upper directory. The immediate behavior with overlayfs
8 is that the upper directory is not treated as opaque, however after a
9 remount the opaque flag is used and upper directory is treated as opaque.
10 This causes files created in the lower layer to be hidden when using
11 multiple lower directories.
12
13 Fix by not copying up the opaque flag.
14
15 To reproduce:
16
17 ----8<---------8<---------8<---------8<---------8<---------8<----
18 mkdir -p l/d/s u v w mnt
19 mount -t overlay overlay -olowerdir=l,upperdir=u,workdir=w mnt
20 rm -rf mnt/d/
21 mkdir -p mnt/d/n
22 umount mnt
23 mount -t overlay overlay -olowerdir=u:l,upperdir=v,workdir=w mnt
24 touch mnt/d/foo
25 umount mnt
26 mount -t overlay overlay -olowerdir=u:l,upperdir=v,workdir=w mnt
27 ls mnt/d
28 ----8<---------8<---------8<---------8<---------8<---------8<----
29
30 output should be: "foo n"
31
32 Reported-by: Derek McGowan <dmcg@drizz.net>
33 Link: https://bugzilla.kernel.org/show_bug.cgi?id=151291
34 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
35 Cc: <stable@vger.kernel.org>
36 ---
37 fs/overlayfs/copy_up.c | 2 ++
38 fs/overlayfs/inode.c | 2 +-
39 fs/overlayfs/overlayfs.h | 1 +
40 3 files changed, 4 insertions(+), 1 deletion(-)
41
42 --- a/fs/overlayfs/copy_up.c
43 +++ b/fs/overlayfs/copy_up.c
44 @@ -48,6 +48,8 @@ int ovl_copy_xattr(struct dentry *old, s
45 }
46
47 for (name = buf; name < (buf + list_size); name += strlen(name) + 1) {
48 + if (ovl_is_private_xattr(name))
49 + continue;
50 retry:
51 size = vfs_getxattr(old, name, value, value_size);
52 if (size == -ERANGE)
53 --- a/fs/overlayfs/inode.c
54 +++ b/fs/overlayfs/inode.c
55 @@ -219,7 +219,7 @@ static int ovl_readlink(struct dentry *d
56 }
57
58
59 -static bool ovl_is_private_xattr(const char *name)
60 +bool ovl_is_private_xattr(const char *name)
61 {
62 return strncmp(name, OVL_XATTR_PRE_NAME, OVL_XATTR_PRE_LEN) == 0;
63 }
64 --- a/fs/overlayfs/overlayfs.h
65 +++ b/fs/overlayfs/overlayfs.h
66 @@ -175,6 +175,7 @@ ssize_t ovl_getxattr(struct dentry *dent
67 ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
68 int ovl_removexattr(struct dentry *dentry, const char *name);
69 struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags);
70 +bool ovl_is_private_xattr(const char *name);
71
72 struct inode *ovl_new_inode(struct super_block *sb, umode_t mode,
73 struct ovl_entry *oe);