linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz
Cc: Qu Wenruo <quwenruo@cn.fujitsu.com>,
	bo.li.liu@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 0/5] Make btrfs-progs really compatible with any kernel version
Date: Sat, 5 Dec 2015 13:12:29 +0800	[thread overview]
Message-ID: <5662723D.8090903@oracle.com> (raw)
In-Reply-To: <20151204141936.GH31035@suse.cz>



David,

> the possibility of unloaded module that would remove the access to
> sysfs, as you point out.

  Kindly note, the patch below made /dev/btrfs-control a static node,

-----
commit 578454ff7eab61d13a26b568f99a89a2c9edc881
Author: Kay Sievers <kay.sievers@vrfy.org>
Date: Thu May 20 18:07:20 2010 +0200

driver core: add devname module aliases to allow module on-demand 
auto-loading
------

  And here the function, check_or_load_btrfs_ko(), in the PATCH v2 2/5,
  will take care of this problem.

--------
+
+int check_or_load_btrfs_ko()
+{
+	int fd;
+
+	/*
+	 * open will load btrfs kernel module if its not loaded,
+	 * and if the kernel has CONFIG auto load set?
+	 */
+	fd = open("/dev/btrfs-control", O_RDONLY);
+	if (fd < 0)
+		return -errno;
+
+	close(fd);
+	return 0;
+}
+
--------

  Since now static minor number for /dev/btrfs-control is mapped to
  the btrfs kernel module, it will ensure btrfs is loaded when
  /dev/btrfs-control is accessed.

  Further, /dev/btrfs-control node is created by udevd, by reading
  the modules.devname which is either supplied/updated by the distro
  or compilation.

  For systems without udev, IMO should run mknod ..btrfs-control
  in their install script which I guess is a must.

--------
# ls -li /dev/btrfs-control
7338 crw-rw---- 1 root disk 10, 234 Dec  5 10:45 /dev/btrfs-control

# cat modules.devname | egrep btrfs
btrfs btrfs-control c10:234

# cat ./include/linux/miscdevice.h | egrep BTRFS
#define BTRFS_MINOR 234
--------

  So IMO this is not a real problem.

Thanks, Anand


  reply	other threads:[~2015-12-05  5:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23 12:56 [PATCH v2 0/5] Make btrfs-progs really compatible with any kernel version Anand Jain
2015-11-23 12:56 ` [PATCH v2 1/5] btrfs-progs: introduce framework to check kernel supported features Anand Jain
2015-11-24 14:39   ` Mike Fleetwood
2015-11-24 20:21     ` Austin S Hemmelgarn
2015-11-26 17:38       ` David Sterba
2015-11-30 12:30         ` Austin S Hemmelgarn
2015-11-25 10:58   ` [PATCH v3 " Anand Jain
2015-11-23 12:56 ` [PATCH v2 2/5] btrfs-progs: add framework to check features supported by sysfs Anand Jain
2015-11-23 12:56 ` [PATCH v2 3/5] btrfs-progs: kernel based default features for mkfs Anand Jain
2015-11-23 15:57   ` Christoph Anton Mitterer
2015-11-23 16:05     ` Austin S Hemmelgarn
2015-11-23 16:14       ` Christoph Anton Mitterer
2015-11-23 16:55         ` Austin S Hemmelgarn
2015-11-23 12:56 ` [PATCH v2 4/5] btrfs-progs: kernel based default features for btrfs-convert Anand Jain
2015-11-23 12:56 ` [PATCH 5/5] btrfs-progs: add warning when we fail to read sysfs or version Anand Jain
2015-11-23 17:56 ` [PATCH v2 0/5] Make btrfs-progs really compatible with any kernel version David Sterba
2015-11-23 20:14   ` Austin S Hemmelgarn
2015-11-24  6:29     ` Duncan
2015-11-24 13:22   ` Anand Jain
2015-12-04  1:44   ` Liu Bo
2015-12-04  2:08     ` Qu Wenruo
2015-12-04  2:53       ` Liu Bo
2015-12-04  3:57         ` Qu Wenruo
2015-12-04 18:23           ` Liu Bo
2015-12-04 14:19       ` David Sterba
2015-12-05  5:12         ` Anand Jain [this message]
2015-11-24 13:04 ` Anand Jain
2016-11-08 13:14 ` Anand Jain
2016-11-14 12:13   ` David Sterba
2016-11-22  8:54     ` Anand Jain
2016-11-22 13:16       ` David Sterba
2016-11-23  3:00         ` Anand Jain
2016-11-23 10:31           ` 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=5662723D.8090903@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=bo.li.liu@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).