LU-12755 ldiskfs: fix project quota unpon unpatched kernel
The value of MAXQUOTAS is the number of quota types supported
by kernel. With project quotas patch applied, MAXQUOTAS is
equal to EXT4_MAXQUOTAS. However, on an unpatched kernel,
project quota type is not supported and MAXQUOTAS is one less
than EXT4_MAXQUOTAS.
In ldiskfs, we need to make sure that the loop in
ext4_quota_off_umount() is limiting the EXT4_MAXQUOTAS loop
to the kernel MAXQUOTAS value. Otherwise, it is trying to
dereference sb_dqopt(sb)->files[2] which is not an inode at all,
and cause the kernel stick on a spinlock in ext4_quota_off()
as follows during unmount:
Call Trace:
[<
ffffffffb9d733c5>] queued_spin_lock_slowpath+0xb/0xf
[<
ffffffffb9d81b30>] _raw_spin_lock+0x20/0x30
[<
ffffffffb9865e2e>] igrab+0x1e/0x60
[<
ffffffffc08a8c4b>] ldiskfs_quota_off+0x3b/0x130 [ldiskfs]
[<
ffffffffc08abcdd>] ldiskfs_put_super+0x4d/0x400 [ldiskfs]
[<
ffffffffb984b13d>] generic_shutdown_super+0x6d/0x100
[<
ffffffffb984b5b7>] kill_block_super+0x27/0x70
[<
ffffffffb984b91e>] deactivate_locked_super+0x4e/0x70
[<
ffffffffb984c0a6>] deactivate_super+0x46/0x60
[<
ffffffffb986abff>] cleanup_mnt+0x3f/0x80
[<
ffffffffb986ac92>] __cleanup_mnt+0x12/0x20
[<
ffffffffb96c1c0b>] task_work_run+0xbb/0xe0
[<
ffffffffb962cc65>] do_notify_resume+0xa5/0xc0
[<
ffffffffb9d8d23b>] int_signal+0x12/0x17
Test-Parameters: clientdistro=el7.7 serverdistro=el7.7
Change-Id: I18a4d97656e2f8478754943424c0fac927f843ca
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/36203
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>