From ee9a90eafe173e22ad3c60a407a28f082fc95341 Mon Sep 17 00:00:00 2001 From: Li Xi Date: Wed, 11 Apr 2018 06:10:38 -0400 Subject: [PATCH] LU-10900 osd: wrong assertion in osd_transfer_project When project ID feature is not enabled on ldiskfs, the project ID of any inode should be zero. osd_transfer_project() made the opposite assertion. Fixes: LU-10565 osd: move ext4_tranfer_project to osd Test-Parameters: trivial testlist=sanity-quota testgroup=review-ldiskfs \ mdtfilesystemtype=ldiskfs ostfilesystemtype=ldiskfs Signed-off-by: Li Xi Signed-off-by: Wang Shilong Change-Id: I8c065b9453e0e2b3f9f26e39fc82e8e73902df91 Reviewed-on: https://review.whamcloud.com/31947 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Gu Zheng Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_handler.c | 2 +- lustre/tests/sanity-quota.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index c271932..80814a8 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -2711,7 +2711,7 @@ static int osd_transfer_project(struct inode *inode, __u32 projid) if (!ldiskfs_has_feature_project(sb)) { LASSERT(__kprojid_val(LDISKFS_I(inode)->i_projid) - != LDISKFS_DEF_PROJID); + == LDISKFS_DEF_PROJID); if (projid != LDISKFS_DEF_PROJID) return -EOPNOTSUPP; else diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 44f3fc3..42f7694 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -3043,6 +3043,24 @@ test_56 () { } run_test 56 "lfs quota -t should work well" +test_59() { + if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then + skip "ldiskfs only test" + return + fi + disable_project_quota + setup_quota_test || error "setup quota failed with $?" + quota_init + + local testfile="$DIR/$tdir/$tfile-0" + #make sure it did not crash kernel + touch $testfile && lfs project -sp 1 $testfile + + enable_project_quota + cleanup_quota_test +} +run_test 59 "lfs project dosen't crash kernel with project disabled" + quota_fini() { do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=-quota" -- 1.8.3.1