mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-18 22:33:39 +00:00
- Use better naming now that we allow to rename any mounted file system (not
only legacy). - Update copyright to include myself. MFC after: 2 weeks
This commit is contained in:
parent
8411337f94
commit
9782a86c85
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226707
|
@ -21,6 +21,8 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/dmu_objset.h>
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/dmu.h>
|
||||
|
@ -1248,7 +1250,7 @@ would_change(dsl_dir_t *dd, int64_t delta, dsl_dir_t *ancestor)
|
|||
struct renamearg {
|
||||
dsl_dir_t *newparent;
|
||||
const char *mynewname;
|
||||
boolean_t islegacy;
|
||||
boolean_t allowmounted;
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -1267,10 +1269,9 @@ dsl_dir_rename_check(void *arg1, void *arg2, dmu_tx_t *tx)
|
|||
* stats), but any that are present in open context will likely
|
||||
* be gone by syncing context, so only fail from syncing
|
||||
* context.
|
||||
* Don't check if we are renaming dataset with mountpoint set to
|
||||
* "legacy" or "none".
|
||||
* Don't check if we allow renaming of busy (mounted) dataset.
|
||||
*/
|
||||
if (!ra->islegacy && dmu_tx_is_syncing(tx) &&
|
||||
if (!ra->allowmounted && dmu_tx_is_syncing(tx) &&
|
||||
dmu_buf_refcount(dd->dd_dbuf) > 1) {
|
||||
return (EBUSY);
|
||||
}
|
||||
|
@ -1310,7 +1311,7 @@ dsl_dir_rename_sync(void *arg1, void *arg2, dmu_tx_t *tx)
|
|||
objset_t *mos = dp->dp_meta_objset;
|
||||
int err;
|
||||
|
||||
ASSERT(ra->islegacy || dmu_buf_refcount(dd->dd_dbuf) <= 2);
|
||||
ASSERT(ra->allowmounted || dmu_buf_refcount(dd->dd_dbuf) <= 2);
|
||||
|
||||
if (ra->newparent != dd->dd_parent) {
|
||||
dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD,
|
||||
|
@ -1384,7 +1385,7 @@ dsl_dir_rename(dsl_dir_t *dd, const char *newname, int flags)
|
|||
goto out;
|
||||
}
|
||||
|
||||
ra.islegacy = !!(flags & ZFS_RENAME_IS_LEGACY);
|
||||
ra.allowmounted = !!(flags & ZFS_RENAME_ALLOW_MOUNTED);
|
||||
|
||||
err = dsl_sync_task_do(dd->dd_pool,
|
||||
dsl_dir_rename_check, dsl_dir_rename_sync, dd, &ra, 3);
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DSL_DATASET_H
|
||||
|
@ -181,8 +183,8 @@ struct dsl_ds_holdarg {
|
|||
/*
|
||||
* Flags for dsl_dataset_rename().
|
||||
*/
|
||||
#define ZFS_RENAME_RECURSIVE 0x01
|
||||
#define ZFS_RENAME_IS_LEGACY 0x02
|
||||
#define ZFS_RENAME_RECURSIVE 0x01
|
||||
#define ZFS_RENAME_ALLOW_MOUNTED 0x02
|
||||
|
||||
#define dsl_dataset_is_snapshot(ds) \
|
||||
((ds)->ds_phys->ds_num_children != 0)
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DSL_DIR_H
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FS_ZFS_VFSOPS_H
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -3266,7 +3268,7 @@ zfs_ioc_rename(zfs_cmd_t *zc)
|
|||
if (zc->zc_cookie & 1)
|
||||
flags |= ZFS_RENAME_RECURSIVE;
|
||||
if (zc->zc_cookie & 2)
|
||||
flags |= ZFS_RENAME_IS_LEGACY;
|
||||
flags |= ZFS_RENAME_ALLOW_MOUNTED;
|
||||
|
||||
zc->zc_value[sizeof (zc->zc_value) - 1] = '\0';
|
||||
if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
/* Portions Copyright 2010 Robert Milkowski */
|
||||
|
|
Loading…
Reference in a new issue