linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH] btrfs: do not restrict writes to devices
Date: Wed, 10 Jan 2024 15:16:35 -0500	[thread overview]
Message-ID: <2fe68e18d89abb7313392c8da61aaa9881bbe945.1704917721.git.josef@toxicpanda.com> (raw)

This is a version of ead622674df5 ("btrfs: Do not restrict writes to
btrfs devices"), which pushes this restriction closer to where we use
bdev_open_by_path.  This was in the mount path, and changed when we
switched to the new mount api, and with that loss we suddenly weren't
able to mount.  Move this closer to where we use bdev_open_by_path so
changes on the upper layers don't mess anything up, and then we can
remove this when we merge the bdev holder patches.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
- This needs to go in before the new mount API patches when we rebase onto
  linus/master for the merge request, otherwise we won't be able to mount file
  systems.  I've put this at the beginning of the for-next branch in the github
  linux tree, which is rebased onto recent linus.

 fs/btrfs/volumes.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d67785be2c77..9c8de7fad86e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -474,6 +474,9 @@ btrfs_get_bdev_and_sb(const char *device_path, blk_mode_t flags, void *holder,
 	struct block_device *bdev;
 	int ret;
 
+	/* No support for restricting writes to btrfs devices yet... */
+	flags &= ~BLK_OPEN_RESTRICT_WRITES;
+
 	*bdev_handle = bdev_open_by_path(device_path, flags, holder, NULL);
 
 	if (IS_ERR(*bdev_handle)) {
@@ -1322,6 +1325,9 @@ struct btrfs_device *btrfs_scan_one_device(const char *path, blk_mode_t flags,
 
 	lockdep_assert_held(&uuid_mutex);
 
+	/* No support for restricting writes to btrfs devices yet... */
+	flags &= ~BLK_OPEN_RESTRICT_WRITES;
+
 	/*
 	 * we would like to check all the supers, but that would make
 	 * a btrfs mount succeed after a mkfs from a different FS.
-- 
2.43.0


             reply	other threads:[~2024-01-10 20:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 20:16 Josef Bacik [this message]
2024-01-10 21:30 ` [PATCH] btrfs: do not restrict writes to devices David Sterba
2024-01-11  8:59 ` Anand Jain
2024-01-11 15:24   ` David Sterba
2024-01-11 15:27     ` David Sterba

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=2fe68e18d89abb7313392c8da61aaa9881bbe945.1704917721.git.josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).