Whamcloud - gitweb
LU-13587 quota: protect qpi in proc 87/43987/7
authorSergey Cheremencev <sergey.cheremencev@hpe.com>
Thu, 15 Apr 2021 14:14:51 +0000 (17:14 +0300)
committerSergey Cheremencev <sergey.cheremencev@hpe.com>
Wed, 27 Oct 2021 18:43:29 +0000 (18:43 +0000)
commita11168f46cf01c45a431a804da01cf67e18ecca9
treebb744823f6c93a9fce25475f04e1b8f15ee5a661
parentd29354b25c02a7799e1833f780bbe9d4e4657581
LU-13587 quota: protect qpi in proc

Access to pool info only when pool is fully inited.
This patch protects from following panic:

[212010.467347] BUG: unable to handle kernel NULL pointer dereference at           (null)
[212010.468205] IP: [<ffffffffc0e55e46>] qpi_state_seq_show+0x86/0xe0 [lquota]
...
[212010.486786] Call Trace:
[212010.487344]  [<ffffffffbbc68b50>] seq_read+0x130/0x440
[212010.487741]  [<ffffffffbbcb8380>] proc_reg_read+0x40/0x80
[212010.488445]  [<ffffffffbbc4118f>] vfs_read+0x9f/0x170
[212010.489056]  [<ffffffffbbc4204f>] SyS_read+0x7f/0xf0
[212010.489920]  [<ffffffffbc176ddb>] system_call_fastpath+0x22/0x27
[212010.490861] Code: 5c a8 01 00 00 41 8b 8c 1c c0 01 00 00 48 c7 c6 18
[212010.493235] RIP  [<ffffffffc0e55e46>] qpi_state_seq_show+0x86/0xe0 [lquota]
[212010.493672] RSP <ffff908505747e28>
[212010.494161] CR2: 0000000000000000

Add test 79 to sanity-quota to check that race between
access to /proc/.../dt-pool_name/info of non-existed pool
with this pool creating doesn't cause a panic.

HPE-bug-id: LUS-9938
Change-Id: I8eff846c6c3881a8431a98efb54e660ecb9155bf
Signed-off-by: Sergey Cheremencev <sergey.cheremencev@hpe.com>
lustre/quota/qmt_internal.h
lustre/quota/qmt_pool.c
lustre/tests/sanity-quota.sh