Whamcloud - gitweb
LU-10900 osd: wrong assertion in osd_transfer_project 93/33993/7
authorLi Xi <lixi@ddn.com>
Wed, 11 Apr 2018 10:10:38 +0000 (06:10 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 5 Mar 2019 15:31:02 +0000 (15:31 +0000)
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.

Lustre-change: https://review.whamcloud.com/31947
Lustre-commit: ee9a90eafe173e22ad3c60a407a28f082fc95341

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 <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: I8c065b9453e0e2b3f9f26e39fc82e8e73902df91
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/33993
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/osd-ldiskfs/osd_handler.c
lustre/tests/sanity-quota.sh

index d69dcc1..b211e1c 100644 (file)
@@ -2630,7 +2630,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
index 38139f7..7afe035 100755 (executable)
@@ -3025,6 +3025,24 @@ test_57() {
 }
 run_test 57 "lfs project could tolerate errors"
 
+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"