Skip to content

Commit 004b8d1

Browse files
author
Miklos Szeredi
committed
ovl: fix encoding fid for lower only root
ovl_check_encode_origin() should return a positive number if the lower dentry is to be encoded, zero otherwise. If there's no upper layer at all (read-only overlay), then it obviously needs to return positive. This was broken by commit 16aac5a ("ovl: support encoding non-decodable file handles"), which didn't take the lower-only configuration into account. Fix by checking the no-upper-layer case up-front. Reported-and-tested-by: Youzhong Yang <[email protected]> Closes: https://lore.kernel.org/all/CADpNCvaBimi+zCYfRJHvCOhMih8OU0rmZkwLuh24MKKroRuT8Q@mail.gmail.com/ Fixes: 16aac5a ("ovl: support encoding non-decodable file handles") Cc: <[email protected]> # v6.6 Signed-off-by: Miklos Szeredi <[email protected]>
1 parent db03d39 commit 004b8d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/overlayfs/export.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ static int ovl_check_encode_origin(struct dentry *dentry)
181181
struct ovl_fs *ofs = OVL_FS(dentry->d_sb);
182182
bool decodable = ofs->config.nfs_export;
183183

184+
/* No upper layer? */
185+
if (!ovl_upper_mnt(ofs))
186+
return 1;
187+
184188
/* Lower file handle for non-upper non-decodable */
185189
if (!ovl_dentry_upper(dentry) && !decodable)
186190
return 1;
@@ -209,7 +213,7 @@ static int ovl_check_encode_origin(struct dentry *dentry)
209213
* ovl_connect_layer() will try to make origin's layer "connected" by
210214
* copying up a "connectable" ancestor.
211215
*/
212-
if (d_is_dir(dentry) && ovl_upper_mnt(ofs) && decodable)
216+
if (d_is_dir(dentry) && decodable)
213217
return ovl_connect_layer(dentry);
214218

215219
/* Lower file handle for indexed and non-upper dir/non-dir */

0 commit comments

Comments
 (0)