Skip to content

Commit

Permalink
Merge pull request #242 from truenas/NAS-124286-23.10
Browse files Browse the repository at this point in the history
NAS-124286 / 23.10 / fix KeyError crash in mount() (by yocalebo)
  • Loading branch information
yocalebo authored Sep 23, 2023
2 parents 1c62f83 + df972fd commit 95f14d9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions libzfs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4070,14 +4070,20 @@ cdef class ZFSDataset(ZFSResource):
def mount(self):
cdef int ret

if self.properties['mounted'].value == 'no':
with nogil:
ret = libzfs.zfs_mount(self.handle, NULL, 0)
try:
mounted = self.properties['mounted']
except KeyError:
# zvols don't have a mounted property
return
else:
if mounted.value == 'no':
with nogil:
ret = libzfs.zfs_mount(self.handle, NULL, 0)

if ret != 0:
raise self.root.get_error()
if ret != 0:
raise self.root.get_error()

self.root.write_history('zfs mount', self.name)
self.root.write_history('zfs mount', self.name)

IF HAVE_ZFS_ENCRYPTION:
def mount_recursive(self, ignore_errors=False, skip_unloaded_keys=True):
Expand Down

0 comments on commit 95f14d9

Please sign in to comment.