All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 3/3] btrfs: use ioctl args support mask for device delete
Date: Fri, 21 Feb 2020 14:02:20 +0100	[thread overview]
Message-ID: <35813380382186dcd381e759e665f59f77c1f287.1582289899.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1582289899.git.dsterba@suse.com>

When the device remove v2 ioctl was added, the full support mask was
added to sanity check the flags. However this would allow to let the
subvolume related flags to be accepted. This is not supposed to happen.

Use the correct support mask, which means that now any of
BTRFS_SUBVOL_CREATE_ASYNC, BTRFS_SUBVOL_RDONLY or
BTRFS_SUBVOL_QGROUP_INHERIT will be rejected as ENOTSUPP. Though this is
a user-visible change, specifying subvolume flags for device deletion
does not make sense and there are hopefully no applications doing that.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ioctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a7872cacd0aa..cd2d11dcd477 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3075,8 +3075,7 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)
 		goto err_drop;
 	}
 
-	/* Check for compatibility reject unknown flags */
-	if (vol_args->flags & ~BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED) {
+	if (vol_args->flags & ~BTRFS_DEVICE_REMOVE_ARGS_MASK) {
 		ret = -EOPNOTSUPP;
 		goto out;
 	}
-- 
2.25.0


  parent reply	other threads:[~2020-02-21 13:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21 13:02 [PATCH 0/3] Clean up supported flags for ioctls David Sterba
2020-02-21 13:02 ` [PATCH 1/3] btrfs: define support masks for ioctl volume args v2 David Sterba
2020-02-21 13:20   ` Marcos Paulo de Souza
2020-02-21 13:02 ` [PATCH 2/3] btrfs: use ioctl args support mask for subvolume create/delete David Sterba
2020-02-21 13:21   ` Marcos Paulo de Souza
2020-02-21 13:02 ` David Sterba [this message]
2020-02-21 13:22   ` [PATCH 3/3] btrfs: use ioctl args support mask for device delete Marcos Paulo de Souza
2020-02-21 13:24 ` [PATCH 0/3] Clean up supported flags for ioctls Nikolay Borisov

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=35813380382186dcd381e759e665f59f77c1f287.1582289899.git.dsterba@suse.com \
    --to=dsterba@suse.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 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.