Handle NULL in nfsd .fsync() hook
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 6 May 2011 19:23:34 +0000 (12:23 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 6 May 2011 19:33:45 +0000 (12:33 -0700)
commit3117dd0b9005eb76e483b9772c493883b82998bb
tree48406e7d6154f424879a3f6cf7100f407d16fc95
parent6ee44e32be259706aed9b1439b71971a165b198c
Handle NULL in nfsd .fsync() hook

How nfsd handles .fsync() has been changed a couple of times in the
recent kernels.  But basically there are three cases we need to
consider.

Linux 2.6.12 - 2.6.33
* The .fsync() hook takes 3 arguments
* The nfsd will call .fsync() with a NULL file struct pointer.

Linux 2.6.34
* The .fsync() hook takes 3 arguments
* The nfsd no longer calls .fsync() but instead used sync_inode()

Linux 2.6.35 - 2.6.x
* The .fsync() hook takes 2 arguments
* The nfsd no longer calls .fsync() but instead used sync_inode()

For once it looks like we've gotten lucky.  The first two cases can
actually be collased in to one if we stop using the file struct
pointer entirely.  Since the dentry is still passed in both cases
this is possible.  The last case can then be safely handled by
unconditionally using the dentry in the file struct pointer now
that we know the nfsd caller has been removed.

Closes #230
include/linux/vfs_compat.h
module/zfs/zpl_file.c