Re: [for-6.13 PATCH 10/19] nfs_common: move localio_lock to new lock member of nfs_uuid_t

NeilBrown
2024-11-13T00:33:01Z

On Wed, 13 Nov 2024, Chuck Lever III wrote:
>
>
> > On Nov 12, 2024, at 6:13 PM, NeilBrown <neilb@suse.de> wrote:
> >
> > On Wed, 13 Nov 2024, Chuck Lever wrote:
> >> On Tue, Nov 12, 2024 at 11:49:30AM +1100, NeilBrown wrote:
> >>>>
> >>>> If you have a specific idea for the mechanism we need to create to
> >>>> detect the v3 client reconnects to the server please let me know.
> >>>> Reusing or augmenting an existing thing is fine by me.
> >>>
> >>> nfs3_local_probe(struct nfs_server *server)
> >>> {
> >>> struct nfs_client *clp = server->nfs_client;
> >>> nfs_uuid_t *nfs_uuid = &clp->cl_uuid;
> >>>
> >>> if (nfs_uuid->connect_cookie != clp->cl_rpcclient->cl_xprt->connect_cookie)
> >>> nfs_local_probe_async()
> >>> }
> >>>
> >>> static void nfs_local_probe_async_work(struct work_struct *work)
> >>> {
> >>> struct nfs_client *clp = container_of(work, struct nfs_client,
> >>> cl_local_probe_work);
> >>> clp->cl_uuid.connect_cookie =
> >>> clp->cl_rpcclient->cl_xprt->connect_cookie;
> >>> nfs_local_probe(clp);
> >>> }
> >>>
> >>> Or maybe assign connect_cookie (which we have to add to uuid) inside
> >>> nfs_local_probe().
> >>
> >> The problem with per-connection checks is that a change in export
> >> security policy could disable LOCALIO rather persistently. The only
> >> way to recover, if checking is done only when a connection is
> >> established, is to remount or force a disconnect.
> >>
> > What export security policy specifically?
> > Do you mean changing from sec=sys to to sec=krb5i for example?
>
> Another example might be altering the IP address list on
> the export. Suppose the client is accidentally blocked
> by this policy, the administrator realizes it, and changes
> it again to restore access.
>
> The client does not disconnect in this case, AFAIK.

Yes, that is a simpler case...

How would the localio path get disabled when this happens?
I suspect ->nfsd_open_local_fh would (should?) fail.
It, or nfs_open_local_fh() which calls it, could reset
uuid->connect_cookie to an impossible value so as to force a
probe after the next successful IO. That would be an important part of
the protocol.

Thanks,
NeilBrown