osd-zfs should mark some transactions netfree. this means those
transactions are expected to release space (rather than consume)
and for this kind of transaction half of reserved space is available.
Lustre-change: https://review.whamcloud.com/31444
Lustre-commit:
106abc184d8b57de560dc1874683ce5487dcf30a
Change-Id: Ia5ca247843b296319376c4ac69efad68b557df9f
Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Signed-off-by: Minh Diep <minh.diep@intel.com>
Reviewed-on: https://review.whamcloud.com/31751
Tested-by: Jenkins
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
AC_DEFINE(HAVE_DMU_OBJSET_DISOWN_3ARG, 1,
[Have dmu_objset_disown() with 3 args])
])
+ dnl #
+ dnl # ZFS 0.7.2 adds new method dmu_tx_mark_netfree
+ dnl #
+ LB_CHECK_COMPILE([if ZFS has 'dmu_tx_mark_netfree'],
+ dmu_tx_mark_netfree, [
+ #include <sys/dmu.h>
+ ],[
+ dmu_tx_t *tx = NULL;
+ dmu_tx_mark_netfree(tx);
+ ],[
+ AC_DEFINE(HAVE_DMU_TX_MARK_NETFREE, 1,
+ [Have dmu_tx_mark_netfree])
+ ])
])
AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])
}
tx = dmu_tx_create(osd->od_os);
+ dmu_tx_mark_netfree(tx);
dmu_tx_hold_free(tx, oid, 0, DMU_OBJECT_END);
osd_tx_hold_zap(tx, osd->od_unlinked->dn_object, osd->od_unlinked,
FALSE, NULL);
dmu_objset_disown((os), (tag))
#endif
+#ifndef HAVE_DMU_TX_MARK_NETFREE
+#define dmu_tx_mark_netfree(tx)
+#endif
+
#endif /* _OSD_INTERNAL_H */
/* declare we'll free some blocks ... */
if (start < obj->oo_attr.la_size) {
read_unlock(&obj->oo_attr_lock);
+ dmu_tx_mark_netfree(oh->ot_tx);
dmu_tx_hold_free(oh->ot_tx, obj->oo_dn->dn_object, start, len);
} else {
read_unlock(&obj->oo_attr_lock);
oh = container_of0(th, struct osd_thandle, ot_super);
LASSERT(oh->ot_tx != NULL);
+ dmu_tx_mark_netfree(oh->ot_tx);
+
/* declare that we'll remove object from fid-dnode mapping */
zapid = osd_get_name_n_idx(env, osd, fid, NULL, 0, &dn);
osd_tx_hold_zap(oh->ot_tx, zapid, dn, FALSE, NULL);
ONLY=${ONLY:-"$*"}
-#Bug number for excepting test LU-10406
-ALWAYS_EXCEPT="$SANITY_LFSCK_EXCEPT 31c"
+#Bug number for excepting test LU-10732 LU-10406
+ALWAYS_EXCEPT="$SANITY_LFSCK_EXCEPT 9a 31c"
[ "$SLOW" = "no" ] && EXCEPT_SLOW=""
# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
}
run_test 802 "simulate readonly device"
+cleanup_805() {
+ do_facet $SINGLEMDS zfs set quota=$old $fsset
+ unlinkmany $DIR/$tdir/f- 1000000
+ trap 0
+}
+
+test_805() {
+ local zfs_version=$(do_node $SINGLEMDS cat /sys/module/zfs/version)
+ [ "$(facet_fstype mds1)" != "zfs" ] &&
+ skip "ZFS specific test" && return
+ [ $(version_code $zfs_version) -lt $(version_code 0.7.2) ] &&
+ skip "netfree not implemented before 0.7" && return
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.57) ]] ||
+ { skip "Need MDS version at least 2.10.57" && return 0; }
+
+ local fsset
+ local freekb
+ local usedkb
+ local old
+ local quota
+ local pref="osd-zfs.lustre-MDT0000."
+
+ # limit available space on MDS dataset to meet nospace issue
+ # quickly. then ZFS 0.7.2 can use reserved space if asked
+ # properly (using netfree flag in osd_declare_destroy()
+ fsset=$(do_facet $SINGLEMDS lctl get_param -n $pref.mntdev)
+ old=$(do_facet $SINGLEMDS zfs get -H quota $fsset | \
+ gawk '{print $3}')
+ freekb=$(do_facet $SINGLEMDS lctl get_param -n $pref.kbytesfree)
+ usedkb=$(do_facet $SINGLEMDS lctl get_param -n $pref.kbytestotal)
+ let "usedkb=usedkb-freekb"
+ let "freekb=freekb/2"
+ if let "freekb > 5000"; then
+ let "freekb=5000"
+ fi
+ do_facet $SINGLEMDS zfs set quota=$(((usedkb+freekb)*1024)) $fsset
+ trap cleanup_805 EXIT
+ mkdir $DIR/$tdir
+ $LFS setstripe -E 1M -L mdt $DIR/$tdir || error "DoM not working"
+ createmany -m $DIR/$tdir/f- 1000000 && error "ENOSPC wasn't met"
+ rm -rf $DIR/$tdir || error "not able to remove"
+ do_facet $SINGLEMDS zfs set quota=$old $fsset
+ trap 0
+}
+run_test 805 "ZFS can remove from full fs"
+
#
# tests that do cleanup/setup should be run at the end
#
if (strlen(mop->mo_mkfsopts) != 0)
snprintf(str, len, " -o %s", mop->mo_mkfsopts);
+ if (mop->mo_device_kb)
+ snprintf(str, len, " -o quota=%llu",
+ mop->mo_device_kb * 1024);
return str;
}