WSL2-Linux-Kernel/include/linux/raid
NeilBrown 4b80991c6c md: Protect access to mddev->disks list using RCU
All modifications and most access to the mddev->disks list are made
under the reconfig_mutex lock.  However there are three places where
the list is walked without any locking.  If a reconfig happens at this
time, havoc (and oops) can ensue.

So use RCU to protect these accesses:
  - wrap them in rcu_read_{,un}lock()
  - use list_for_each_entry_rcu
  - add to the list with list_add_rcu
  - delete from the list with list_del_rcu
  - delay the 'free' with call_rcu rather than schedule_work

Note that export_rdev did a list_del_init on this list.  In almost all
cases the entry was not in the list anymore so it was a no-op and so
safe.  It is no longer safe as after list_del_rcu we may not touch
the list_head.
An audit shows that export_rdev is called:
  - after unbind_rdev_from_array, in which case the delete has
     already been done,
  - after bind_rdev_to_array fails, in which case the delete isn't needed.
  - before the device has been put on a list at all (e.g. in
      add_new_disk where reading the superblock fails).
  - and in autorun devices after a failure when the device is on a
      different list.

So remove the list_del_init call from export_rdev, and add it back
immediately before the called to export_rdev for that last case.

Note also that ->same_set is sometimes used for lists other than
mddev->list (e.g. candidates).  In these cases rcu is not needed.

Signed-off-by: NeilBrown <neilb@suse.de>
2008-07-21 17:05:25 +10:00
..
Kbuild
bitmap.h Improve setting of "events_cleared" for write-intent bitmaps. 2008-06-28 08:31:22 +10:00
linear.h md: linear: Make array_size sector-based and rename it to array_sectors. 2008-07-21 17:05:25 +10:00
md.h md: resolve external metadata handling deadlock in md_allow_write 2008-06-30 17:18:19 -07:00
md_k.h md: Protect access to mddev->disks list using RCU 2008-07-21 17:05:25 +10:00
md_p.h md: Remove some unused macros. 2008-07-11 22:02:23 +10:00
md_u.h [PATCH] md: the scheduled removal of the START_ARRAY ioctl for md 2006-10-03 08:04:16 -07:00
multipath.h
raid0.h
raid1.h [PATCH] md: Remove working_disks from raid1 state data 2006-10-03 08:04:17 -07:00
raid5.h md: replace R5_WantPrexor with R5_WantDrain, add 'prexor' reconstruct_states 2008-06-28 08:32:06 +10:00
raid10.h [PATCH] md: remove 'working_disks' from raid10 state 2006-10-03 08:04:17 -07:00
xor.h async_tx: add the async_tx api 2007-07-13 08:06:14 -07:00