[LU-13246] osd_otable_it_next() can miss spin_unlock() Created: 12/Feb/20  Updated: 14/May/20  Resolved: 14/May/20

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.14.0

Type: Bug Priority: Minor
Reporter: Alex Zhuravlev Assignee: Alex Zhuravlev
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

osd_otable_it_next() in osd-zfs can leave the spinlock locked because of race:

	if (!scrub->os_full_speed)
		spin_lock(&scrub->os_lock);
	it->ooi_prefetched--;
	if (!scrub->os_full_speed) {
		if (scrub->os_waiting) {
			scrub->os_waiting = 0;
			wake_up_all(&thread->t_ctl_waitq);
		}
		spin_unlock(&scrub->os_lock);
	}

os_full_speed may chane in-between which sometimes happens in my testing.



 Comments   
Comment by Gerrit Updater [ 12/Feb/20 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/37547
Subject: LU-13246 osd: unlock os_lock if it was locked
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 38199085fb3720518e21aecc694961d359e99ec9

Comment by Alex Zhuravlev [ 12/Feb/20 ]

I verified this adding an assrtion which got hit:

LustreError: 419:0:(osd_scrub.c:1750:osd_otable_it_next()) ASSERTION( locked == 0 ) failed: 

i.e. the spinlock was taken, but wasn't released.

Comment by Gerrit Updater [ 14/May/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/37547/
Subject: LU-13246 osd: unlock os_lock if it was locked
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: a9b9dd8312417fcb82513108f11b4684b67aefaa

Comment by Peter Jones [ 14/May/20 ]

Landed for 2.14

Generated at Sat Feb 10 02:59:39 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.