lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191024023636.21124-4-marcos.souza.org@gmail.com>
Date:   Wed, 23 Oct 2019 23:36:34 -0300
From:   Marcos Paulo de Souza <marcos.souza.org@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     clm@...com, josef@...icpanda.com, dsterba@...e.com,
        linux-btrfs@...r.kernel.org, mpdesouza@...e.com
Subject: [PATCH 3/5] btrfs: ioctl: Call btrfs_vol_uevent on subvol creation

From: Marcos Paulo de Souza <mpdesouza@...e.com>

btrfs_vol_uevent will export two environment variables to udev:
BTRFS_VOL_NAME: containing the name of the volume being created
BTRFS_VOL_ADD: will signalize that a subvol was created

One can create a udev rule and check for BTRFS_VOL_ADD being sent,
these values one could detect whenever a subvolume is created, and
take any action based on the subvolume name contained in BTRFS_VOL_NAME.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@...e.com>
---
 fs/btrfs/ioctl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 174cbe71d6be..c538d3648195 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -980,6 +980,7 @@ static noinline int btrfs_mksubvol(const struct path *parent,
 {
 	struct inode *dir = d_inode(parent->dentry);
 	struct btrfs_fs_info *fs_info = btrfs_sb(dir->i_sb);
+	struct block_device *bdev = fs_info->fs_devices->latest_bdev;
 	struct dentry *dentry;
 	int error;
 
@@ -1018,8 +1019,12 @@ static noinline int btrfs_mksubvol(const struct path *parent,
 		error = create_subvol(dir, dentry, name, namelen,
 				      async_transid, inherit);
 	}
-	if (!error)
+	if (!error) {
+		if (!snap_src)
+			btrfs_vol_uevent(bdev, true, name);
+
 		fsnotify_mkdir(dir, dentry);
+	}
 out_up_read:
 	up_read(&fs_info->subvol_sem);
 out_dput:
-- 
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ