Filipe Manana d924a0be2f btrfs: fix double inode unlock for direct IO sync writes
commit e0391e92f9ab4fb3dbdeb139c967dcfa7ac4b115 upstream.

If we do a direct IO sync write, at btrfs_sync_file(), and we need to skip
inode logging or we get an error starting a transaction or an error when
flushing delalloc, we end up unlocking the inode when we shouldn't under
the 'out_release_extents' label, and then unlock it again at
btrfs_direct_write().

Fix that by checking if we have to skip inode unlocking under that label.

Reported-by: syzbot+7dbbb74af6291b5a5a8b@syzkaller.appspotmail.com
Link: https://lore.kernel.org/linux-btrfs/000000000000dfd631061eaeb4bc@google.com/
Fixes: 939b656bc8ab ("btrfs: fix corruption after buffer fault in during direct IO append write")
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-14 15:34:38 +02:00
..
2024-05-29 09:25:15 -07:00
2024-07-02 21:23:00 +02:00
2024-01-11 20:11:35 -08:00
2024-05-13 14:14:05 -07:00
2024-05-21 09:51:42 -07:00
2024-08-03 09:00:45 +02:00
2024-03-27 13:17:15 +01:00
2024-04-23 13:27:43 +02:00
2024-03-12 20:03:34 -07:00
2024-05-02 20:35:57 +02:00
2023-10-30 19:28:19 -10:00
2024-05-23 12:04:36 -07:00
2024-04-25 20:56:20 -07:00
2024-07-11 09:03:28 -07:00
2024-05-10 08:26:31 +02:00
2024-03-12 20:03:34 -07:00
2024-03-15 09:00:09 -07:00
2024-05-02 20:35:57 +02:00
2024-04-17 13:49:44 +02:00
2024-03-11 10:21:06 -07:00
2024-03-13 12:53:53 -07:00
2024-07-01 09:22:08 -07:00
2024-02-02 13:11:49 +01:00
2024-03-12 20:03:34 -07:00
2024-05-02 16:28:20 +02:00
2024-05-24 13:34:07 +02:00
2024-03-26 09:01:18 +01:00
2024-04-10 16:23:02 -06:00
2024-02-15 23:43:47 -05:00