Re: automatic freeing of space on ENOSPC

Trond Myklebust
2021-06-29T00:43:17Z

On Mon, 2021-06-28 at 15:49 -0400, J. Bruce Fields wrote:
> Is there anything analogous to a "shrinker", but for disk space?  So,
> some hook that a filesystem could call to say "I'm running out of
> space,
> could you please free something?", before giving up and returning
> ENOSPC?
>
> The NFS server currently revokes a client's state if the client fails
> to
> contact it within a lease period (90 seconds by default).  That's
> harsher than necessary--if a network partition lasts longer than a
> lease
> period, but if nobody else needs that client's resources, it'd be
> nice
> to be able to hang on to them so that the client could resume normal
> operation after the network comes back.  So we'd delay revoking the
> client's state until there's an actual conflict.  But that means we
> need
> a way to clean up the client as soon as there is a conflict, to avoid
> unnecessarily failing operations that conflict with resources held by
> an
> expired client.
>
> At first I thought we only needed to worry about file locks, but then
> I
> realized clients can also hold references to files, which might be
> unlinked.  I don't want a long-expired client to result in ENOSPC to
> other filesystem users.
>
> Any ideas?
>

How about just setting up a notification for unlink on those files, the
same way we set up notifications for close with the NFSv3 filecache in
nfsd?

> I searched around and found this discussion of volatile ranges
> https://lwn.net/Articles/522135/, which seems close, but I don't know
> if
> anything came of that in the end.
>
> --b.

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com