[Devel] [PATCH RHEL8 COMMIT] ext4/balloon: Use proper O_ mode flags in balloon opening code

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 24 11:59:05 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.31
------>
commit 1ca7fa727af37253ed486a6aa53dffb828c5692d
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri May 21 17:29:27 2021 +0300

    ext4/balloon: Use proper O_ mode flags in balloon opening code
    
    alloc_file() expects O_* mode flags, so provide them, not
    internal FMODE_* ones.
    
    Fixes: bee340a206d7 ("ext4: Provide a balloon nipple for management")
    https://jira.sw.ru/browse/PSBM-129392
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/ext4/ioctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index ecdc15881007..6d5b5e2eda91 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -775,11 +775,11 @@ static int ext4_open_balloon(struct super_block *sb, struct vfsmount *mnt)
 	path.mnt = mntget(mnt);
 	err = mnt_want_write(path.mnt);
 	if (err)
-		mode = FMODE_READ;
+		mode = O_RDONLY;
 	else
-		mode = FMODE_READ | FMODE_WRITE;
+		mode = O_RDWR;
 	filp = alloc_file(&path, mode, &ext4_file_operations);
-	if (mode & FMODE_WRITE)
+	if (filp->f_mode & FMODE_WRITE)
 		mnt_drop_write(path.mnt);
 	if (IS_ERR(filp)) {
 		err = PTR_ERR(filp);


More information about the Devel mailing list