]> git.baikalelectronics.ru Git - kernel.git/commit
ovl: fix EIO from lookup of non-indexed upper
authorAmir Goldstein <amir73il@gmail.com>
Thu, 12 Oct 2017 16:03:04 +0000 (19:03 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Tue, 24 Oct 2017 14:06:16 +0000 (16:06 +0200)
commit8c4579f58a25af6fec01cd9ed2c6895089c1e94b
tree1b4e2491fe0a90dd60bad88c1bfa14b488cf6677
parentb337ad7dce96a9dcaf214814aefb3ece10926c47
ovl: fix EIO from lookup of non-indexed upper

Commit 7d01a9fc9e0f ("ovl: don't set origin on broken lower hardlink")
attempt to avoid the condition of non-indexed upper inode with lower
hardlink as origin. If this condition is found, lookup returns EIO.

The protection of commit mentioned above does not cover the case of lower
that is not a hardlink when it is copied up (with either index=off/on)
and then lower is hardlinked while overlay is offline.

Changes to lower layer while overlayfs is offline should not result in
unexpected behavior, so a permanent EIO error after creating a link in
lower layer should not be considered as correct behavior.

This fix replaces EIO error with success in cases where upper has origin
but no index is found, or index is found that does not match upper
inode. In those cases, lookup will not fail and the returned overlay inode
will be hashed by upper inode instead of by lower origin inode.

Fixes: 329902f61516 ("ovl: lookup index entry for copy up origin")
Cc: <stable@vger.kernel.org> # v4.13
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/inode.c
fs/overlayfs/namei.c
fs/overlayfs/overlayfs.h