mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+4366624c0b5aac4906cf@syzkaller.appspotmail.com
Cc: bfoster@redhat.com, kent.overstreet@linux.dev,
	linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzkaller-bugs@googlegroups.com
Subject: [PATCH] bcachefs: bch2_fs_read_write_early needs to hold write lock
Date: Sat, 15 Jun 2024 19:44:04 +0800	[thread overview]
Message-ID: <tencent_724B611BCF250EBAF7BBE333DF9E271BB208@qq.com> (raw)
In-Reply-To: <00000000000053e574061ad89521@google.com>

bch2_fs_read_write_early() needs to hold state_lock to pretect and sync data.

Reported-by: syzbot+4366624c0b5aac4906cf@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
 fs/bcachefs/snapshot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index 51918acfd726..b27a4327274d 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -1566,7 +1566,9 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
 		return 0;
 
 	if (!test_bit(BCH_FS_started, &c->flags)) {
+		down_write(&c->state_lock);
 		ret = bch2_fs_read_write_early(c);
+		up_write(&c->state_lock);
 		bch_err_msg(c, ret, "deleting dead snapshots: error going rw");
 		if (ret)
 			return ret;
-- 
2.43.0


  parent reply	other threads:[~2024-06-15 11:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 12:16 [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early syzbot
2024-06-15  2:27 ` Edward Adam Davis
2024-06-15  2:50   ` syzbot
2024-06-15 10:43 ` Edward Adam Davis
2024-06-15 11:12   ` syzbot
2024-06-15 11:44 ` Edward Adam Davis [this message]
2024-06-17 13:50   ` [PATCH] bcachefs: bch2_fs_read_write_early needs to hold write lock Kent Overstreet
2024-06-17 13:52 ` [syzbot] [bcachefs?] WARNING in bch2_fs_read_write_early Kent Overstreet

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=tencent_724B611BCF250EBAF7BBE333DF9E271BB208@qq.com \
    --to=eadavis@qq.com \
    --cc=bfoster@redhat.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+4366624c0b5aac4906cf@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®