]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/ovl-make-i_ino-consistent-with-st_ino-in-more-cases.patch
fixes for 4.4
[thirdparty/kernel/stable-queue.git] / queue-4.19 / ovl-make-i_ino-consistent-with-st_ino-in-more-cases.patch
1 From aded172679503e13da91a5a12dda390b2e39de85 Mon Sep 17 00:00:00 2001
2 From: Amir Goldstein <amir73il@gmail.com>
3 Date: Sun, 9 Jun 2019 19:03:44 +0300
4 Subject: ovl: make i_ino consistent with st_ino in more cases
5
6 [ Upstream commit 6dde1e42f497b2d4e22466f23019016775607947 ]
7
8 Relax the condition that overlayfs supports nfs export, to require
9 that i_ino is consistent with st_ino/d_ino.
10
11 It is enough to require that st_ino and d_ino are consistent.
12
13 This fixes the failure of xfstest generic/504, due to mismatch of
14 st_ino to inode number in the output of /proc/locks.
15
16 Fixes: 12574a9f4c9c ("ovl: consistent i_ino for non-samefs with xino")
17 Cc: <stable@vger.kernel.org> # v4.19
18 Signed-off-by: Amir Goldstein <amir73il@gmail.com>
19 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
20 Signed-off-by: Sasha Levin <sashal@kernel.org>
21 ---
22 fs/overlayfs/inode.c | 12 ++++++------
23 1 file changed, 6 insertions(+), 6 deletions(-)
24
25 diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
26 index b48273e846ad..373ccff9880c 100644
27 --- a/fs/overlayfs/inode.c
28 +++ b/fs/overlayfs/inode.c
29 @@ -553,15 +553,15 @@ static void ovl_fill_inode(struct inode *inode, umode_t mode, dev_t rdev,
30 int xinobits = ovl_xino_bits(inode->i_sb);
31
32 /*
33 - * When NFS export is enabled and d_ino is consistent with st_ino
34 - * (samefs or i_ino has enough bits to encode layer), set the same
35 - * value used for d_ino to i_ino, because nfsd readdirplus compares
36 - * d_ino values to i_ino values of child entries. When called from
37 + * When d_ino is consistent with st_ino (samefs or i_ino has enough
38 + * bits to encode layer), set the same value used for st_ino to i_ino,
39 + * so inode number exposed via /proc/locks and a like will be
40 + * consistent with d_ino and st_ino values. An i_ino value inconsistent
41 + * with d_ino also causes nfsd readdirplus to fail. When called from
42 * ovl_new_inode(), ino arg is 0, so i_ino will be updated to real
43 * upper inode i_ino on ovl_inode_init() or ovl_inode_update().
44 */
45 - if (inode->i_sb->s_export_op &&
46 - (ovl_same_sb(inode->i_sb) || xinobits)) {
47 + if (ovl_same_sb(inode->i_sb) || xinobits) {
48 inode->i_ino = ino;
49 if (xinobits && fsid && !(ino >> (64 - xinobits)))
50 inode->i_ino |= (unsigned long)fsid << (64 - xinobits);
51 --
52 2.20.1
53