All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+aec9606169fbc3a12ca6@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] #syz test
Date: Sat, 12 Apr 2025 11:04:34 -0700	[thread overview]
Message-ID: <67faab32.050a0220.2c5fcf.0010.GAE@google.com> (raw)
In-Reply-To: <67f50e3e.050a0220.396535.0560.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: #syz test
Author: gshahrouzi@gmail.com

Try to remove device but fails
Reinitialize reference counting for write operations for device
Shut down the filesystem
Make the filesystem read only
	Read-write bit is not set so it skips trying to make the filesystem read-only, implying that the filesystem is already in read-only mode.
Encounter error because write operations are still assigned to a device
When the filesystem is starting up, it tries setting it to set the filesystem to read-only but it’s already set.
When failing to remove a device, it tries giving back write permissions to a device when the filesystem is read-only (not sure if this is nonsensical or not).
Since a device has write permissions, it tries to remove them but fails because the filesystem is in read-only mode.
So the fix here is to prevent it from giving the device write permissions if the filesystem is in read-only mode.

Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com>
---
 fs/bcachefs/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index b79e80a435e09..788e870bfef6a 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -1757,7 +1757,8 @@ int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
 	up_write(&c->state_lock);
 	return 0;
 err:
-	if (ca->mi.state == BCH_MEMBER_STATE_rw &&
+	if (test_bit(BCH_FS_rw, &c->flags) &&
+	    ca->mi.state == BCH_MEMBER_STATE_rw &&
 	    !percpu_ref_is_zero(&ca->io_ref[READ]))
 		__bch2_dev_read_write(c, ca);
 	up_write(&c->state_lock);
-- 
2.43.0


  parent reply	other threads:[~2025-04-12 18:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 11:53 [syzbot] [bcachefs?] WARNING in bch2_dev_free syzbot
2025-04-09 16:09 ` Charalampos Mitrodimas
2025-04-09 17:02   ` syzbot
2025-04-09 21:51   ` Kent Overstreet
2025-04-12 18:04 ` syzbot [this message]
2025-04-12 18:11 ` [syzbot] #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5fc31936081919a8572a3d644f3fbb258038f337 syzbot
2025-04-18  0:37 ` [syzbot] syzbot
  -- strict thread matches above, loose matches on Subject: below --
2025-06-17  8:11 [syzbot] [bcachefs?] KMSAN: uninit-value in __bch2_alloc_v4_to_text syzbot
2025-06-19  4:31 ` [syzbot] #syz test syzbot
2025-06-19  7:23 ` syzbot
2025-06-19 11:46 ` syzbot
2025-05-26 10:41 [syzbot] [bcachefs?] KASAN: slab-out-of-bounds Read in bch2_sb_members_v2_to_text syzbot
2025-06-04 11:31 ` [syzbot] #syz test syzbot
2025-06-05 15:56 ` syzbot
2025-06-05 17:18 ` syzbot
2025-06-09 15:31 ` syzbot
2025-05-05  7:16 [syzbot] [i2c?] KMSAN: uninit-value in __i2c_smbus_xfer syzbot
2025-05-28 10:42 ` [syzbot] #syz test syzbot
2025-05-28 15:42 ` syzbot
2025-05-29  8:38 ` syzbot
2025-05-29 11:17 ` syzbot
2025-06-04 11:21 ` syzbot
2025-04-04  7:02 [syzbot] [perf?] WARNING in __free_event syzbot
2025-04-05 17:12 ` [syzbot] #syz test syzbot
2025-04-05 19:32 ` syzbot

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=67faab32.050a0220.2c5fcf.0010.GAE@google.com \
    --to=syzbot+aec9606169fbc3a12ca6@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 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.