Whamcloud - gitweb
LU-14740 llite: avoid project quota overflow
authorWang Shilong <wshilong@ddn.com>
Wed, 28 Jul 2021 02:31:17 +0000 (10:31 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 23 Sep 2021 03:55:06 +0000 (03:55 +0000)
commit40be456110858d5f0767a69e561dbf0a0eb98cc0
tree5d00a224437261bdcd76ca81ffeb82b900b2fe9d
parent0bd93a0db134ced6b116728f5ec27fe075aab03c
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.

Lustre-change: https://review.whamcloud.com/43939
Lustre-commit: 3ffa5d680f0092ae51ffa84bd94a9983f9a8c99e

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-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44938
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/llite/file.c
lustre/tests/sanity-quota.sh