<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/block/ioctl.c, branch v6.7</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.7</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-10-28T11:29:22Z</updated>
<entry>
<title>fs: Avoid grabbing sb-&gt;s_umount under bdev-&gt;bd_holder_lock</title>
<updated>2023-10-28T11:29:22Z</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2023-10-18T15:29:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fd1464105cb37a3b50a72c1d2902e97a71950af8'/>
<id>urn:sha1:fd1464105cb37a3b50a72c1d2902e97a71950af8</id>
<content type='text'>
The implementation of bdev holder operations such as fs_bdev_mark_dead()
and fs_bdev_sync() grab sb-&gt;s_umount semaphore under
bdev-&gt;bd_holder_lock. This is problematic because it leads to
disk-&gt;open_mutex -&gt; sb-&gt;s_umount lock ordering which is counterintuitive
(usually we grab higher level (e.g. filesystem) locks first and lower
level (e.g. block layer) locks later) and indeed makes lockdep complain
about possible locking cycles whenever we open a block device while
holding sb-&gt;s_umount semaphore. Implement a function
bdev_super_lock_shared() which safely transitions from holding
bdev-&gt;bd_holder_lock to holding sb-&gt;s_umount on alive superblock without
introducing the problematic lock dependency. We use this function
fs_bdev_sync() and fs_bdev_mark_dead().

Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Link: https://lore.kernel.org/r/20231018152924.3858-1-jack@suse.cz
Link: https://lore.kernel.org/r/20231017184823.1383356-1-hch@lst.de
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
</entry>
<entry>
<title>block: Use bdev_open_by_dev() in disk_scan_partitions() and blkdev_bszset()</title>
<updated>2023-10-28T11:29:16Z</updated>
<author>
<name>Jan Kara</name>
<email>jack@suse.cz</email>
</author>
<published>2023-09-27T09:34:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=acb083b55597872dcaebe9e0352da7fdf1684def'/>
<id>urn:sha1:acb083b55597872dcaebe9e0352da7fdf1684def</id>
<content type='text'>
Convert disk_scan_partitions() and blkdev_bszset() to use
bdev_open_by_dev().

Acked-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Christian Brauner &lt;brauner@kernel.org&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Link: https://lore.kernel.org/r/20230927093442.25915-3-jack@suse.cz
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
</entry>
<entry>
<title>block: don't add or resize partition on the disk with GENHD_FL_NO_PART</title>
<updated>2023-08-31T14:00:35Z</updated>
<author>
<name>Li Lingfeng</name>
<email>lilingfeng3@huawei.com</email>
</author>
<published>2023-08-31T07:59:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1a721de8489fa559ff4471f73c58bb74ac5580d3'/>
<id>urn:sha1:1a721de8489fa559ff4471f73c58bb74ac5580d3</id>
<content type='text'>
Commit a33df75c6328 ("block: use an xarray for disk-&gt;part_tbl") remove
disk_expand_part_tbl() in add_partition(), which means all kinds of
devices will support extended dynamic `dev_t`.
However, some devices with GENHD_FL_NO_PART are not expected to add or
resize partition.
Fix this by adding check of GENHD_FL_NO_PART before add or resize
partition.

Fixes: a33df75c6328 ("block: use an xarray for disk-&gt;part_tbl")
Signed-off-by: Li Lingfeng &lt;lilingfeng3@huawei.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Link: https://lore.kernel.org/r/20230831075900.1725842-1-lilingfeng@huaweicloud.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: call into the file system for ioctl BLKFLSBUF</title>
<updated>2023-08-21T12:35:32Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2023-08-11T10:08:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2142b88c37a3e49fbca4a36b8674626917d9bf40'/>
<id>urn:sha1:2142b88c37a3e49fbca4a36b8674626917d9bf40</id>
<content type='text'>
BLKFLSBUF is a historic ioctl that is called on a file handle to a
block device and syncs either the file system mounted on that block
device if there is one, or otherwise the just the data on the block
device.

Replace the get_super based syncing with a holder operation to remove
the last usage of get_super, and to also support syncing the file system
if the block device is not the main block device stored in s_dev.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Josef Bacik &lt;josef@toxicpanda.com&gt;
Message-Id: &lt;20230811100828.1897174-16-hch@lst.de&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
</entry>
<entry>
<title>block: fine-granular CAP_SYS_ADMIN for Persistent Reservation</title>
<updated>2023-06-20T18:49:23Z</updated>
<author>
<name>Jingbo Xu</name>
<email>jefflexu@linux.alibaba.com</email>
</author>
<published>2023-06-13T08:40:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9a72a02456a839676fe8f220a44ef00951596047'/>
<id>urn:sha1:9a72a02456a839676fe8f220a44ef00951596047</id>
<content type='text'>
Allow of unprivileged Persistent Reservation operations on devices
if the write permission check on the device node has passed.

brw-rw---- 1 root disk 259, 0 Jun 13 07:09 /dev/nvme0n1

In the example above, the "disk" group of nvme0n1 is also allowed to
make reservations on the device even without CAP_SYS_ADMIN.

Signed-off-by: Jingbo Xu &lt;jefflexu@linux.alibaba.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Link: https://lore.kernel.org/r/20230613084008.93795-3-jefflexu@linux.alibaba.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: disallow Persistent Reservation on partitions</title>
<updated>2023-06-20T18:49:23Z</updated>
<author>
<name>Jingbo Xu</name>
<email>jefflexu@linux.alibaba.com</email>
</author>
<published>2023-06-13T08:40:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=12629621669b239445727256d1a5dab616b30deb'/>
<id>urn:sha1:12629621669b239445727256d1a5dab616b30deb</id>
<content type='text'>
Refuse Persistent Reservation operations on partitions as reservation
on partitions doesn't make sense.

Besides, introduce blkdev_pr_allowed() helper, where more policies could
be placed here later.

Signed-off-by: Jingbo Xu &lt;jefflexu@linux.alibaba.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Link: https://lore.kernel.org/r/20230613084008.93795-2-jefflexu@linux.alibaba.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: replace fmode_t with a block-specific type for block open flags</title>
<updated>2023-06-12T14:04:05Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2023-06-08T11:02:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=05bdb9965305bbfdae79b31d22df03d1e2cfcb22'/>
<id>urn:sha1:05bdb9965305bbfdae79b31d22df03d1e2cfcb22</id>
<content type='text'>
The only overlap between the block open flags mapped into the fmode_t and
other uses of fmode_t are FMODE_READ and FMODE_WRITE.  Define a new
blk_mode_t instead for use in blkdev_get_by_{dev,path}, -&gt;open and
-&gt;ioctl and stop abusing fmode_t.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Jack Wang &lt;jinpu.wang@ionos.com&gt;		[rnbd]
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Reviewed-by: Christian Brauner &lt;brauner@kernel.org&gt;
Link: https://lore.kernel.org/r/20230608110258.189493-28-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: remove unused fmode_t arguments from ioctl handlers</title>
<updated>2023-06-12T14:04:04Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2023-06-08T11:02:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5e4ea834676e3b8965344ca61d36e1ae236249eb'/>
<id>urn:sha1:5e4ea834676e3b8965344ca61d36e1ae236249eb</id>
<content type='text'>
A few ioctl handlers have fmode_t arguments that are entirely unused,
remove them.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Christian Brauner &lt;brauner@kernel.org&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Link: https://lore.kernel.org/r/20230608110258.189493-27-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: use the holder as indication for exclusive opens</title>
<updated>2023-06-12T14:04:04Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2023-06-08T11:02:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2736e8eeb0ccdc71d1f4256c9c9a28f58cc43307'/>
<id>urn:sha1:2736e8eeb0ccdc71d1f4256c9c9a28f58cc43307</id>
<content type='text'>
The current interface for exclusive opens is rather confusing as it
requires both the FMODE_EXCL flag and a holder.  Remove the need to pass
FMODE_EXCL and just key off the exclusive open off a non-NULL holder.

For blkdev_put this requires adding the holder argument, which provides
better debug checking that only the holder actually releases the hold,
but at the same time allows removing the now superfluous mode argument.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Acked-by: Christian Brauner &lt;brauner@kernel.org&gt;
Acked-by: David Sterba &lt;dsterba@suse.com&gt;		[btrfs]
Acked-by: Jack Wang &lt;jinpu.wang@ionos.com&gt;		[rnbd]
Link: https://lore.kernel.org/r/20230608110258.189493-16-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: introduce holder ops</title>
<updated>2023-06-05T16:53:04Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2023-06-01T09:44:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0718afd47f70cf46877c39c25d06b786e1a3f36c'/>
<id>urn:sha1:0718afd47f70cf46877c39c25d06b786e1a3f36c</id>
<content type='text'>
Add a new blk_holder_ops structure, which is passed to blkdev_get_by_* and
installed in the block_device for exclusive claims.  It will be used to
allow the block layer to call back into the user of the block device for
thing like notification of a removed device or a device resize.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Acked-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Link: https://lore.kernel.org/r/20230601094459.1350643-10-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
