Whamcloud - gitweb
LU-1676 quota: missing vfs_dq_init() in write path
authorNiu Yawei <niu@whamcloud.com>
Thu, 26 Jul 2012 08:32:58 +0000 (04:32 -0400)
committerOleg Drokin <green@whamcloud.com>
Sun, 2 Sep 2012 02:52:29 +0000 (22:52 -0400)
Calling vfs_dq_init() in the osd_write_commit(), otherwise space
won't be accounted for the existing inode.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: I9671ee9865449dd298139d7668ab17d3d58f8866
Reviewed-on: http://review.whamcloud.com/3476
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <tappro@whamcloud.com>
lustre/osd-ldiskfs/osd_io.c
lustre/tests/sanity-quota.sh

index 4b50e5a..35e08f8 100644 (file)
@@ -692,6 +692,7 @@ static int osd_write_commit(const struct lu_env *env, struct dt_object *dt,
 
         osd_init_iobuf(osd, iobuf, 1);
         isize = i_size_read(inode);
+       ll_vfs_dq_init(inode);
 
         for (i = 0; i < npages; i++) {
                 if (lnb[i].rc == -ENOSPC &&
index 2de459f..43e81de 100644 (file)
@@ -2395,6 +2395,22 @@ test_35() {
                 error "Used inodes for group $TSTID changed from " \
                         "$ORIG_GRP_INODES to $USED"
 
+       # check if the vfs_dq_init() is called before writing
+       echo "Append to the same file..."
+       $RUNAS dd if=/dev/zero of=$DIR/$tdir/$tfile bs=$((BLK_SZ * BLK_CNT)) \
+               count=1 seek=1 conv=fsync 2>/dev/null || error "write failed"
+       sync; sync_all_data;
+
+       echo "Verify space usage is increased"
+       USED=`getquota -u $TSTID global curspace`
+       [ $USED -gt $ORIG_USR_SPACE ] ||
+               error "Used space for user $TSTID isn't increased" \
+                       "orig:$ORIG_USR_SPACE, now:$USED"
+       USED=`getquota -g $TSTID global curspace`
+       [ $USED -gt $ORIG_GRP_SPACE ] ||
+               error "Used space for group $TSTID isn't increased" \
+                       "orig:$ORIG_GRP_SPACE, now:$USED"
+
         cleanup_quota_test
 }
 run_test 35 "usage is still accessible across reboot ============================"