Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102738086
D36202.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D36202.diff
View Options
diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c
--- a/stand/libsa/zfs/zfs.c
+++ b/stand/libsa/zfs/zfs.c
@@ -108,7 +108,8 @@
static int
zfs_open(const char *upath, struct open_file *f)
{
- struct zfsmount *mount = (struct zfsmount *)f->f_devdata;
+ struct devdesc *dev = f->f_devdata;
+ struct zfsmount *mount = dev->d_opendata;
struct file *fp;
int rc;
@@ -149,7 +150,8 @@
static int
zfs_read(struct open_file *f, void *start, size_t size, size_t *resid /* out */)
{
- const spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa;
+ struct devdesc *dev = f->f_devdata;
+ const spa_t *spa = ((struct zfsmount *)dev->d_opendata)->spa;
struct file *fp = (struct file *)f->f_fsdata;
struct stat sb;
size_t n;
@@ -213,7 +215,8 @@
static int
zfs_stat(struct open_file *f, struct stat *sb)
{
- const spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa;
+ struct devdesc *dev = f->f_devdata;
+ const spa_t *spa = ((struct zfsmount *)dev->d_opendata)->spa;
struct file *fp = (struct file *)f->f_fsdata;
return (zfs_dnode_stat(spa, &fp->f_dnode, sb));
@@ -222,7 +225,8 @@
static int
zfs_readdir(struct open_file *f, struct dirent *d)
{
- const spa_t *spa = ((struct zfsmount *)f->f_devdata)->spa;
+ struct devdesc *dev = f->f_devdata;
+ const spa_t *spa = ((struct zfsmount *)dev->d_opendata)->spa;
struct file *fp = (struct file *)f->f_fsdata;
mzap_ent_phys_t mze;
struct stat sb;
@@ -1586,8 +1590,7 @@
rv = zfs_mount(devformat(&dev->dd), NULL, (void **)&mount);
if (rv == 0) {
- f->f_devdata = mount;
- free(dev);
+ dev->dd.d_opendata = mount;
}
return (rv);
}
@@ -1595,25 +1598,18 @@
static int
zfs_dev_close(struct open_file *f)
{
+ struct devdesc *dev;
struct zfsmount *mnt, *mount;
- mnt = f->f_devdata;
+ dev = f->f_devdata;
+ mnt = dev->d_opendata;
STAILQ_FOREACH(mount, &zfsmount, next) {
if (mnt->spa->spa_guid == mount->spa->spa_guid)
break;
}
- /*
- * devclose() will free f->f_devdata, but since we do have
- * pointer to zfsmount structure in f->f_devdata, and
- * zfs_unmount() will also free the zfsmount structure,
- * we will get double free. To prevent double free,
- * we must set f_devdata to NULL there.
- */
- if (mount != NULL)
- f->f_devdata = NULL;
-
+ /* XXX */
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 1:28 PM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14678939
Default Alt Text
D36202.diff (2 KB)
Attached To
Mode
D36202: loader: zfs reader should only store devdesc in f_devdata
Attached
Detach File
Event Timeline
Log In to Comment