On Tue, Jun 13, 2023 at 08:57:42AM +0800, Xiubo Li wrote: >> + if (S_ISREG(inode->i_mode)) >> + file->f_mode |= FMODE_CAN_ODIRECT; >> > > Shouldn't we do the same in 'ceph_atomic_open()' too ? Yes, probably. Or I really need to press ahead and move the flag to file operations.. >> --- a/fs/ceph/file.c >> +++ b/fs/ceph/file.c >> @@ -368,6 +368,8 @@ int ceph_open(struct inode *inode, struct file *file) >> flags = file->f_flags & ~(O_CREAT|O_EXCL); >> if (S_ISDIR(inode->i_mode)) >> flags = O_DIRECTORY; /* mds likes to know */ >> + if (S_ISREG(inode->i_mode)) > > BTW, the commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") > doesn't check the S_ISREG, and I couldn't see this commit and NFS confine > it to regular files, is that okay ? It doesn't have to. ->direct_IO was previously set only for regular files (and block devices in the block code). So it makes sense to do the same for the flag.