Files
linux/fs
Filipe Manana 6101eea47b Btrfs: fix return value on rename exchange failure
commit c5b4a50b74 upstream.

If we failed during a rename exchange operation after starting/joining a
transaction, we would end up replacing the return value, stored in the
local 'ret' variable, with the return value from btrfs_end_transaction().
So this could end up returning 0 (success) to user space despite the
operation having failed and aborted the transaction, because if there are
multiple tasks having a reference on the transaction at the time
btrfs_end_transaction() is called by the rename exchange, that function
returns 0 (otherwise it returns -EIO and not the original error value).
So fix this by not overwriting the return value on error after getting
a transaction handle.

Fixes: cdd1fedf82 ("btrfs: add support for RENAME_EXCHANGE and RENAME_WHITEOUT")
CC: stable@vger.kernel.org # 4.9+
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-03 11:24:57 +02:00
..
2018-06-21 04:02:59 +09:00
2018-05-30 07:52:35 +02:00
2018-04-19 08:56:21 +02:00
2018-06-05 11:41:54 +02:00
2017-09-04 19:05:15 -04:00
2017-04-17 12:52:27 -04:00
2018-05-16 10:10:25 +02:00