Re: [PATCH] brd: defer automatic disk creation until module initialization succeeds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

在 2024/10/28 17:44, Christoph Hellwig 写道:
On Mon, Oct 28, 2024 at 05:07:26PM +0800, Yang Erkun wrote:
Fix this problem by following what loop_init() does. Besides,
reintroduce brd_devices_mutex to help serialize modifications to
brd_list.

This looks generally good.  Minor comments below:

+	snprintf(buf, DISK_NAME_LEN, "ram%d", i);
+	mutex_lock(&brd_devices_mutex);
+	list_for_each_entry(brd, &brd_devices, brd_list) {
+		if (brd->brd_number == i) {
+			mutex_unlock(&brd_devices_mutex);
+			err = -EEXIST;
+			goto out;

This now prints an error message for an already existing
device, which should not happen for the module_init case,
but will happen all the time for the probe callback, and
is really annoying.  Please drop that part of the change.

I don't quite understand this, if the gendisk already exists,
the probe callback won't be called from the open path, because
ilookup() from blkdev_get_no_open() will found the bdev inode.
Hence there will only be a small race windown for concurrent
create on open callers to return -EEXIST here.

Thanks,
Kuai





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux