diff options
author | Gao Xiang <hsiangkao@aol.com> | 2020-12-05 01:20:41 +0800 |
---|---|---|
committer | Gao Xiang <hsiangkao@aol.com> | 2020-12-05 16:24:04 +0800 |
commit | d563ce600618a13ffae54c45a1e7cb0c96ead82b (patch) | |
tree | 329158d2ff5cb46a8fc56c757ef816476c7c7ab1 | |
parent | 2293451607f7e7bcc56534fd7d96c0708bd76a64 (diff) | |
download | erofs-utils-d563ce600618a13ffae54c45a1e7cb0c96ead82b.tar.gz |
erofs-utils: don't create hardlinked directories
Fix an issue which behaves the same as the following
mkisofs BZ due to bindmount:
https://bugzilla.redhat.com/show_bug.cgi?id=1749860
Link: https://lore.kernel.org/r/20201204172042.24180-1-hsiangkao@aol.com
Fixes: a17497f0844a ("erofs-utils: introduce inode operations")
Reviewed-by: Li Guifu <bluce.lee@aliyun.com>
Signed-off-by: Gao Xiang <hsiangkao@aol.com>
-rw-r--r-- | lib/inode.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/inode.c b/lib/inode.c index 388d21d..1cf813d 100644 --- a/lib/inode.c +++ b/lib/inode.c @@ -823,9 +823,16 @@ struct erofs_inode *erofs_iget_from_path(const char *path, bool is_src) if (ret) return ERR_PTR(-errno); - inode = erofs_iget(st.st_ino); - if (inode) - return inode; + /* + * lookup in hash table first, if it already exists we have a + * hard-link, just return it. Also don't lookup for directories + * since hard-link directory isn't allowed. + */ + if (!S_ISDIR(st.st_mode)) { + inode = erofs_iget(st.st_ino); + if (inode) + return inode; + } /* cannot find in the inode cache */ inode = erofs_new_inode(); |