Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171115546
D58477.id183019.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
D58477.id183019.diff
View Options
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -879,6 +879,7 @@
vfs_busy(struct mount *mp, int flags)
{
struct mount_pcpu *mpcpu;
+ int error;
MPASS((flags & ~MBF_MASK) == 0);
CTR3(KTR_VFS, "%s: mp %p with flags %d", __func__, mp, flags);
@@ -923,10 +924,24 @@
if (flags & MBF_MNTLSTLOCK)
mtx_unlock(&mountlist_mtx);
mp->mnt_kern_flag |= MNTK_MWAIT;
- msleep(mp, MNT_MTX(mp), PVFS | PDROP, "vfs_busy", 0);
+ error = msleep(mp, MNT_MTX(mp), ((flags & MBF_PCATCH) != 0 ?
+ PCATCH : 0) | PVFS | PDROP, "vfs_busy", 0);
if (flags & MBF_MNTLSTLOCK)
mtx_lock(&mountlist_mtx);
MNT_ILOCK(mp);
+ if (error != 0) {
+ MNT_REL(mp);
+
+ /*
+ * Clearing MNTK_MWAIT might cause spurious
+ * wakeups, but better clear our flag there
+ * then leak it.
+ */
+ mp->mnt_kern_flag &= ~MNTK_MWAIT;
+ wakeup(mp);
+ MNT_IUNLOCK(mp);
+ return (error);
+ }
}
if (flags & MBF_MNTLSTLOCK)
mtx_unlock(&mountlist_mtx);
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -768,7 +768,8 @@
*/
#define MBF_NOWAIT 0x01
#define MBF_MNTLSTLOCK 0x02
-#define MBF_MASK (MBF_NOWAIT | MBF_MNTLSTLOCK)
+#define MBF_PCATCH 0x04
+#define MBF_MASK (MBF_NOWAIT | MBF_MNTLSTLOCK | MBF_PCATCH)
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_MOUNT);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 9, 7:23 PM (15 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38606899
Default Alt Text
D58477.id183019.diff (1 KB)
Attached To
Mode
D58477: statfs(2): allow to interrupt busying
Attached
Detach File
Event Timeline
Log In to Comment