* [PATCH] ovl: fix wrong WARN_ON() in ovl_cache_update_ino()
@ 2019-12-23 6:40 Amir Goldstein
2020-01-06 6:35 ` Amir Goldstein
0 siblings, 1 reply; 5+ messages in thread
From: Amir Goldstein @ 2019-12-23 6:40 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: linux-unionfs
The WARN_ON() that child entry is always on overlay st_dev became wrong
when we allowed this function to update d_ino in non-samefs setup with
xino enabled.
It is not true in case of xino bits overflow on a non-dir inode.
Leave the WARN_ON() only for directories, where assertion is still true.
Fixes: adbf4f7ea834 ("ovl: consistent d_ino for non-samefs with xino")
Cc: <stable@vger.kernel.org> # v4.17+
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
Hi Miklos,
Another fall out from testing nested xino setup.
Thanks,
Amir.
fs/overlayfs/readdir.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 47a91c9733a5..7255e6a5838f 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -504,7 +504,13 @@ static int ovl_cache_update_ino(struct path *path, struct ovl_cache_entry *p)
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,
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ovl: fix wrong WARN_ON() in ovl_cache_update_ino()
2019-12-23 6:40 [PATCH] ovl: fix wrong WARN_ON() in ovl_cache_update_ino() Amir Goldstein
@ 2020-01-06 6:35 ` Amir Goldstein
2020-01-21 10:04 ` Amir Goldstein
0 siblings, 1 reply; 5+ messages in thread
From: Amir Goldstein @ 2020-01-06 6:35 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: overlayfs
On Mon, Dec 23, 2019 at 8:40 AM Amir Goldstein <amir73il@gmail.com> wrote:
>
> The WARN_ON() that child entry is always on overlay st_dev became wrong
> when we allowed this function to update d_ino in non-samefs setup with
> xino enabled.
>
> It is not true in case of xino bits overflow on a non-dir inode.
> Leave the WARN_ON() only for directories, where assertion is still true.
>
> Fixes: adbf4f7ea834 ("ovl: consistent d_ino for non-samefs with xino")
> Cc: <stable@vger.kernel.org> # v4.17+
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>
Miklos,
If you have time, please send this one to Linus for v5.5.
It is a simple fix and the only one causing failure in the new xfstests [1]
that I posted.
Thanks,
Amir.
[1] https://lore.kernel.org/fstests/20191230141423.31695-1-amir73il@gmail.com/
>
> fs/overlayfs/readdir.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
> index 47a91c9733a5..7255e6a5838f 100644
> --- a/fs/overlayfs/readdir.c
> +++ b/fs/overlayfs/readdir.c
> @@ -504,7 +504,13 @@ static int ovl_cache_update_ino(struct path *path, struct ovl_cache_entry *p)
> 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,
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ovl: fix wrong WARN_ON() in ovl_cache_update_ino()
2020-01-06 6:35 ` Amir Goldstein
@ 2020-01-21 10:04 ` Amir Goldstein
2020-01-21 10:07 ` Miklos Szeredi
0 siblings, 1 reply; 5+ messages in thread
From: Amir Goldstein @ 2020-01-21 10:04 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: overlayfs
On Mon, Jan 6, 2020 at 8:35 AM Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Mon, Dec 23, 2019 at 8:40 AM Amir Goldstein <amir73il@gmail.com> wrote:
> >
> > The WARN_ON() that child entry is always on overlay st_dev became wrong
> > when we allowed this function to update d_ino in non-samefs setup with
> > xino enabled.
> >
> > It is not true in case of xino bits overflow on a non-dir inode.
> > Leave the WARN_ON() only for directories, where assertion is still true.
> >
> > Fixes: adbf4f7ea834 ("ovl: consistent d_ino for non-samefs with xino")
> > Cc: <stable@vger.kernel.org> # v4.17+
> > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> > ---
> >
>
> Miklos,
>
> If you have time, please send this one to Linus for v5.5.
> It is a simple fix and the only one causing failure in the new xfstests [1]
> that I posted.
>
Gentle nudge..
Thanks,
Amir.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ovl: fix wrong WARN_ON() in ovl_cache_update_ino()
2020-01-21 10:04 ` Amir Goldstein
@ 2020-01-21 10:07 ` Miklos Szeredi
2020-01-24 6:49 ` Amir Goldstein
0 siblings, 1 reply; 5+ messages in thread
From: Miklos Szeredi @ 2020-01-21 10:07 UTC (permalink / raw)
To: Amir Goldstein; +Cc: overlayfs
On Tue, Jan 21, 2020 at 11:04 AM Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Mon, Jan 6, 2020 at 8:35 AM Amir Goldstein <amir73il@gmail.com> wrote:
> >
> > On Mon, Dec 23, 2019 at 8:40 AM Amir Goldstein <amir73il@gmail.com> wrote:
> > >
> > > The WARN_ON() that child entry is always on overlay st_dev became wrong
> > > when we allowed this function to update d_ino in non-samefs setup with
> > > xino enabled.
> > >
> > > It is not true in case of xino bits overflow on a non-dir inode.
> > > Leave the WARN_ON() only for directories, where assertion is still true.
> > >
> > > Fixes: adbf4f7ea834 ("ovl: consistent d_ino for non-samefs with xino")
> > > Cc: <stable@vger.kernel.org> # v4.17+
> > > Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> > > ---
> > >
> >
> > Miklos,
> >
> > If you have time, please send this one to Linus for v5.5.
> > It is a simple fix and the only one causing failure in the new xfstests [1]
> > that I posted.
> >
>
> Gentle nudge..
I'm working this into the next batch bound for 5.6, unless something
more urgent comes up before that.
Thanks,
Miklos
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ovl: fix wrong WARN_ON() in ovl_cache_update_ino()
2020-01-21 10:07 ` Miklos Szeredi
@ 2020-01-24 6:49 ` Amir Goldstein
0 siblings, 0 replies; 5+ messages in thread
From: Amir Goldstein @ 2020-01-24 6:49 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: overlayfs
> I'm working this into the next batch bound for 5.6, unless something
> more urgent comes up before that.
>
overlayfs-next tested.
ovl-ino rebased.
You would probably want to squash the "merge conflict" below to overlayfs-next.
Thanks,
Amir.
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1348,7 +1348,7 @@ static int ovl_get_layers(struct super_block
*sb, struct ovl_fs *ofs,
*/
err = get_anon_bdev(&ofs->fs[0].pseudo_dev);
if (err) {
- pr_err("overlayfs: failed to get anonymous bdev for
upper fs\n");
+ pr_err("failed to get anonymous bdev for upper fs\n");
goto out;
}
@@ -1409,7 +1409,7 @@ static int ovl_get_layers(struct super_block
*sb, struct ovl_fs *ofs,
*/
if (ofs->numfs - !ofs->upper_mnt == 1) {
if (ofs->config.xino == OVL_XINO_ON)
- pr_info("overlayfs: \"xino=on\" is useless
with all layers on same fs, ignore.\n");
+ pr_info("\"xino=on\" is useless with all
layers on same fs, ignore.\n");
ofs->xino_mode = 0;
} else if (ofs->config.xino == OVL_XINO_ON && ofs->xino_mode < 0) {
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-01-24 6:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-23 6:40 [PATCH] ovl: fix wrong WARN_ON() in ovl_cache_update_ino() Amir Goldstein
2020-01-06 6:35 ` Amir Goldstein
2020-01-21 10:04 ` Amir Goldstein
2020-01-21 10:07 ` Miklos Szeredi
2020-01-24 6:49 ` Amir Goldstein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).