All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: fdmanana@suse.com,dsterba@suse.com,josef@toxicpanda.com
Cc: <stable@vger.kernel.org>
Subject: FAILED: patch "[PATCH] btrfs: fix double inode unlock for direct IO sync writes" failed to apply to 6.6-stable tree
Date: Mon, 12 Aug 2024 17:07:51 +0200	[thread overview]
Message-ID: <2024081251-startle-trunks-6fb5@gregkh> (raw)


The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x e0391e92f9ab4fb3dbdeb139c967dcfa7ac4b115
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2024081251-startle-trunks-6fb5@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..

Possible dependencies:

e0391e92f9ab ("btrfs: fix double inode unlock for direct IO sync writes")
56b7169f691c ("btrfs: use a btrfs_inode local variable at btrfs_sync_file()")
e641e323abb3 ("btrfs: pass a btrfs_inode to btrfs_wait_ordered_range()")
f13e01b89daf ("btrfs: ensure fast fsync waits for ordered extents after a write failure")
41044b41ad2c ("btrfs: add helper to get fs_info from struct inode pointer")
b33d2e535f9b ("btrfs: add helpers to get fs_info from page/folio pointers")
c8293894afa7 ("btrfs: add helpers to get inode from page/folio pointers")
4e00422ee626 ("btrfs: replace sb::s_blocksize by fs_info::sectorsize")
dfba9f477306 ("btrfs: add set_folio_extent_mapped() helper")
418b09027743 ("btrfs: ensure fiemap doesn't race with writes when FIEMAP_FLAG_SYNC is given")
b0ad381fa769 ("btrfs: fix deadlock with fiemap and extent locking")
6a69631ec9b1 ("btrfs: lzo: fix and simplify the inline extent decompression")
2c25716dcc25 ("btrfs: zlib: fix and simplify the inline extent decompression")
55151ea9ec1b ("btrfs: migrate subpage code to folio interfaces")
8d993618350c ("btrfs: migrate get_eb_page_index() and get_eb_offset_in_page() to folios")
13df3775efca ("btrfs: cleanup metadata page pointer usage")
082d5bb9b336 ("btrfs: migrate extent_buffer::pages[] to folio")
09e6cef19c9f ("btrfs: refactor alloc_extent_buffer() to allocate-then-attach method")
ed9b50a13edf ("btrfs: cache that we don't have security.capability set")
397239ed6a6c ("btrfs: allow extent buffer helpers to skip cross-page handling")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From e0391e92f9ab4fb3dbdeb139c967dcfa7ac4b115 Mon Sep 17 00:00:00 2001
From: Filipe Manana <fdmanana@suse.com>
Date: Fri, 2 Aug 2024 09:38:51 +0100
Subject: [PATCH] btrfs: fix double inode unlock for direct IO sync writes

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>

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 9f10a9f23fcc..9914419f3b7d 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1868,7 +1868,10 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
 
 out_release_extents:
 	btrfs_release_log_ctx_extents(&ctx);
-	btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);
+	if (skip_ilock)
+		up_write(&inode->i_mmap_lock);
+	else
+		btrfs_inode_unlock(inode, BTRFS_ILOCK_MMAP);
 	goto out;
 }
 


                 reply	other threads:[~2024-08-12 15:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024081251-startle-trunks-6fb5@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dsterba@suse.com \
    --cc=fdmanana@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.