Skip to content

Commit b7987a7

Browse files
riteshharjaniDarrick J. Wong
authored andcommitted
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 <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Ritesh Harjani (IBM) <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Jan Kara <[email protected]>
1 parent 43c696f commit b7987a7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/ext4/file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,9 @@ static int ext4_file_open(struct inode *inode, struct file *filp)
898898
return ret;
899899
}
900900

901+
if (ext4_inode_can_atomic_write(inode))
902+
filp->f_mode |= FMODE_CAN_ATOMIC_WRITE;
903+
901904
filp->f_mode |= FMODE_NOWAIT | FMODE_CAN_ODIRECT;
902905
return dquot_file_open(inode, filp);
903906
}

0 commit comments

Comments
 (0)