]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
nfscl: Make nfscl_getlayout() acquire the correct pNFS layout
authorRick Macklem <rmacklem@FreeBSD.org>
Wed, 13 Oct 2021 22:48:54 +0000 (15:48 -0700)
committerRick Macklem <rmacklem@FreeBSD.org>
Wed, 13 Oct 2021 22:48:54 +0000 (15:48 -0700)
commit24af0fcdfc4983fd3cef10f9d949aca79476c2c2
tree21e80fe919e2b861339a4236f6858433e22a3dc5
parentd5fd5cdc063857132de19a94f63d1adbc581494e
nfscl: Make nfscl_getlayout() acquire the correct pNFS layout

Without this patch, if a pNFS read layout has already been acquired
for a file, writes would be redirected to the Metadata Server (MDS),
because nfscl_getlayout() would not acquire a read/write layout for
the file.  This happened because there was no "mode" argument to
nfscl_getlayout() to indicate whether reading or writing was being done.
Since doing I/O through the Metadata Server is not encouraged for some
pNFS servers, it is preferable to get a read/write layout for writes
instead of redirecting the write to the MDS.

This patch adds a access mode argument to nfscl_getlayout() and
nfsrpc_getlayout(), so that nfscl_getlayout() knows to acquire a read/write
layout for writing, even if a read layout has already been acquired.
This patch only affects NFSv4.1/4.2 client behaviour when pNFS ("pnfs" mount
option against a server that supports pNFS) is in use.

This problem was detected during a recent NFSv4 interoperability
testing event held by the IETF working group.

MFC after: 2 week
sys/fs/nfs/nfs_var.h
sys/fs/nfsclient/nfs_clrpcops.c
sys/fs/nfsclient/nfs_clstate.c