Re: linux NFS client lock file cannot get a expected response

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

 



On Tue, Feb 19, 2019 at 10:09:25AM +0800, Gefei Li wrote:
> Thanks a lot for your reply! I tried to capture and analyse the
> network packets with wireshark and find that a NFS4ERR_LOCKED(10012)
> replied in my experiment 2.2(open with O_SYNC and write) Write
> response. Does this mean that my NFS server uses mandatory locking?

Yes.  I think that's expected for Windows.

> But something unexpected is that an EAGAIN(Resource temporarily
> unavailable) returned in user space, I think an EACCES/EIO is better
> for locked situations, what's your idea about this?

I don't know.

EAGAIN is what fcntl returns when there's a conflicting lock.  It
suggests that retrying might work, while EIO and EACCES suggest that the
failure is permanent.

In the case of linux mandatory locks (see the "mandatory locking"
section in fcntl(2)), read and write block unless you open with
O_NONBLOCK, in which case they return EAGAIN.  Blocking would be more
complicated for the NFS client as all it could do would be to retry the
write repeatedly.

> >> You're checking the file content on the server somehow?
> I close my lock program in my first shell, and check from both
> server-side(use notepad to view the file) and client-side(cat/vim to
> view the file), the file content remained unchanged.

Got it.

--b.



[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