summaryrefslogtreecommitdiffstats
path: root/fs/ext4/file.c
diff options
context:
space:
mode:
authorRitesh Harjani (IBM) <ritesh.list@gmail.com>2024-11-05 01:22:59 +0100
committerDarrick J. Wong <djwong@djwong.org>2024-11-06 01:20:40 +0100
commitb7987a7d69a4a17b7f334f5c100d6729ebcc2ccb (patch)
treee060204d5b0ef09c7605884ad97fb8d8ab924ce9 /fs/ext4/file.c
parentext4: Check for atomic writes support in write iter (diff)
downloadlinux-b7987a7d69a4a17b7f334f5c100d6729ebcc2ccb.tar.xz
linux-b7987a7d69a4a17b7f334f5c100d6729ebcc2ccb.zip
ext4: Support setting FMODE_CAN_ATOMIC_WRITE
FS needs to add the fmode capability in order to support atomic writes during file open (refer kiocb_set_rw_flags()). Set this capability on a regular file if ext4 can do atomic write. Reviewed-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext4/file.c')
-rw-r--r--fs/ext4/file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index a7b9b9751a3f..96d936f5584b 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -898,6 +898,9 @@ static int ext4_file_open(struct inode *inode, struct file *filp)
return ret;
}
+ if (ext4_inode_can_atomic_write(inode))
+ filp->f_mode |= FMODE_CAN_ATOMIC_WRITE;
+
filp->f_mode |= FMODE_NOWAIT | FMODE_CAN_ODIRECT;
return dquot_file_open(inode, filp);
}