Page MenuHomeFreeBSD

D13447.diff
No OneTemporary

D13447.diff

Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
@@ -1888,6 +1888,13 @@
}
}
+ error = zvol_check_open(ddra->ddra_oldname);
+ if (error != 0) {
+ dsl_dir_rele(newparent, FTAG);
+ dsl_dir_rele(dd, FTAG);
+ return (error);
+ }
+
dsl_dir_rele(newparent, FTAG);
dsl_dir_rele(dd, FTAG);
return (0);
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h
@@ -36,6 +36,7 @@
#define ZVOL_ZAP_OBJ 2ULL
#ifdef _KERNEL
+extern int zvol_check_open(const char *);
extern int zvol_check_volsize(uint64_t volsize, uint64_t blocksize);
extern int zvol_check_volblocksize(uint64_t volblocksize);
extern int zvol_get_stats(objset_t *os, nvlist_t *nv);
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
@@ -3062,6 +3062,24 @@
PICKUP_GIANT();
}
+int
+zvol_check_open(const char *name)
+{
+ zvol_state_t *zv;
+ int rc;
+
+ mutex_enter(&zfsdev_state_lock);
+ if ((zv = zvol_minor_lookup(name)) == NULL) {
+ mutex_exit(&zfsdev_state_lock);
+ return (SET_ERROR(ENXIO));
+ }
+ rc = zv->zv_total_opens;
+ mutex_exit(&zfsdev_state_lock);
+ if (rc > 0)
+ return (SET_ERROR(EBUSY));
+ return (0);
+}
+
static int
zvol_d_open(struct cdev *dev, int flags, int fmt, struct thread *td)
{

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 18, 11:17 PM (21 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15903461
Default Alt Text
D13447.diff (1 KB)

Event Timeline