Skip to content

Commit a11a722

Browse files
committed
Merge tag 'block-6.15-20250522' of git://git.kernel.dk/linux
Pull block fixes from Jens Axboe: - Fix for a regression with setting up loop on a file system without ->write_iter() - Fix for an nvme sysfs regression * tag 'block-6.15-20250522' of git://git.kernel.dk/linux: nvme: avoid creating multipath sysfs group under namespace path devices loop: don't require ->write_iter for writable files in loop_configure
2 parents ab719cc + 115c011 commit a11a722

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

drivers/block/loop.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -979,9 +979,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,
979979
if (!file)
980980
return -EBADF;
981981

982-
if ((mode & BLK_OPEN_WRITE) && !file->f_op->write_iter)
983-
return -EINVAL;
984-
985982
error = loop_check_backing_file(file);
986983
if (error)
987984
return error;

drivers/nvme/host/sysfs.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,41 @@ static const struct attribute_group nvme_ns_attr_group = {
306306
};
307307

308308
#ifdef CONFIG_NVME_MULTIPATH
309+
/*
310+
* NOTE: The dummy attribute does not appear in sysfs. It exists solely to allow
311+
* control over the visibility of the multipath sysfs node. Without at least one
312+
* attribute defined in nvme_ns_mpath_attrs[], the sysfs implementation does not
313+
* invoke the multipath_sysfs_group_visible() method. As a result, we would not
314+
* be able to control the visibility of the multipath sysfs node.
315+
*/
316+
static struct attribute dummy_attr = {
317+
.name = "dummy",
318+
};
319+
309320
static struct attribute *nvme_ns_mpath_attrs[] = {
321+
&dummy_attr,
310322
NULL,
311323
};
312324

325+
static bool multipath_sysfs_group_visible(struct kobject *kobj)
326+
{
327+
struct device *dev = container_of(kobj, struct device, kobj);
328+
329+
return nvme_disk_is_ns_head(dev_to_disk(dev));
330+
}
331+
332+
static bool multipath_sysfs_attr_visible(struct kobject *kobj,
333+
struct attribute *attr, int n)
334+
{
335+
return false;
336+
}
337+
338+
DEFINE_SYSFS_GROUP_VISIBLE(multipath_sysfs)
339+
313340
const struct attribute_group nvme_ns_mpath_attr_group = {
314341
.name = "multipath",
315342
.attrs = nvme_ns_mpath_attrs,
343+
.is_visible = SYSFS_GROUP_VISIBLE(multipath_sysfs),
316344
};
317345
#endif
318346

0 commit comments

Comments
 (0)