Skip to contentSkip to conversation

ovl: handle ENOENT on index lookup

PATCH Superseded Amir Goldstein 3 participants 5 messages Oct 20, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Amir Goldstein

author maintainer
#0 lore raw

PATCH 1/1 ovl: handle ENOENT on index lookup

Fixes 359f392ca53e ("ovl: lookup index entry for copy up origin")
Cc <[email protected]> # v4.13
---
 fs/overlayfs/namei.c | 4 ++++
 1 file changed, 4 insertions(+)

Miklos,

This is a complimentary/fixup patch to the patch currently at the tip of overlayfs-next. I did not run into ENOENT in my tests, but it seems that all other places in overlayfs that call lookup_one_len_unlocked() check the ENOENT return value and treat it the same as negative dentry.

I suppose this could be expected from some file systems?

Amir.

fs/overlayfs/namei.c +4 -0
index 49441e8be722..a824e6b157f9 100644
@@ -507,6 +507,10 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry,
 	index = lookup_one_len_unlocked(name.name, ofs->indexdir, name.len);
 	if (IS_ERR(index)) {
 		err = PTR_ERR(index);
+		if (err == -ENOENT) {
+			index = NULL;
+			goto out;
+		}
 		pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n"
 				    "overlayfs: mount with '-o index=off' to disable inodes index.\n",
 				    d_inode(origin)->i_ino, name.len, name.name,
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 3 lines · Amir Goldstein
Fixes 359f392ca53e ("ovl: lookup index entry for copy up origin")
Cc <[email protected]> # v4.13

Why is there no changelog at all? Not good, especially for a patch wanting to be sent to the stable trees :(

thanks,

greg k-h

author maintainer
#2 lore raw
Quoted 8 lines · Greg KH
Quoted 3 lines · Amir Goldstein
Fixes 359f392ca53e ("ovl: lookup index entry for copy up origin")
Cc <[email protected]> # v4.13

Why is there no changelog at all? Not good, especially for a patch wanting to be sent to the stable trees :(

Yeh, sorry about that. I was hoping it'd get squashed into an earlier patch which is on overlayfs-next of today and not yet pulled into linux-next. Or rejected.
If that doesn't happen, I'll re-post with commit message.

Amir.

maintainer
#3 lore raw
In reply to Amir Goldstein
Quoted 7 lines · Amir Goldstein
Fixes 359f392ca53e ("ovl: lookup index entry for copy up origin")
Cc <[email protected]> # v4.13
---
 fs/overlayfs/namei.c | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 8 lines

Miklos,

This is a complimentary/fixup patch to the patch currently at the tip of overlayfs-next. I did not run into ENOENT in my tests, but it seems that all other places in overlayfs that call lookup_one_len_unlocked() check the ENOENT return value and treat it the same as negative dentry.

I suppose this could be expected from some file systems?

I haven't done the research, but I suppose it's possible. Nobody is forcing filesystems to cache negative dentries, although not doing so might be stupid.

However, the patch seems to be wrong, since it does not treat -ENOENT quite the same way as a negative index (no warning for hard links).

Btw you can use "--suppress-cc=bodycc" to not spam stable@vger with review patches.

Thanks,
Miklos

author maintainer
#4 lore raw
Quoted 21 lines · Miklos Szeredi
Quoted 7 lines · Amir Goldstein
Fixes 359f392ca53e ("ovl: lookup index entry for copy up origin")
Cc <[email protected]> # v4.13
---
 fs/overlayfs/namei.c | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 8 lines

Miklos,

This is a complimentary/fixup patch to the patch currently at the tip of overlayfs-next. I did not run into ENOENT in my tests, but it seems that all other places in overlayfs that call lookup_one_len_unlocked() check the ENOENT return value and treat it the same as negative dentry.

I suppose this could be expected from some file systems?

I haven't done the research, but I suppose it's possible. Nobody is forcing filesystems to cache negative dentries, although not doing so might be stupid.

Quoted 6 lines

However, the patch seems to be wrong, since it does not treat -ENOENT quite the same way as a negative index (no warning for hard links).

Btw you can use "--suppress-cc=bodycc" to not spam stable@vger with review patches.

OK, but Greg didn't seem annoyed by getting CC'ed - on the contrary.. Anyway, sent fixed v2 and CC'ed stable, since there was already a discussion on v1

Amir.