Pls ignore this set as I am including these patches
 in the bigger set.

Thanks, Anand

On 03/23/2018 08:53 PM, Anand Jain wrote:
Here are the threads/context [1] in which we read the superblock(s).
And this patchset will make sure the superblock csum are checked
when they are read in the respective context as show below [1].

This patchset is on top of
   [PATCH v2.1] btrfs: check if the fsid in the primary sb and copy sb are same
which is on top of
   [PATCH 0/3] Preparatory to add the csum check in the scan context

[1]

A. dev delete/replace
(its would have been better if we had just used uuid from the userland,
reading the superblock does not make sense to me, but for legacy purpose
we have to continue to support its ioctl args.).

btrfs_rm_device() || btrfs_dev_replace_by_ioctl()
|_btrfs_find_device_by_devspec()
   |_btrfs_find_device_missing_or_by_path()
     |_btrfs_find_device_by_path()
       |_btrfs_get_bdev_and_sb()
         |_btrfs_read_dev_super()
           |_btrfs_read_dev_one_super()
             |___bread()

B. mount

btrfs_mount_root()
  |
  |_btrfs_parse_early_options (-o device only)
  | |_btrfs_scan_one_device
  |   |_btrfs_read_disk_super()
  |     |_read_cache_page_gfp()
  |
  |_btrfs_scan_one_device(mount-arg-dev only)
  | |_btrfs_read_disk_super()
  |   |_read_cache_page_gfp()
  |
  |
  |_btrfs_open_devices(fsid:all)
  |  |_btrfs_open_one_device()
  |    |_btrfs_get_bdev_and_sb()  <--- invalidate_bdev(fsid:all)
  |      |_btrfs_read_dev_super()
  |        |_btrfs_read_dev_one_super()
  |          |___bread()
  |
  |_btrfs_fill_super()
    |_btrfs_open_ctree()   <-- invalidate_bdev(latest_bdev) <-- redundant
      |_btrfs_read_dev_super(latest_bdev only)
      | |_btrfs_read_dev_one_super(latest_bdev only)
      |   |___bread(latest_bdev)
      |
      |_btrfs_check_super_csum(latest_bdev only) [*]
      |
      |_btrfs_read_chunk_tree
        |_read_one_dev()
          |_open_seed_devices()
            |_btrfs_open_devices(fs_devices->seed only)

C. scan/ready

scan/ready
|_btrfs_scan_one_device(ioctl-arg-dev only)
    |_btrfs_read_disk_super()
      |_read_cache_page_gfp()


Anand Jain (2):
   btrfs: verify checksum when superblock is read for mount
   btrfs: verify checksum when superblock is read for scan

  fs/btrfs/disk-io.c | 35 ++++++++++++++++++-----------------
  fs/btrfs/disk-io.h |  1 +
  fs/btrfs/volumes.c | 32 +++++++++++++++++++++++---------
  3 files changed, 42 insertions(+), 26 deletions(-)

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

Reply via email to