linux NFS client lock file cannot get a expected response

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

 



Hi NFSDevs,

I am recently testing linux nfs lock with NFS share from a WinServer
2016. I tried to write a file which has already been locked with fcntl
exclusively, but the response of `write` syscall is neither
`Permission denied`, nor successfully written with file content
changed. Here is several experiments I did:

The first shell runs c program, calling `fcntl` to lock file
exclusively “fcntl(fd, F_SETLKW, &fl)”

2.1 The second shell tried to open with flag O_RDWR, and write a
buffer to the same file, write returned the correct bytes written, but
the file content remained unchanged.
2.2 The second shell tried to open with flag O_RDWR|O_SYNC, write the
same buffer to the same file, write operation returned EAGAIN
2.3 The same operation on ext4 file system gives me a expected
behavior the same as advisory lock expressed, successfully written
with file content changed.

I reviewed NFS 4.1 protocol(RFC 5661 page 185), the nfs server can
determine whether byte range lock can be either mandatory or advisory,
but I think 2.1 and 2.2 gives me some unexpected behavior as these
two.. What’s your idea about this? Can you give me some tips to work
this out?

Looking forward for your reply. Thanks in advance!

BTW, my linux kernel version is 4.15.0, linux release: ubuntu 16.04
from Azure marketplace, my nfs-common version is
"nfs-common/xenial-updates,now 1:1.2.8-9ubuntu12.1 amd64" from ubuntu
apt repo.

Thanks,
Gefei




[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