[LU-14727] incorrect locking order in ofd_preprw_write() Created: 01/Jun/21  Updated: 15/Apr/22  Resolved: 15/Apr/22

Status: Closed
Project: Lustre
Component/s: None
Affects Version/s: Upstream
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Alex Zhuravlev Assignee: WC Triage
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Blocker
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

found in one customer report:

Call Trace:
[<ffffffffac5bd474>] __lock_page+0x74/0x90				objlock - lockpage
[<ffffffffac5be1e4>] __find_lock_page+0x54/0x70
[<ffffffffac5bee64>] find_or_create_page+0x34/0xa0
[<ffffffffc131be97>] osd_bufs_get+0x487/0xb20 [osd_ldiskfs]
[<ffffffffc16c6266>] ofd_preprw_write.isra.27+0x536/0x10c0 [ofd]
[<ffffffffc16c720e>] ofd_preprw+0x41e/0x8c0 [ofd]
[<ffffffffc0e74ddc>] tgt_brw_write+0xd2c/0x1d60 [ptlrpc]

Call Trace:
[<ffffffffac797dc7>] call_rwsem_down_write_failed+0x17/0x30		trunc - start - objlock
[<ffffffffc12f0e9c>] osd_write_lock+0x5c/0xe0 [osd_ldiskfs]
[<ffffffffc16bfb04>] ofd_object_punch+0x6c4/0xcb0 [ofd]
[<ffffffffc16aa3cf>] ofd_punch_hdl+0x4df/0xa90 [ofd]

Call Trace:
[<ffffffffacb88e79>] schedule+0x29/0x70
[<ffffffffc0442085>] wait_transaction_locked+0x85/0xd0 [jbd2]		lockpage - trunc - start
[<ffffffffc0442378>] add_transaction_credits+0x278/0x310 [jbd2]
[<ffffffffc0442601>] start_this_handle+0x1a1/0x430 [jbd2]
[<ffffffffc0442ab3>] jbd2__journal_start+0xf3/0x1f0 [jbd2]
[<ffffffffc12fd0de>] osd_trans_start+0x20e/0x4e0 [osd_ldiskfs]
[<ffffffffc16c32bc>] ofd_commitrw_write+0x11dc/0x1da0 [ofd]
[<ffffffffc16c7b29>] ofd_commitrw+0x479/0xe20 [ofd]
[<ffffffffc0e750d6>] tgt_brw_write+0x1026/0x1d60 [ptlrpc]

the root cause is that ofd_preprw_write() takes a lock on the object first, then locks pages.

introduced with LU-10048 ofd: take local locks within transaction



 Comments   
Comment by Gerrit Updater [ 01/Jun/21 ]

Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/43883
Subject: LU-14727 ofd: release object lock to lock pages
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 5fee32e53e5e54244509affe27eb239976103c16

Comment by Alex Zhuravlev [ 15/Apr/22 ]

solved in LU-15117

Generated at Sat Feb 10 03:12:15 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.