Page MenuHomeFreeBSD

add the Deallocate operation to the NFSv4.2 server
ClosedPublic

Authored by rmacklem on Aug 20 2021, 10:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 1, 6:18 AM
Unknown Object (File)
Wed, May 1, 6:18 AM
Unknown Object (File)
Apr 8 2024, 10:56 PM
Unknown Object (File)
Jan 16 2024, 7:01 PM
Unknown Object (File)
Dec 23 2023, 12:31 AM
Unknown Object (File)
Dec 21 2023, 12:25 PM
Unknown Object (File)
Sep 26 2023, 12:23 AM
Unknown Object (File)
Sep 19 2023, 4:49 AM
Subscribers
None

Details

Summary

The recently added VOP_DEALLOCATE(9) VOP call allows
implementation of the Deallocate NFSv4.2 operation.

Since the Deallocate operation is a single succeed/fail
operation, the call to VOP_DEALLOCATE(9) loops up to
20 times to complete the operation.
Is 20 iterations enough?

Where RFC 7862 underspecifies behaviour, the code
is written to be Linux NFSv4.2 server compatible.

Test Plan

Tested with both the Linux and a patched FreeBSD client.
(Patch not yet here or in main.)

The key code area for review is in nfs_nfsdport.c
line #s 6613-6621, which is where the VOP_DEALLOCATE(9)
call is done.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rmacklem created this revision.
sys/fs/nfsserver/nfs_nfsdport.c
6618

A try count of 20 times may not be sufficient on a slow media given a huge request. I suggest either KASSERT progress are made (i.e. returned len != the len passed to VOP_DEALLOCATE), or use VOP_PATHCONF to check if a native implementation of VOP_DEALLOCATE is available or not, and return unsupported if such implementation is not available.

Change the loop doing VOP_DEALLOCATE() from a
limit of 20 iterations to checking that len is decreasing on
every iteration.

NFSERR_NOTSUPP for an NFSv4.2 operation is per file
server and not per file, so it cannot return notsupp based
on the underlying file system (might be a mi within a server).

I have posted on nfsv4@ietf.org w.r.t. how best to handle
large requests that might take a long time to complete.

The VOP_DEALLOCATE bits look good to me.

This revision is now accepted and ready to land.Aug 25 2021, 3:51 PM

One thing to note, it might be good to periodically do maybe_yield when looping the call so that it won't early return when should_yield() in the default implementation is hit. This avoids everytime the call performs one chunk of the IO and returns.

Add a call to maybe_yield() inside the loop that
performs VOP_DEALLOCATE(), as suggested by khng@.

This revision now requires review to proceed.Aug 26 2021, 2:56 AM
This revision is now accepted and ready to land.Aug 26 2021, 6:58 AM