diff options
author | Ritesh Harjani (IBM) <ritesh.list@gmail.com> | 2024-11-05 01:22:59 +0100 |
---|---|---|
committer | Darrick J. Wong <djwong@djwong.org> | 2024-11-06 01:20:40 +0100 |
commit | b7987a7d69a4a17b7f334f5c100d6729ebcc2ccb (patch) | |
tree | e060204d5b0ef09c7605884ad97fb8d8ab924ce9 /fs/ext4/file.c | |
parent | ext4: Check for atomic writes support in write iter (diff) | |
download | linux-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.c | 3 |
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); } |