Whamcloud - gitweb
LU-16772 quota: access lqe_glbl_data only under mutex
authorSergey Cheremencev <scherementsev@ddn.com>
Mon, 19 Jun 2023 14:55:09 +0000 (18:55 +0400)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 22 Jun 2023 04:12:56 +0000 (04:12 +0000)
commitb195b0576c9bf2ffd98fb5ea3cdb1a19c3199039
tree68298eab46caf9bbdce8ab2651e3cc4489b0d7a2
parent60f29e3c40f863c5aa177292468a5fbe0e4bb9da
LU-16772 quota: access lqe_glbl_data only under mutex

Hold mutex to protect lqe_glbl_data against freeing in
qmt_lvbo_update, qmt_allock_lock_array and qmt_setup_id_desc.
This patch should help against below(LU-14434) and similar panics.

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
  RIP: 0010:qmt_id_lock_cb+0x69/0x100 [lquota]
  qmt_id_lock_cb+0x69/0x100 [lquota]
  qmt_glimpse_lock.isra.19+0x27e/0xfb0 [lquota]
  qmt_reba_thread+0x5da/0x9b0 [lquota]
  kthread+0x112/0x130
  ret_from_fork+0x35/0x40

It is the 2nd part of 50ff4d1da63e8. The latest patchset of
https://review.whamcloud.com/c/fs/lustre-release/+/50748/ has extra
changes, but occasionally has been landed without inspection.
So it's not simple porting from upstream.

Fixes: 50ff4d1da63 ("LU-16772 quota: protect lqe_glbl_data in qmt_site_recalc_cb")
Signed-off-by: Sergey Cheremencev <scherementsev@ddn.com>
Change-Id: I5753ace94a739c6df70dd8ea3bde828e2b5ed812
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51368
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/quota/qmt_lock.c