From: Sage Weil Date: Fri, 26 Sep 2014 15:30:06 +0000 (-0700) Subject: Btrfs: fix race in WAIT_SYNC ioctl X-Git-Tag: omap-for-v3.19/prcm-cleanup~117^2~8 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42383020beb1cfb05f5d330cc311931bc4917a97;p=pandora-kernel.git Btrfs: fix race in WAIT_SYNC ioctl We check whether transid is already committed via last_trans_committed and then search through trans_list for pending transactions. If last_trans_committed is updated by btrfs_commit_transaction after we check it (there is no locking), we will fail to find the committed transaction and return EINVAL to the caller. This has been observed occasionally by ceph-osd (which uses this ioctl heavily). Fix by rechecking whether the provided transid <= last_trans_committed after the search fails, and if so return 0. Signed-off-by: Sage Weil Signed-off-by: Chris Mason --- Reading git-diff-tree failed