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 <[email protected]>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to