misc: Add support for Linux uio.h RWF_ATOMIC and RWF_NOAPPEND flags
Resolves: RHEL-87646
This commit is contained in:
parent
06d55fdb46
commit
b7e6283f1a
67
glibc-RHEL-87646-1.patch
Normal file
67
glibc-RHEL-87646-1.patch
Normal file
@ -0,0 +1,67 @@
|
||||
commit 3db9d208dd5f30b12900989c6d2214782b8e2011
|
||||
Author: Stafford Horne <shorne@gmail.com>
|
||||
Date: Wed Apr 3 06:40:37 2024 +0100
|
||||
|
||||
misc: Add support for Linux uio.h RWF_NOAPPEND flag
|
||||
|
||||
In Linux 6.9 a new flag is added to allow for Per-io operations to
|
||||
disable append mode even if a file was opened with the flag O_APPEND.
|
||||
This is done with the new RWF_NOAPPEND flag.
|
||||
|
||||
This caused two test failures as these tests expected the flag 0x00000020
|
||||
to be unused. Adding the flag definition now fixes these tests on Linux
|
||||
6.9 (v6.9-rc1).
|
||||
|
||||
FAIL: misc/tst-preadvwritev2
|
||||
FAIL: misc/tst-preadvwritev64v2
|
||||
|
||||
This patch adds the flag, adjusts the test and adds details to
|
||||
documentation.
|
||||
|
||||
Link: https://lore.kernel.org/all/20200831153207.GO3265@brightrain.aerifal.cx/
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
diff --git a/manual/llio.texi b/manual/llio.texi
|
||||
index 0b61d491f5..fae49d1433 100644
|
||||
--- a/manual/llio.texi
|
||||
+++ b/manual/llio.texi
|
||||
@@ -1339,6 +1339,10 @@ will fail and set @code{errno} to @code{EAGAIN} if the operation would block.
|
||||
|
||||
@item RWF_APPEND
|
||||
Per-IO synchronization as if the file was opened with @code{O_APPEND} flag.
|
||||
+
|
||||
+@item RWF_NOAPPEND
|
||||
+This flag allows an offset to be honored, even if the file was opened with
|
||||
+@code{O_APPEND} flag.
|
||||
@end vtable
|
||||
|
||||
When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
|
||||
diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c
|
||||
index b5f19f002c..8e04ff7282 100644
|
||||
--- a/misc/tst-preadvwritev2-common.c
|
||||
+++ b/misc/tst-preadvwritev2-common.c
|
||||
@@ -34,8 +34,11 @@
|
||||
#ifndef RWF_APPEND
|
||||
# define RWF_APPEND 0
|
||||
#endif
|
||||
+#ifndef RWF_NOAPPEND
|
||||
+# define RWF_NOAPPEND 0
|
||||
+#endif
|
||||
#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT \
|
||||
- | RWF_APPEND)
|
||||
+ | RWF_APPEND | RWF_NOAPPEND)
|
||||
|
||||
/* Generic uio_lim.h does not define IOV_MAX. */
|
||||
#ifndef IOV_MAX
|
||||
diff --git a/sysdeps/unix/sysv/linux/bits/uio-ext.h b/sysdeps/unix/sysv/linux/bits/uio-ext.h
|
||||
index 7854cccef3..ead7a09156 100644
|
||||
--- a/sysdeps/unix/sysv/linux/bits/uio-ext.h
|
||||
+++ b/sysdeps/unix/sysv/linux/bits/uio-ext.h
|
||||
@@ -47,6 +47,7 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
|
||||
#define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */
|
||||
#define RWF_NOWAIT 0x00000008 /* per-IO nonblocking mode. */
|
||||
#define RWF_APPEND 0x00000010 /* per-IO O_APPEND. */
|
||||
+#define RWF_NOAPPEND 0x00000020 /* per-IO negation of O_APPEND */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
67
glibc-RHEL-87646-2.patch
Normal file
67
glibc-RHEL-87646-2.patch
Normal file
@ -0,0 +1,67 @@
|
||||
commit 5ffc903216901914dc2ad9715088d3fe9d1ef205
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Tue Oct 8 15:45:29 2024 -0300
|
||||
|
||||
misc: Add support for Linux uio.h RWF_ATOMIC flag
|
||||
|
||||
Linux 6.11 adds the new flag for pwritev2 (commit
|
||||
c34fc6f26ab86d03a2d47446f42b6cd492dfdc56).
|
||||
|
||||
Checked on x86_64-linux-gnu on 6.11 kernel.
|
||||
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
|
||||
diff --git a/manual/llio.texi b/manual/llio.texi
|
||||
index 05ab44c6e7..0eb336f70b 100644
|
||||
--- a/manual/llio.texi
|
||||
+++ b/manual/llio.texi
|
||||
@@ -1381,6 +1381,19 @@ Per-IO synchronization as if the file was opened with @code{O_APPEND} flag.
|
||||
@item RWF_NOAPPEND
|
||||
This flag allows an offset to be honored, even if the file was opened with
|
||||
@code{O_APPEND} flag.
|
||||
+
|
||||
+@item RWF_ATOMIC
|
||||
+Indicate that the write is to be issued with torn-write prevention. The
|
||||
+input buffer should follow some contraints: the total length should be
|
||||
+power-of-2 in size and also sizes between @code{atomic_write_unit_min}
|
||||
+and @code{atomic_write_unit_max}, the @code{struct iovec} count should be
|
||||
+up to @code{atomic_write_segments_max}, and the offset should be
|
||||
+naturally-aligned with regard to total write length.
|
||||
+
|
||||
+The @code{atomic_*} values can be obtained with @code{statx} along with
|
||||
+@code{STATX_WRITE_ATOMIC} flag.
|
||||
+
|
||||
+This is a Linux-specific extension.
|
||||
@end vtable
|
||||
|
||||
When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the
|
||||
diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c
|
||||
index 8e04ff7282..4556421a43 100644
|
||||
--- a/misc/tst-preadvwritev2-common.c
|
||||
+++ b/misc/tst-preadvwritev2-common.c
|
||||
@@ -37,8 +37,11 @@
|
||||
#ifndef RWF_NOAPPEND
|
||||
# define RWF_NOAPPEND 0
|
||||
#endif
|
||||
+#ifndef RWF_ATOMIC
|
||||
+# define RWF_ATOMIC 0
|
||||
+#endif
|
||||
#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT \
|
||||
- | RWF_APPEND | RWF_NOAPPEND)
|
||||
+ | RWF_APPEND | RWF_NOAPPEND | RWF_ATOMIC)
|
||||
|
||||
/* Generic uio_lim.h does not define IOV_MAX. */
|
||||
#ifndef IOV_MAX
|
||||
diff --git a/sysdeps/unix/sysv/linux/bits/uio-ext.h b/sysdeps/unix/sysv/linux/bits/uio-ext.h
|
||||
index ead7a09156..85ed21bac5 100644
|
||||
--- a/sysdeps/unix/sysv/linux/bits/uio-ext.h
|
||||
+++ b/sysdeps/unix/sysv/linux/bits/uio-ext.h
|
||||
@@ -48,6 +48,8 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
|
||||
#define RWF_NOWAIT 0x00000008 /* per-IO nonblocking mode. */
|
||||
#define RWF_APPEND 0x00000010 /* per-IO O_APPEND. */
|
||||
#define RWF_NOAPPEND 0x00000020 /* per-IO negation of O_APPEND */
|
||||
+#define RWF_ATOMIC 0x00000040 /* Write is to be issued with torn-write
|
||||
+ prevention. */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
35
glibc-RHEL-87646-3.patch
Normal file
35
glibc-RHEL-87646-3.patch
Normal file
@ -0,0 +1,35 @@
|
||||
commit 58a31b4316f1f687184eb147ffa1c676bc6a190e
|
||||
Author: Yury Khrustalev <yury.khrustalev@arm.com>
|
||||
Date: Thu Nov 6 12:57:58 2025 +0000
|
||||
|
||||
posix: Fix invalid flags test for p{write,read}v2
|
||||
|
||||
Two tests fail from time to time when a new flag is added for the
|
||||
p{write,read}v2 functions in a new Linux kernel:
|
||||
|
||||
- misc/tst-preadvwritev2
|
||||
- misc/tst-preadvwritev64v2
|
||||
|
||||
This disrupts when testing Glibc on a system with a newer kernel
|
||||
and it seems we can try improve testing for invalid flags setting
|
||||
all the bits that are not supposed to be supported (rather than
|
||||
setting only the next unsupported bit).
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c
|
||||
index 8a59ff2f9d..05fb899cd2 100644
|
||||
--- a/misc/tst-preadvwritev2-common.c
|
||||
+++ b/misc/tst-preadvwritev2-common.c
|
||||
@@ -113,9 +113,8 @@ do_test_with_invalid_iov (void)
|
||||
static void
|
||||
do_test_with_invalid_flags (void)
|
||||
{
|
||||
- /* Set the next bit from the mask of all supported flags. */
|
||||
- int invalid_flag = RWF_SUPPORTED != 0 ? __builtin_clz (RWF_SUPPORTED) : 2;
|
||||
- invalid_flag = 0x1 << ((sizeof (int) * CHAR_BIT) - invalid_flag);
|
||||
+ /* Set all the bits that are not used by the supported flags. */
|
||||
+ int invalid_flag = ~RWF_SUPPORTED;
|
||||
|
||||
char buf[32];
|
||||
const struct iovec vec = { .iov_base = buf, .iov_len = sizeof (buf) };
|
||||
Loading…
Reference in New Issue
Block a user