ovl: fix wrong WARN_ON() in ovl_cache_update_ino()
[sfrench/cifs-2.6.git] / fs / overlayfs / readdir.c
index 47a91c9733a5e3ed5a8c9bcc5cb4a75881136fa8..7255e6a5838f828b663a936a82c63d4440ba53a8 100644 (file)
@@ -504,7 +504,13 @@ get:
                if (err)
                        goto fail;
 
-               WARN_ON_ONCE(dir->d_sb->s_dev != stat.dev);
+               /*
+                * Directory inode is always on overlay st_dev.
+                * Non-dir with ovl_same_dev() could be on pseudo st_dev in case
+                * of xino bits overflow.
+                */
+               WARN_ON_ONCE(S_ISDIR(stat.mode) &&
+                            dir->d_sb->s_dev != stat.dev);
                ino = stat.ino;
        } else if (xinobits && !OVL_TYPE_UPPER(type)) {
                ino = ovl_remap_lower_ino(ino, xinobits,