linux/fs/btrfs
Sage Weil 9ca9ee09c1 Btrfs: fix ioctl-initiated transactions vs wait_current_trans()
Commit 597:466b27332893 (btrfs_start_transaction: wait for commits in
progress) breaks the transaction start/stop ioctls by making
btrfs_start_transaction conditionally wait for the next transaction to
start.  If an application artificially is holding a transaction open,
things deadlock.

This workaround maintains a count of open ioctl-initiated transactions in
fs_info, and avoids wait_current_trans() if any are currently open (in
start_transaction() and btrfs_throttle()).  The start transaction ioctl
uses a new btrfs_start_ioctl_transaction() that _does_ call
wait_current_trans(), effectively pushing the join/wait decision to the
outer ioctl-initiated transaction.

This more or less neuters btrfs_throttle() when ioctl-initiated
transactions are in use, but that seems like a pretty fundamental
consequence of wrapping lots of write()'s in a transaction.  Btrfs has no
way to tell if the application considers a given operation as part of it's
transaction.

Obviously, if the transaction start/stop ioctls aren't being used, there
is no effect on current behavior.

Signed-off-by: Sage Weil <sage@newdream.net>
---
 ctree.h       |    1 +
 ioctl.c       |   12 +++++++++++-
 transaction.c |   18 +++++++++++++-----
 transaction.h |    2 ++
 4 files changed, 27 insertions(+), 6 deletions(-)

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2008-09-25 11:04:06 -04:00
..
acl.c Btrfs: Add ACL support 2008-09-25 11:04:05 -04:00
async-thread.c Btrfs: Fix streaming read performance with checksumming on 2008-09-25 11:04:05 -04:00
async-thread.h
bit-radix.c
bit-radix.h
btrfs_inode.h Btrfs: Create orphan inode records to prevent lost files after a crash 2008-09-25 11:04:05 -04:00
compat.h
COPYING
crc32c.h Btrfs: Add support for HW assisted crc32c 2008-09-25 11:04:06 -04:00
ctree.c btrfs_search_slot: reduce lock contention by cowing in two stages 2008-09-25 11:04:06 -04:00
ctree.h Btrfs: fix ioctl-initiated transactions vs wait_current_trans() 2008-09-25 11:04:06 -04:00
dir-item.c Btrfs: implement memory reclaim for leaf reference cache 2008-09-25 11:04:05 -04:00
disk-io.c Btrfs: More throttle tuning 2008-09-25 11:04:06 -04:00
disk-io.h
extent-tree.c Btrfs: More throttle tuning 2008-09-25 11:04:06 -04:00
extent_io.c Btrfs: Add compatibility for kernels >= 2.6.27-rc1 2008-09-25 11:04:05 -04:00
extent_io.h Btrfs: Fix some data=ordered related data corruptions 2008-09-25 11:04:05 -04:00
extent_map.c Btrfs: Use assert_spin_locked instead of spin_trylock 2008-09-25 11:04:05 -04:00
extent_map.h Btrfs: Fix some data=ordered related data corruptions 2008-09-25 11:04:05 -04:00
file-item.c Btrfs: Hold csum mutex while reading in sums during readpages 2008-09-25 11:04:06 -04:00
file.c Btrfs: Improve and cleanup locking done by walk_down_tree 2008-09-25 11:04:06 -04:00
hash.c
hash.h
inode-item.c Btrfs: Implement new dir index format 2008-09-25 11:04:05 -04:00
inode-map.c
inode.c Btrfs: Hold csum mutex while reading in sums during readpages 2008-09-25 11:04:06 -04:00
INSTALL
ioctl.c Btrfs: fix ioctl-initiated transactions vs wait_current_trans() 2008-09-25 11:04:06 -04:00
ioctl.h
locking.c btrfs_search_slot: reduce lock contention by cowing in two stages 2008-09-25 11:04:06 -04:00
locking.h btrfs_search_slot: reduce lock contention by cowing in two stages 2008-09-25 11:04:06 -04:00
Makefile Btrfs: Add a leaf reference cache 2008-09-25 11:04:05 -04:00
ordered-data.c Btrfs: Fix the defragmention code and the block relocation code for data=ordered 2008-09-25 11:04:05 -04:00
ordered-data.h Btrfs: Fix the defragmention code and the block relocation code for data=ordered 2008-09-25 11:04:05 -04:00
orphan.c Btrfs: Create orphan inode records to prevent lost files after a crash 2008-09-25 11:04:05 -04:00
print-tree.c Btrfs: implement memory reclaim for leaf reference cache 2008-09-25 11:04:05 -04:00
print-tree.h
ref-cache.c Btrfs: implement memory reclaim for leaf reference cache 2008-09-25 11:04:05 -04:00
ref-cache.h Btrfs: implement memory reclaim for leaf reference cache 2008-09-25 11:04:05 -04:00
root-tree.c
struct-funcs.c
super.c Btrfs: Add ACL support 2008-09-25 11:04:05 -04:00
sysfs.c
TODO
transaction.c Btrfs: fix ioctl-initiated transactions vs wait_current_trans() 2008-09-25 11:04:06 -04:00
transaction.h Btrfs: fix ioctl-initiated transactions vs wait_current_trans() 2008-09-25 11:04:06 -04:00
tree-defrag.c
version.sh Btrfs: Fix version.sh when used outside of an hg repo 2008-09-25 11:04:05 -04:00
volumes.c Btrfs: Hold a reference on bios during submit_bio, add some extra bio checks 2008-09-25 11:04:05 -04:00
volumes.h
xattr.c Btrfs: Add ACL support 2008-09-25 11:04:05 -04:00
xattr.h