Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159257449
D40857.id124127.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D40857.id124127.diff
View Options
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c
@@ -1217,6 +1217,9 @@
size_t len;
int locked;
int error;
+#if __FreeBSD_version >= 1400093
+ bool unlocked;
+#endif
vp = ap->a_vp;
node = vp->v_data;
@@ -1224,17 +1227,31 @@
if (*ap->a_buflen < len)
return (SET_ERROR(ENOMEM));
+ locked = VOP_ISLOCKED(vp);
/*
* Prevent unmounting of the snapshot while the vnode lock
* is not held. That is not strictly required, but allows
* us to assert that an uncovered snapshot vnode is never
* "leaked".
*/
+#if __FreeBSD_version >= 1400093
+ error = vn_busy_mountedhere(vp, &unlocked, &mp);
+ if (__predict_true(unlocked)) {
+ vn_lock(vp, locked | LK_RETRY);
+ if (VN_IS_DOOMED(vp)) {
+ vfs_unbusy(mp);
+ mp = NULL;
+ }
+ }
+#else
mp = vp->v_mountedhere;
- if (mp == NULL)
+#endif
+ if (__predict_false(mp == NULL))
return (SET_ERROR(ENOENT));
+#if __FreeBSD_version < 1400093
error = vfs_busy(mp, 0);
KASSERT(error == 0, ("vfs_busy(mp, 0) failed with %d", error));
+#endif
/*
* We can vput the vnode as we can now depend on the reference owned
@@ -1242,7 +1259,6 @@
* the reference may go after vfs_unbusy() which has to be called
* before we can lock the vnode again.
*/
- locked = VOP_ISLOCKED(vp);
#if __FreeBSD_version >= 1300045
enum vgetstate vs = vget_prep(vp);
#else
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 12, 11:36 PM (2 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33917097
Default Alt Text
D40857.id124127.diff (1 KB)
Attached To
Mode
D40857: zfsctl_snapshot_vptocnp(): Use vn_busy_mountedhere()
Attached
Detach File
Event Timeline
Log In to Comment