2010-12-22 03:36:42

by Fu Liankun

[permalink] [raw]
Subject: nfsv4 read delegation issue

Open read delegation and file locks implementation in the kernel
2.6.37-rc1 are not consistent with the RFC3530.

In the kernel 2.6.37-rc1:
1.NFS client mount NFS filesytem with nfsv4.
2.The client open a NFS file with O_RDONLY,then the server may return
a read delegation to the client.
3.for some reasons, the network between client and server is partition.
4.the client lock the opened file with F_RDLCK again.If the client has
the read delegation at the step 2,it will return ture.In fact,the
client doesn't send the read lock request to the NFS service.It does
operate the request at local.

But the RFC3530 descripts as:
9.4.2. Open Delegation and File Locks

When a client holds a write open delegation, lock operations may be
performed locally. This includes those required for mandatory file
locking. This can be done since the delegation implies that there
can be no conflicting locks. Similarly, all of the revalidations
that would normally be associated with obtaining locks and the
flushing of data associated with the releasing of locks need not be
done.

When a client holds a read open delegation, lock operations are not
performed locally. All lock operations, including those requesting
non-exclusive locks, are sent to the server for resolution.

Is this a bug or the kernel have other considerations When it implements
this function?