Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Zach Brown <zab@zabbo.net>
To: Chris Murphy <lists@colorremedies.com>
Cc: Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: feature request: consider rw subvols ro for send when volume is mounted ro
Date: Wed, 23 Jul 2014 13:47:36 -0700	[thread overview]
Message-ID: <20140723204736.GD17798@lenny.home.zabbo.net> (raw)
In-Reply-To: <EAC867F7-CBB2-4714-9917-A29566167A21@colorremedies.com>

On Wed, Jul 23, 2014 at 02:10:29PM -0600, Chris Murphy wrote:
> The use case is when it's possible to mount a Btrfs volume ro, but not rw. Example, a situation where
> 
> # mount -o degraded /dev/sdb /mnt
> [   71.064352] BTRFS info (device sdb): allowing degraded mounts
> [   71.064812] BTRFS info (device sdb): enabling auto recovery
> [   71.065210] BTRFS info (device sdb): disk space caching is enabled
> [   71.072068] BTRFS warning (device sdb): devid 2 missing
> [   71.097320] BTRFS: too many missing devices, writeable mount is not allowed
> [   71.116616] BTRFS: open_ctree failed
> 
> Yet this works:
> # mount -o degraded,ro /dev/sdb /mnt
> 
> It would be great if it were possible to send/receive subvolumes to a
> different btrfs volume. Currently it's not possible because those
> subvols aren't ro, and because the mount is ro I can't make ro
> snapshots first.

I wonder if that's as easy as the following totally untested hack.  I
have no idea if a read-only mount would still allow background
modification that might violate the send code's assumptions.

- z

$ git diff fs/btrfs/send.c
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 6528aa6..3528210 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5536,7 +5536,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
 	 * Userspace tools do the checks and warn the user if it's
 	 * not RO.
 	 */
-	if (!btrfs_root_readonly(send_root)) {
+	if (!(btrfs_root_readonly(send_root) || (sb->s_flags & MS_RDONLY))) {
 		ret = -EPERM;
 		goto out;
 	}

  reply	other threads:[~2014-07-23 20:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 20:10 feature request: consider rw subvols ro for send when volume is mounted ro Chris Murphy
2014-07-23 20:47 ` Zach Brown [this message]
2014-07-24  1:38   ` Duncan
2014-07-24 10:47   ` 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=20140723204736.GD17798@lenny.home.zabbo.net \
    --to=zab@zabbo.net \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.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