In particular, do not assume that vn_start_write() returns the same mp as it was passed in.
Also be more accurate to return NULL vp and mp when error occured, to catch wrong control flow easier.
Stop checking for NULL mp before calling vn_finished_write(), NULL mp is handled transparently by VFS.
Details
- Reviewers
rmacklem - Commits
- rG51a9b978e750: nfs server: improve use of the VFS KPI
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comments inline.
sys/fs/nfsserver/nfs_nfsdport.c | ||
---|---|---|
3251 | This causes crashes. I think you meant.. if (mpp != NULL) | |
3267 | It might be better to set ESTALE here. | |
3267 | I think that ESTALE might be better here. Having said that, it does not appear that |
sys/fs/nfsserver/nfs_nfsdport.c | ||
---|---|---|
3267 | This is not a translation of the file handle, but attempt to prepare for operation. Anyway, I changed the error to ESTALE. I cannot guarantee that vn_start_write() would not return an error for V_WAIT forever. I see no reason to not use the VFS KPI in a way that is more future-proof. |
Fix silly typo, *mpp != NULL -> mpp != NULL.
Change error code from EIO to ESTALE for failed vn_start_write().
Looks fine to me now.
With these changes my test run works fine.
sys/fs/nfsserver/nfs_nfsdport.c | ||
---|---|---|
3266 | Sure. But at least for NFSv4, the recognized errors The only one of these that is recognized by |