From 7c6811e6756423b54c7c0411ede07f860bfebce2 Mon Sep 17 00:00:00 2001 From: delphij Date: Wed, 9 Jul 2014 23:14:59 +0000 Subject: MFV r268455: Use reserved space for ZFS administrative commands. We reserve 1/2^spa_slop_shift = 1/32 or 3.125% of pool space (or 32MB at least) for system use. Most ZPL operations, e.g. write(2), creat(2), will fail with ENOSPC if we fall below this. Certain operations, e.g. file removal and most administrative actions, still permitted until half of the slop space is used. This would allow users to use these operations to free up space in the pool when pool is close to full but half of slop space is still free. A very restricted set of operations that frees up space or change quota are always permitted, regardless of the amount of free space. MFC after: 2 weeks --- cddl/contrib/opensolaris/cmd/zfs/zfs_main.c | 7 +++++-- cddl/contrib/opensolaris/cmd/zhack/zhack.c | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'cddl/contrib') diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c index a6dba38..a3b461e 100644 --- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c +++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright 2012 Milan Jurik. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek . @@ -6856,6 +6856,9 @@ zfs_do_bookmark(int argc, char **argv) case ENOTSUP: err_msg = "bookmark feature not enabled"; break; + case ENOSPC: + err_msg = "out of space"; + break; default: err_msg = "unknown error"; break; @@ -6864,7 +6867,7 @@ zfs_do_bookmark(int argc, char **argv) dgettext(TEXT_DOMAIN, err_msg)); } - return (ret); + return (ret != 0); usage: usage(B_FALSE); diff --git a/cddl/contrib/opensolaris/cmd/zhack/zhack.c b/cddl/contrib/opensolaris/cmd/zhack/zhack.c index ace8c32..6e3f029 100644 --- a/cddl/contrib/opensolaris/cmd/zhack/zhack.c +++ b/cddl/contrib/opensolaris/cmd/zhack/zhack.c @@ -20,7 +20,7 @@ */ /* - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. */ @@ -362,7 +362,7 @@ zhack_do_feature_enable(int argc, char **argv) feature.fi_guid); VERIFY0(dsl_sync_task(spa_name(spa), NULL, - zhack_feature_enable_sync, &feature, 5)); + zhack_feature_enable_sync, &feature, 5, ZFS_SPACE_CHECK_NORMAL)); spa_close(spa, FTAG); @@ -473,7 +473,8 @@ zhack_do_feature_ref(int argc, char **argv) } VERIFY0(dsl_sync_task(spa_name(spa), NULL, - decr ? feature_decr_sync : feature_incr_sync, &feature, 5)); + decr ? feature_decr_sync : feature_incr_sync, &feature, + 5, ZFS_SPACE_CHECK_NORMAL)); spa_close(spa, FTAG); } -- cgit v1.1