RE: [PATCH 1/3] nfsd: use __fput_sync() to avoid delayed closing of files.
From: NeilBrown
Date: Fri Dec 15 2023 - 17:36:45 EST
On Sat, 16 Dec 2023, David Laight wrote:
> ...
> > > PS: put it that way - I can buy "nfsd is doing that only to regular
> > > files and not on an arbitrary filesystem, at that; having the thread
> > > wait on that sucker is not going to cause too much trouble"; I do *not*
> > > buy turning it into a thing usable outside of a very narrow set of
> > > circumstances.
> > >
> >
> > Can you say more about "not on an arbitrary filesystem" ?
> > I guess you means that procfs and/or sysfs might be problematic as may
> > similar virtual filesystems (nfsd maybe).
>
> Can nfs export an ext4 fs that is on a loopback mount on a file
> that is remotely nfs (or other) mounted?
Sure. There is no reason this would cause a problem.
If the nfs mount were also a loopback mount, that might be interesting.
i.e. You have a local filesystem, containing a file with a filesystem
image.
You nfs-export that local filesystem, and nfs mount it on the same host.
Then you loop-mount that file in the nfs-mounted filesystem. Now you
are getting into uncharted waters. I've testing loop-back NFS mounting
and assure that it works. I haven't tried the double-loop.
But if that caused problem, I though it would be fput. It would be
fsync or writeback which causes the problem.
>
> As soon as you get loops like that you might find that fput() starts
> being problematic.
When calling fput on a regular file there are, I think, only two problem
areas. One is that the fput might lead to a lazy-filesystem unmount
completing. That only applies to MNT_INTERNAL filesystems, and they are
unlikely to be exported (probably it's impossible, but I haven't
checked).
The other is synchronous (or even async) IO in the filesystem code,
maybe completing an unlink or a truncate. This is no worse than any
other synchronous IO that nfsd does.
Thanks,
NeilBrown
>
> I'm also sure I remember that nfs wasn't supposed to respond to a write
> until it had issued the actual disk write - but maybe no one do that
> any more because it really is too slow.
> (Especially if the 'disk' is a USB stick.)
>
> David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>