Skip to contentSkip to conversation

ovl: handle ENOENT on index lookup

PATCH New Amir Goldstein 1 participant 1 message Oct 20, 2017

Subsystems (2)
lore
Share & tools
lore

Amir Goldstein

author maintainer
#0 lore raw

PATCH v2 1/1 ovl: handle ENOENT on index lookup

Treat ENOENT from index entry lookup the same way as treating a returned negative dentry. Apparently, either could be returned if file is not found, depending on the underlying file system.

Fixes 359f392ca53e ("ovl: lookup index entry for copy up origin")
Cc <[email protected]> # v4.13

---

Miklos,

Please apply or squash this patch with with "ovl: fix EIO from lookup of non-indexed upper".

Changes from v1:
- Print the warning also for ENOENT case
- Add body to commit messaage

 fs/overlayfs/namei.c | 5 +++++
 1 file changed, 5 insertions(+)
fs/overlayfs/namei.c +5 -0
index 49441e8be722..0a72b855f4aa 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 notfound;
+		}
 		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,
@@ -516,6 +520,7 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry,
 
 	inode = d_inode(index);
 	if (d_is_negative(index)) {
+notfound:
 		if (upper && d_inode(origin)->i_nlink > 1) {
 			pr_warn_ratelimited("overlayfs: hard link with origin but no index (%pd2).\n",
 					    upper);
Signature · 1 line
2.7.4