Re: Question about O_APPEND | O_DIRECT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2023-11-23 at 18:14 +0000, Tao Lyu wrote:
> Hi,
> 
> Sorry to bother you here.
> 
> I'm using NFS and realize it doesn't support opening a file with
> "O_DIRECT | O_APPEND".
> 
> After checking the source code, 
> I found it has one function that checks explicitly whether there is a
> combination flag of "O_APPEND | O_DIRECT".
> If so, it will return invalid arguments.
> 
> int nfs_check_flags(int flags)
> {
>     if ((flags & (O_APPEND | O_DIRECT)) == (O_APPEND | O_DIRECT))
>         return -EINVAL;
> 
>     return 0;
> }
> 
> But I don't understand why NFS doesn't support this flag combination.
> I'd appreciate it if someone could explain this to me.


Why do you need O_APPEND|O_DIRECT?

In order to implement O_APPEND|O_DIRECT, we would need to add an APPEND
operation, which does not exist in the NFS protocol. The WRITE
operation does not suffice, because it requires you to know the offset
at which you will be writing the data.

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@xxxxxxxxxxxxxxx






[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux