Skip to contentSkip to conversation

ovl: set lower layer st_dev only if setting lower st_ino

PATCH Superseded Amir Goldstein 1 participant 2 messages Apr 11, 2018 Overlay filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Amir Goldstein

author maintainer
#0 lore raw

PATCH 1/1 ovl: set lower layer st_dev only if setting lower st_ino

For broken hardlinks, we do not return lower st_ino, so we should also not return lower pseudo st_dev.

Fixes a0c5ad307ac0 ("ovl: relax same fs constraint for constant st_ino")
Cc <[email protected]> #v4.15
---
 fs/overlayfs/inode.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Miklos,

This fixes a very obvious (to me) bug.

I have a WIP unionmount-testsuite check for this.
Will sort it out and push it to my tree later.

Also pushed ovl-xino branch rebased on this bug fix.

Thanks,
Amir.

fs/overlayfs/inode.c +2 -5
index c95336611f83..29069f29b3a6 100644
@@ -118,13 +118,10 @@ int ovl_getattr(const struct path *path, struct kstat *stat,
 			 */
 			if (ovl_test_flag(OVL_INDEX, d_inode(dentry)) ||
 			    (!ovl_verify_lower(dentry->d_sb) &&
-			     (is_dir || lowerstat.nlink == 1)))
+			     (is_dir || lowerstat.nlink == 1))) {
 				stat->ino = lowerstat.ino;
-
-			if (samefs)
-				WARN_ON_ONCE(stat->dev != lowerstat.dev);
-			else
 				stat->dev = ovl_get_pseudo_dev(dentry);
+			}
 		}
 		if (samefs) {
 			/*
Signature · 1 line
2.7.4
author maintainer
#1 lore raw
Quoted 10 lines · Amir Goldstein

For broken hardlinks, we do not return lower st_ino, so we should also not return lower pseudo st_dev.

Fixes a0c5ad307ac0 ("ovl: relax same fs constraint for constant st_ino")
Cc <[email protected]> #v4.15
---
 fs/overlayfs/inode.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Quoted 9 lines

Miklos,

This fixes a very obvious (to me) bug.

I have a WIP unionmount-testsuite check for this.
Will sort it out and push it to my tree later.

Also pushed ovl-xino branch rebased on this bug fix.

OOPS, just saw that ovl-xino is already in overlayfs-next, I can rebase the fix and re-send tomorrow.

Thanks,
Amir.