aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vollmer <mvollmer@redhat.com>2022-08-24 14:38:48 +0300
committerTheodore Ts'o <tytso@mit.edu>2022-08-24 16:50:26 -0400
commit5cc83a2e5d2f3ec19462529c4144a2993b0c86e4 (patch)
tree39267e4bc3d2d72cd35b8ba3b558a83fa8050be3
parent558146c31d341faae62237eafc0c260bd785a2d7 (diff)
downloade2fsprogs-5cc83a2e5d2f3ec19462529c4144a2993b0c86e4.tar.gz
mmp: don't use O_RDWR in ext2fs_mmp_read
It doesn't seem to be necessary since ext2fs_mmp_write doesn't write via mmp_fd, and opening the block device with O_RDWR will trigger udev. Triggering udev is bad because it leads to an infinite loop when running dumpe2fs in response to a udev event. [ Rebased onto the maint branch, and added O_RDONLY flag. From the open(2) man page: "The argument flags must include one of the following access modes: O_RDONLY, O_WRONLY, or O_RDWR." -- TYT ] Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--lib/ext2fs/mmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ext2fs/mmp.c b/lib/ext2fs/mmp.c
index 9ef458091..7970aac27 100644
--- a/lib/ext2fs/mmp.c
+++ b/lib/ext2fs/mmp.c
@@ -58,7 +58,7 @@ errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf)
* the MMP block by the io_manager or the VM. It needs to be fresh. */
if (fs->mmp_fd <= 0) {
struct stat st;
- int flags = O_RDWR | O_DIRECT;
+ int flags = O_RDONLY | O_DIRECT;
/*
* There is no reason for using O_DIRECT if we're working with