Merge tag 'for-6.5/block-2023-06-23' of git://git.kernel.dk/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 26 Jun 2023 19:47:20 +0000 (12:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 26 Jun 2023 19:47:20 +0000 (12:47 -0700)
Pull block updates from Jens Axboe:

 - NVMe pull request via Keith:
      - Various cleanups all around (Irvin, Chaitanya, Christophe)
      - Better struct packing (Christophe JAILLET)
      - Reduce controller error logs for optional commands (Keith)
      - Support for >=64KiB block sizes (Daniel Gomez)
      - Fabrics fixes and code organization (Max, Chaitanya, Daniel
        Wagner)

 - bcache updates via Coly:
      - Fix a race at init time (Mingzhe Zou)
      - Misc fixes and cleanups (Andrea, Thomas, Zheng, Ye)

 - use page pinning in the block layer for dio (David)

 - convert old block dio code to page pinning (David, Christoph)

 - cleanups for pktcdvd (Andy)

 - cleanups for rnbd (Guoqing)

 - use the unchecked __bio_add_page() for the initial single page
   additions (Johannes)

 - fix overflows in the Amiga partition handling code (Michael)

 - improve mq-deadline zoned device support (Bart)

 - keep passthrough requests out of the IO schedulers (Christoph, Ming)

 - improve support for flush requests, making them less special to deal
   with (Christoph)

 - add bdev holder ops and shutdown methods (Christoph)

 - fix the name_to_dev_t() situation and use cases (Christoph)

 - decouple the block open flags from fmode_t (Christoph)

 - ublk updates and cleanups, including adding user copy support (Ming)

 - BFQ sanity checking (Bart)

 - convert brd from radix to xarray (Pankaj)

 - constify various structures (Thomas, Ivan)

 - more fine grained persistent reservation ioctl capability checks
   (Jingbo)

 - misc fixes and cleanups (Arnd, Azeem, Demi, Ed, Hengqi, Hou, Jan,
   Jordy, Li, Min, Yu, Zhong, Waiman)

* tag 'for-6.5/block-2023-06-23' of git://git.kernel.dk/linux: (266 commits)
  scsi/sg: don't grab scsi host module reference
  ext4: Fix warning in blkdev_put()
  block: don't return -EINVAL for not found names in devt_from_devname
  cdrom: Fix spectre-v1 gadget
  block: Improve kernel-doc headers
  blk-mq: don't insert passthrough request into sw queue
  bsg: make bsg_class a static const structure
  ublk: make ublk_chr_class a static const structure
  aoe: make aoe_class a static const structure
  block/rnbd: make all 'class' structures const
  block: fix the exclusive open mask in disk_scan_partitions
  block: add overflow checks for Amiga partition support
  block: change all __u32 annotations to __be32 in affs_hardblocks.h
  block: fix signed int overflow in Amiga partition support
  block: add capacity validation in bdev_add_partition()
  block: fine-granular CAP_SYS_ADMIN for Persistent Reservation
  block: disallow Persistent Reservation on partitions
  reiserfs: fix blkdev_put() warning from release_journal_dev()
  block: fix wrong mode for blkdev_get_by_dev() from disk_scan_partitions()
  block: document the holder argument to blkdev_get_by_path
  ...

41 files changed:
1  2 
Documentation/admin-guide/cgroup-v2.rst
block/blk-cgroup.c
block/blk-core.c
block/blk-map.c
block/blk-mq-tag.c
block/blk-mq.c
block/blk-wbt.c
block/fops.c
drivers/block/rbd.c
drivers/block/ublk_drv.c
drivers/block/xen-blkfront.c
drivers/md/dm-ioctl.c
drivers/md/dm-thin.c
drivers/md/dm.c
drivers/md/raid5.c
drivers/mmc/core/block.c
drivers/nvme/host/core.c
drivers/nvme/host/ioctl.c
drivers/nvme/host/multipath.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/s390/block/dasd_ioctl.c
fs/Makefile
fs/btrfs/dev-replace.c
fs/btrfs/ioctl.c
fs/btrfs/super.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h
fs/buffer.c
fs/erofs/super.c
fs/ext4/ext4.h
fs/ext4/super.c
fs/inode.c
fs/nilfs2/super.c
fs/super.c
fs/xfs/xfs_mount.h
fs/xfs/xfs_super.c
fs/zonefs/super.c
include/linux/blkdev.h
include/linux/fs.h
init/do_mounts.c

Simple merge
Simple merge
diff --cc block/blk-map.c
Simple merge
@@@ -38,26 -38,25 +38,29 @@@ static void blk_mq_update_wake_batch(st
  void __blk_mq_tag_busy(struct blk_mq_hw_ctx *hctx)
  {
        unsigned int users;
+       struct blk_mq_tags *tags = hctx->tags;
  
 +      /*
 +       * calling test_bit() prior to test_and_set_bit() is intentional,
 +       * it avoids dirtying the cacheline if the queue is already active.
 +       */
        if (blk_mq_is_shared_tags(hctx->flags)) {
                struct request_queue *q = hctx->queue;
  
 -              if (test_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags))
 +              if (test_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags) ||
 +                  test_and_set_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags))
                        return;
 -              set_bit(QUEUE_FLAG_HCTX_ACTIVE, &q->queue_flags);
        } else {
 -              if (test_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state))
 +              if (test_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state) ||
 +                  test_and_set_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state))
                        return;
 -              set_bit(BLK_MQ_S_TAG_ACTIVE, &hctx->state);
        }
  
-       users = atomic_inc_return(&hctx->tags->active_queues);
-       blk_mq_update_wake_batch(hctx->tags, users);
+       spin_lock_irq(&tags->lock);
+       users = tags->active_queues + 1;
+       WRITE_ONCE(tags->active_queues, users);
+       blk_mq_update_wake_batch(tags, users);
+       spin_unlock_irq(&tags->lock);
  }
  
  /*
diff --cc block/blk-mq.c
@@@ -698,8 -699,9 +703,8 @@@ static void __blk_mq_free_request(struc
  void blk_mq_free_request(struct request *rq)
  {
        struct request_queue *q = rq->q;
 -      struct blk_mq_hw_ctx *hctx = rq->mq_hctx;
  
-       if ((rq->rq_flags & RQF_ELVPRIV) &&
+       if ((rq->rq_flags & RQF_USE_SCHED) &&
            q->elevator->type->ops.finish_request)
                q->elevator->type->ops.finish_request(rq);
  
diff --cc block/blk-wbt.c
Simple merge
diff --cc block/fops.c
@@@ -481,23 -505,20 +505,23 @@@ static int blkdev_open(struct inode *in
         * during an unstable branch.
         */
        filp->f_flags |= O_LARGEFILE;
 -      filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC;
 +      filp->f_mode |= FMODE_BUF_RASYNC;
  
-       if (filp->f_flags & O_NDELAY)
-               filp->f_mode |= FMODE_NDELAY;
+       /*
+        * Use the file private data to store the holder for exclusive openes.
+        * file_to_blk_mode relies on it being present to set BLK_OPEN_EXCL.
+        */
        if (filp->f_flags & O_EXCL)
-               filp->f_mode |= FMODE_EXCL;
-       if ((filp->f_flags & O_ACCMODE) == 3)
-               filp->f_mode |= FMODE_WRITE_IOCTL;
+               filp->private_data = filp;
  
-       bdev = blkdev_get_by_dev(inode->i_rdev, filp->f_mode, filp);
+       bdev = blkdev_get_by_dev(inode->i_rdev, file_to_blk_mode(filp),
+                                filp->private_data, NULL);
        if (IS_ERR(bdev))
                return PTR_ERR(bdev);
  
-       filp->private_data = bdev;
 +      if (bdev_nowait(bdev))
 +              filp->f_mode |= FMODE_NOWAIT;
 +
        filp->f_mapping = bdev->bd_inode->i_mapping;
        filp->f_wb_err = filemap_sample_wb_err(filp->f_mapping);
        return 0;
@@@ -681,19 -697,9 +700,19 @@@ static long blkdev_fallocate(struct fil
        return error;
  }
  
 +static int blkdev_mmap(struct file *file, struct vm_area_struct *vma)
 +{
 +      struct inode *bd_inode = bdev_file_inode(file);
 +
 +      if (bdev_read_only(I_BDEV(bd_inode)))
 +              return generic_file_readonly_mmap(file, vma);
 +
 +      return generic_file_mmap(file, vma);
 +}
 +
  const struct file_operations def_blk_fops = {
        .open           = blkdev_open,
-       .release        = blkdev_close,
+       .release        = blkdev_release,
        .llseek         = blkdev_llseek,
        .read_iter      = blkdev_read_iter,
        .write_iter     = blkdev_write_iter,
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc drivers/md/dm.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc fs/Makefile
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -628,9 -616,10 +627,9 @@@ struct btrfs_device *btrfs_alloc_device
                                        const u64 *devid, const u8 *uuid,
                                        const char *path);
  void btrfs_put_dev_args_from_path(struct btrfs_dev_lookup_args *args);
 -void btrfs_free_device(struct btrfs_device *device);
  int btrfs_rm_device(struct btrfs_fs_info *fs_info,
                    struct btrfs_dev_lookup_args *args,
-                   struct block_device **bdev, fmode_t *mode);
+                   struct block_device **bdev, void **holder);
  void __exit btrfs_cleanup_fs_uuids(void);
  int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len);
  int btrfs_grow_device(struct btrfs_trans_handle *trans,
diff --cc fs/buffer.c
Simple merge
Simple merge
diff --cc fs/ext4/ext4.h
Simple merge
diff --cc fs/ext4/super.c
Simple merge
diff --cc fs/inode.c
Simple merge
Simple merge
diff --cc fs/super.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge