Whamcloud - gitweb
LU-14535 quota: get all quota info in LFS 98/42098/65
authorHongchao Zhang <hongchao@whamcloud.com>
Sat, 20 Jan 2024 06:39:33 +0000 (14:39 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 23 Mar 2024 05:51:07 +0000 (05:51 +0000)
commit3edc71803af3b4dc672313cd1ba395de724fbc59
tree00031638fea940e09a263315568daf2ed27fb8a4
parentce98bfe5f72657f807201fc7eadae2fee07d7831
LU-14535 quota: get all quota info in LFS

This patch adds option "-a" for LFS to get the quota info of
all quota IDs. it iterates quota setting saved in global quota
setting files "quota_master/md-0x0" and "quota_master/dt-0x0"
from QMT and iterates the quota usage info saved in acct quota
files in the backend FS (LDiskFS or ZFS) from QSDs, then merge
the two kinds of quota info at client and print it in the similar
way as "lfs quota -u|-g|-p".

  $lfs quota -a -u /mnt/lustre
  Filesystem /mnt/lustre, Disk usr quotas
  quota_id  kbytes   quota   limit   grace   files quota limit  grace
      root    9684       0       0       -    1019    0     0       -
       bin       4       0  102400       -       1    0  10240      -
    daemon       4       0  102400       -       1    0  10240      -
       adm       4       0  102400       -       1    0  10240      -
        lp       4       0  102400       -       1    0  10240      -
      sync       4       0  102400       -       1    0  10240      -
  shutdown       4       0  102400       -       1    0  10240      -
      halt       4       0  102400       -       1    0  10240      -
      mail       4       0  102400       -       1    0  10240      -

  $lfs quota -a -g /mnt/lustre
  Filesystem /mnt/lustre, Disk grp quotas
  quota_id  kbytes   quota   limit   grace   files quota limit  grace
      root    9684       0       0       -    1019    0      0      -
       bin       4       0  204800       -       1    0  20480      -
    daemon       4       0  204800       -       1    0  20480      -
       adm       4       0  204800       -       1    0  20480      -
        lp       4       0  204800       -       1    0  20480      -
      sync       4       0  204800       -       1    0  20480      -
  shutdown       4       0  204800       -       1    0  20480      -
      halt       4       0  204800       -       1    0  20480      -
      mail       4       0  204800       -       1    0  20480      -

This patch also fixes an deadlock issue in qmt_pool_recalc,
the rw_semaphore "qmt_pool_info.qpi_sarr.osts.op_rw_sem" has been
acquired in qmt_pool_recalc (read mode), but it was acquired once
more in qmt_seed_glbe_all (read mode) and will be stuck if there
is a pending write mode lock acquisition from another thread.

 qsd_reint_qpool D
 Call Trace:
    schedule+0x29/0x70
    rwsem_down_read_failed+0x105/0x1c0
    call_rwsem_down_read_failed+0x18/0x30
    down_read+0x20/0x40
    qmt_seed_glbe_all+0x3a0/0x800 [lquota]
    qmt_site_recalc_cb+0x3c7/0x800 [lquota]
    cfs_hash_for_each_tight+0x11e/0x330
    cfs_hash_for_each+0x10/0x20 [libcfs]
    qmt_pool_recalc+0x9fc/0x1310 [lquota]

 llog_process_th D
 Call Trace:
    schedule+0x29/0x70
    rwsem_down_write_failed+0x215/0x3c0
    call_rwsem_down_write_failed+0x17/0x30
    down_write+0x2d/0x3d
    lu_tgt_pool_remove+0x36/0x1e0 [obdclass]
    qmt_pool_add_rem+0x655/0x920 [lquota]
    qmt_pool_rem+0x10/0x20 [lquota]
    lod_pool_remove_q+0xd6/0x1d0 [lod]
    class_process_config+0x16f2/0x2b20
    class_config_llog_handler+0x839/0x1540
    llog_process_thread+0x913/0x1c10
    llog_process_thread_daemonize+0x9f/0xe0

Test-Parameters: testlist=sanity-quota env=SLOW=yes,ONLY=49,NUM_QIDS=20000
Change-Id: I08feb928fbf34635ec9c5c341de993c718798dc9
Signed-off-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/42098
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Sergey Cheremencev <scherementsev@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
29 files changed:
contrib/scripts/checkpatch.pl
lustre/doc/lfs-quota.1
lustre/include/lustre_quota.h
lustre/include/lustre_req_layout.h
lustre/include/obd_class.h
lustre/include/obd_support.h
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/llite/dir.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/super25.c
lustre/lmv/lmv_obd.c
lustre/lov/lov_obd.c
lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c
lustre/ofd/ofd_dev.c
lustre/osc/osc_quota.c
lustre/ptlrpc/layout.c
lustre/quota/lquota_internal.h
lustre/quota/lquota_lib.c
lustre/quota/qmt_entry.c
lustre/quota/qmt_handler.c
lustre/quota/qmt_internal.h
lustre/quota/qmt_pool.c
lustre/target/tgt_handler.c
lustre/tests/createmany.c
lustre/tests/sanity-quota.sh
lustre/utils/lfs.c