Whamcloud - gitweb
LU-14740 llite: avoid project quota overflow 39/43939/8
authorWang Shilong <wshilong@ddn.com>
Mon, 7 Jun 2021 15:40:22 +0000 (23:40 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 27 Jul 2021 21:37:14 +0000 (21:37 +0000)
commit3ffa5d680f0092ae51ffa84bd94a9983f9a8c99e
tree406a925662fb7d4942c80aff090bfb6d26186d1b
parentb1ed8e57da67feddb9c5e67abaf6db1b70333fa0
LU-14740 llite: avoid project quota overflow

Currently, project ID is stored as u32, max possible
value for it is 4294967295.

However, VFS reserve max value for special usage, see
following function:

  static inline bool
  qid_has_mapping(struct user_namespace *ns, struct kqid qid)
  {
          return from_kqid(ns, qid) != (qid_t) -1;
  }

So qid_has_mapping() could return 0 for id 4294967295.
A further try on chown test:

  $ chown 4294967295:4294967295 c.sh
  chown: invalid user: ‘4294967295:4294967295
  $ chown 4294967294:4294967294 c.sh

Fix to check max possible value for project ID in the
client kernel side, and add a test case for this.

Test-parameters: trivial testlist=sanity-quota
Fixes: 7b5c1f1404c3 ("LU-13845 utils: Quota id 0xFFFFFFFF is invalid")
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: Ide8b9cc79d9b7f2a8b9860a0c0f683ec903b8f91
Reviewed-on: https://review.whamcloud.com/43939
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/file.c
lustre/tests/sanity-quota.sh
lustre/utils/lfs.c