From: Alchemy Han <alchemylinux@gmail.com>
To: pve-devel@lists.proxmox.com
Cc: Alchemy Han <alchemylinux@gmail.com>
Subject: [PATCH pve-storage] btrfs: fix swapped filesystem ioctl constants
Date: Sun, 18 Oct 2026 22:20:36 +0800 [thread overview]
Message-ID: <20261018142036.39663-1-alchemylinux@gmail.com> (raw)
The FS_IOC_GETFLAGS and FS_IOC_SETFLAGS constants are swapped
in the Btrfs storage plugin.
Consequently, enabling the 'nocow' storage option does not set
the NOCOW attribute on newly allocated RAW disk images.
This can be reproduced by configuring 'nocow 1' on a Btrfs
storage and allocating a new RAW image using 'pvesm alloc'.
The resulting disk.raw does not have the NOCOW attribute.
On x86-64 Linux, the correct ioctl constants are:
FS_IOC_GETFLAGS = 0x80086601
FS_IOC_SETFLAGS = 0x40086602
The original constants were tested using Perl ioctl calls.
Reading the flags after attempting to set FS_NOCOW_FL returned
0x00000000.
With the corrected constants, the same test successfully
returned 0x00800000.
Fix the constants to make the NOCOW storage option work as
intended.
Signed-off-by: Alchemy Han <alchemylinux@gmail.com>
---
src/PVE/Storage/BTRFSPlugin.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PVE/Storage/BTRFSPlugin.pm b/src/PVE/Storage/BTRFSPlugin.pm
index fa28592..37dd3a6 100644
--- a/src/PVE/Storage/BTRFSPlugin.pm
+++ b/src/PVE/Storage/BTRFSPlugin.pm
@@ -18,8 +18,8 @@ use PVE::Storage::DirPlugin;
use constant {
BTRFS_FIRST_FREE_OBJECTID => 256,
FS_NOCOW_FL => 0x00800000,
- FS_IOC_GETFLAGS => 0x40086602,
- FS_IOC_SETFLAGS => 0x80086601,
+ FS_IOC_GETFLAGS => 0x80086601,
+ FS_IOC_SETFLAGS => 0x40086602,
BTRFS_MAGIC => 0x9123683e,
};
--
2.56.0
reply other threads:[~2026-10-18 14:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261018142036.39663-1-alchemylinux@gmail.com \
--to=alchemylinux@gmail.com \
--cc=pve-devel@lists.proxmox.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.