Whamcloud - gitweb
LU-12780 scrub: all update to bitfields must be protected. 74/38974/2
authorMr NeilBrown <neilb@suse.de>
Thu, 18 Jun 2020 01:38:25 +0000 (11:38 +1000)
committerOleg Drokin <green@whamcloud.com>
Tue, 23 Jun 2020 08:12:41 +0000 (08:12 +0000)
commit23a6e1ed8eec2c07653ed07c35bb109ecb87a5b7
tree4948b44070c7ba6a4d04edfc23685e07366354b1
parent6a012fe89a63cea5b0f1008125c5df319c4986cb
LU-12780 scrub: all update to bitfields must be protected.

When a structure contains bitfields, these are updated by
a read-modify-write of the whole word.
If two of these updates can race, corruption can occurs - updates can
be lost.

To avoid this, it is best to protect updates with a spinlock.
Many updates to the os_* bit fields are already protected by
->os_lock.  This patch addes the lock to the remaining updates.
In many cases, this only requires moving a 'lock' earlier, or an
'unlock' later.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I2335d08cd53dcda98d8046d730829347456a6c5d
Reviewed-on: https://review.whamcloud.com/38974
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_scrub.h
lustre/osd-ldiskfs/osd_scrub.c
lustre/osd-zfs/osd_scrub.c