freebsd-dev/module
Chunwei Chen 7dc71949f2 Fix z_sync_cnt decrement in zfs_close
The comment in zfs_close states that "Under Linux the zfs_close() hook
is not symmetric with zfs_open()". This is not true. zfs_open/zfs_close
is associated with every successful struct file creation/deletion, which
should always be balanced.

Here is an example of what's wrong:

Process A		B
	open(O_SYNC)
	z_sync_cnt = 1
			open(O_SYNC)
			z_sync_cnt = 2
	close()
	z_sync_cnt = 0

So z_sync_cnt is 0 even if B still has the file with O_SYNC.

Also moves the generic_file_open call before zfs_open to ensure that in
the case generic_file_open fails z_sync_cnt is not incremented.  This
is safe because generic_file_open has no side effects.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #1962
2013-12-17 10:28:27 -08:00
..
avl Add module versioning 2013-12-06 09:34:41 -08:00
nvpair Add module versioning 2013-12-06 09:34:41 -08:00
unicode Add module versioning 2013-12-06 09:34:41 -08:00
zcommon Add module versioning 2013-12-06 09:34:41 -08:00
zfs Fix z_sync_cnt decrement in zfs_close 2013-12-17 10:28:27 -08:00
zpios Add module versioning 2013-12-06 09:34:41 -08:00
.gitignore gitignore: anchor entries at their respective directory 2013-04-02 10:50:17 -07:00
Makefile.in Add KMODDIR to install target 2013-03-06 15:46:40 -08:00