diff options
author | Amir Goldstein <amir73il@gmail.com> | 2023-04-02 21:56:49 +0300 |
---|---|---|
committer | Amir Goldstein <amir73il@gmail.com> | 2023-06-19 14:01:14 +0300 |
commit | 416656447864ef0fc2430525499f52a4a370a0ab (patch) | |
tree | a846326abea45b0377037ab32220364df3d98702 /fs/overlayfs/file.c | |
parent | 2b21da920866ad20b5e3119f3b8d2267774b7b0a (diff) |
ovl: prepare for lazy lookup of lowerdata inode
Make the code handle the case of numlower > 1 and missing lowerdata
dentry gracefully.
Missing lowerdata dentry is an indication for lazy lookup of lowerdata
and in that case the lowerdata_redirect path is stored in ovl_inode.
Following commits will defer lookup and perform the lazy lookup on
access.
Reviewed-by: Alexander Larsson <alexl@redhat.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/file.c')
-rw-r--r-- | fs/overlayfs/file.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index 7c04f033aadd..951683a66ff6 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -115,6 +115,9 @@ static int ovl_real_fdget_meta(const struct file *file, struct fd *real, ovl_path_real(dentry, &realpath); else ovl_path_realdata(dentry, &realpath); + /* TODO: lazy lookup of lowerdata */ + if (!realpath.dentry) + return -EIO; /* Has it been copied up since we'd opened it? */ if (unlikely(file_inode(real->file) != d_inode(realpath.dentry))) { @@ -158,6 +161,10 @@ static int ovl_open(struct inode *inode, struct file *file) file->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); ovl_path_realdata(dentry, &realpath); + /* TODO: lazy lookup of lowerdata */ + if (!realpath.dentry) + return -EIO; + realfile = ovl_open_realfile(file, &realpath); if (IS_ERR(realfile)) return PTR_ERR(realfile); |