Skip to content

Commit 1b9c513

Browse files
committed
Merge: Update overlayfs to v6.7
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6602 JIRA: https://issues.redhat.com/browse/RHEL-83562 Update overlayfs to the v6.7 kernel level plus bug fixes. Three patches are reverted up front and re-applied at the proper place in the patch series. This reduces conflicts caused by out of order application. Omitted-fix: 853b8d7 ("remap_range: merge do_clone_file_range() into vfs_clone_file_range()") Omitted-fix: a474d84 ("mm/shmem: refactor to reuse vfs_parse_monolithic_sep for option parsing") Omitted-fix: 97ac489 ("fanotify: limit reporting of event with non-decodeable file handles") Omitted-fix: 974e3fe ("fs: relax assertions on failure to encode file handles") Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Approved-by: Ian Kent <ikent@redhat.com> Approved-by: Carlos Maiolino <cmaiolino@redhat.com> Approved-by: David Howells <dhowells@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents b8b8e51 + ba8894a commit 1b9c513

File tree

24 files changed

+2028
-1233
lines changed

24 files changed

+2028
-1233
lines changed

Documentation/filesystems/overlayfs.rst

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,11 @@ Mount options:
240240
Redirects are enabled.
241241
- "redirect_dir=follow":
242242
Redirects are not created, but followed.
243-
- "redirect_dir=off":
244-
Redirects are not created and only followed if "redirect_always_follow"
245-
feature is enabled in the kernel/module config.
246243
- "redirect_dir=nofollow":
247-
Redirects are not created and not followed (equivalent to "redirect_dir=off"
248-
if "redirect_always_follow" feature is not enabled).
244+
Redirects are not created and not followed.
245+
- "redirect_dir=off":
246+
If "redirect_always_follow" is enabled in the kernel/module config,
247+
this "off" traslates to "follow", otherwise it translates to "nofollow".
249248

250249
When the NFS export feature is enabled, every copied up directory is
251250
indexed by the file handle of the lower inode and a file handle of the
@@ -349,6 +348,19 @@ The specified lower directories will be stacked beginning from the
349348
rightmost one and going left. In the above example lower1 will be the
350349
top, lower2 the middle and lower3 the bottom layer.
351350

351+
Note: directory names containing colons can be provided as lower layer by
352+
escaping the colons with a single backslash. For example:
353+
354+
mount -t overlay overlay -olowerdir=/a\:lower\:\:dir /merged
355+
356+
Since kernel version v6.8, directory names containing colons can also
357+
be configured as lower layer using the "lowerdir+" mount options and the
358+
fsconfig syscall from new mount api. For example:
359+
360+
fsconfig(fs_fd, FSCONFIG_SET_STRING, "lowerdir+", "/a:lower::dir", 0);
361+
362+
In the latter case, colons in lower layer directory names will be escaped
363+
as an octal characters (\072) when displayed in /proc/self/mountinfo.
352364

353365
Metadata only copy up
354366
---------------------
@@ -414,6 +426,16 @@ Only the data of the files in the "data-only" lower layers may be visible
414426
when a "metacopy" file in one of the lower layers above it, has a "redirect"
415427
to the absolute path of the "lower data" file in the "data-only" lower layer.
416428

429+
Since kernel version v6.8, "data-only" lower layers can also be added using
430+
the "datadir+" mount options and the fsconfig syscall from new mount api.
431+
For example:
432+
433+
fsconfig(fs_fd, FSCONFIG_SET_STRING, "lowerdir+", "/l1", 0);
434+
fsconfig(fs_fd, FSCONFIG_SET_STRING, "lowerdir+", "/l2", 0);
435+
fsconfig(fs_fd, FSCONFIG_SET_STRING, "lowerdir+", "/l3", 0);
436+
fsconfig(fs_fd, FSCONFIG_SET_STRING, "datadir+", "/do1", 0);
437+
fsconfig(fs_fd, FSCONFIG_SET_STRING, "datadir+", "/do2", 0);
438+
417439

418440
fs-verity support
419441
----------------------
@@ -542,6 +564,9 @@ b) If a file residing on a lower layer is opened for read-only and then
542564
memory mapped with MAP_SHARED, then subsequent changes to the file are not
543565
reflected in the memory mapping.
544566

567+
c) If a file residing on a lower layer is being executed, then opening that
568+
file for write or truncating the file will not be denied with ETXTBSY.
569+
545570
The following options allow overlayfs to act more like a standards
546571
compliant filesystem:
547572

@@ -688,6 +713,31 @@ can be useful in case the underlying disk is copied and the UUID of this copy
688713
is changed. This is only applicable if all lower/upper/work directories are on
689714
the same filesystem, otherwise it will fallback to normal behaviour.
690715

716+
717+
UUID and fsid
718+
-------------
719+
720+
The UUID of overlayfs instance itself and the fsid reported by statfs(2) are
721+
controlled by the "uuid" mount option, which supports these values:
722+
723+
- "null":
724+
UUID of overlayfs is null. fsid is taken from upper most filesystem.
725+
- "off":
726+
UUID of overlayfs is null. fsid is taken from upper most filesystem.
727+
UUID of underlying layers is ignored.
728+
- "on":
729+
UUID of overlayfs is generated and used to report a unique fsid.
730+
UUID is stored in xattr "trusted.overlay.uuid", making overlayfs fsid
731+
unique and persistent. This option requires an overlayfs with upper
732+
filesystem that supports xattrs.
733+
- "auto": (default)
734+
UUID is taken from xattr "trusted.overlay.uuid" if it exists.
735+
Upgrade to "uuid=on" on first time mount of new overlay filesystem that
736+
meets the prerequites.
737+
Downgrade to "uuid=null" for existing overlay filesystems that were never
738+
mounted with "uuid=on".
739+
740+
691741
Volatile mount
692742
--------------
693743

fs/fs_context.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,19 @@ int vfs_parse_fs_string(struct fs_context *fc, const char *key,
188188
EXPORT_SYMBOL(vfs_parse_fs_string);
189189

190190
/**
191-
* generic_parse_monolithic - Parse key[=val][,key[=val]]* mount data
192-
* @ctx: The superblock configuration to fill in.
191+
* vfs_parse_monolithic_sep - Parse key[=val][,key[=val]]* mount data
192+
* @fc: The superblock configuration to fill in.
193193
* @data: The data to parse
194+
* @sep: callback for separating next option
194195
*
195-
* Parse a blob of data that's in key[=val][,key[=val]]* form. This can be
196-
* called from the ->monolithic_mount_data() fs_context operation.
196+
* Parse a blob of data that's in key[=val][,key[=val]]* form with a custom
197+
* option separator callback.
197198
*
198199
* Returns 0 on success or the error returned by the ->parse_option() fs_context
199200
* operation on failure.
200201
*/
201-
int generic_parse_monolithic(struct fs_context *fc, void *data)
202+
int vfs_parse_monolithic_sep(struct fs_context *fc, void *data,
203+
char *(*sep)(char **))
202204
{
203205
char *options = data, *key;
204206
int ret = 0;
@@ -210,7 +212,7 @@ int generic_parse_monolithic(struct fs_context *fc, void *data)
210212
if (ret)
211213
return ret;
212214

213-
while ((key = strsep(&options, ",")) != NULL) {
215+
while ((key = sep(&options)) != NULL) {
214216
if (*key) {
215217
size_t v_len = 0;
216218
char *value = strchr(key, '=');
@@ -229,6 +231,28 @@ int generic_parse_monolithic(struct fs_context *fc, void *data)
229231

230232
return ret;
231233
}
234+
EXPORT_SYMBOL(vfs_parse_monolithic_sep);
235+
236+
static char *vfs_parse_comma_sep(char **s)
237+
{
238+
return strsep(s, ",");
239+
}
240+
241+
/**
242+
* generic_parse_monolithic - Parse key[=val][,key[=val]]* mount data
243+
* @fc: The superblock configuration to fill in.
244+
* @data: The data to parse
245+
*
246+
* Parse a blob of data that's in key[=val][,key[=val]]* form. This can be
247+
* called from the ->monolithic_mount_data() fs_context operation.
248+
*
249+
* Returns 0 on success or the error returned by the ->parse_option() fs_context
250+
* operation on failure.
251+
*/
252+
int generic_parse_monolithic(struct fs_context *fc, void *data)
253+
{
254+
return vfs_parse_monolithic_sep(fc, data, vfs_parse_comma_sep);
255+
}
232256
EXPORT_SYMBOL(generic_parse_monolithic);
233257

234258
/**

fs/namespace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ int __mnt_want_write(struct vfsmount *m)
361361

362362
return ret;
363363
}
364+
EXPORT_SYMBOL_GPL(__mnt_want_write);
364365

365366
/**
366367
* mnt_want_write - get write access to a mount
@@ -441,6 +442,7 @@ void __mnt_drop_write(struct vfsmount *mnt)
441442
mnt_dec_writers(real_mount(mnt));
442443
preempt_enable();
443444
}
445+
EXPORT_SYMBOL_GPL(__mnt_drop_write);
444446

445447
/**
446448
* mnt_drop_write - give up write access to a mount

fs/overlayfs/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ config OVERLAY_FS_XINO_AUTO
9696
depends on 64BIT
9797
help
9898
If this config option is enabled then overlay filesystems will use
99-
unused high bits in undelying filesystem inode numbers to map all
99+
unused high bits in underlying filesystem inode numbers to map all
100100
inodes to a unified address space. The mapped 64bit inode numbers
101101
might not be compatible with applications that expect 32bit inodes.
102102

fs/overlayfs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
obj-$(CONFIG_OVERLAY_FS) += overlay.o
77

88
overlay-objs := super.o namei.o util.o inode.o file.o dir.o readdir.o \
9-
copy_up.o export.o xattrs.o
9+
copy_up.o export.o params.o xattrs.o

0 commit comments

Comments
 (0)