linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] verify superblock checksum
@ 2018-03-23 12:53 Anand Jain
  2018-03-23 12:53 ` [PATCH 1/2] btrfs: verify checksum when superblock is read for mount Anand Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anand Jain @ 2018-03-23 12:53 UTC (permalink / raw)
  To: linux-btrfs

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(-)

-- 
2.15.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-26  6:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-23 12:53 [PATCH 0/2] verify superblock checksum Anand Jain
2018-03-23 12:53 ` [PATCH 1/2] btrfs: verify checksum when superblock is read for mount Anand Jain
2018-03-23 12:53 ` [PATCH 2/2] btrfs: verify checksum when superblock is read for scan Anand Jain
2018-03-26  6:34 ` [PATCH 0/2] verify superblock checksum Anand Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).