Page MenuHomeFreeBSD

D8030.id21809.diff
No OneTemporary

D8030.id21809.diff

Index: sys/kern/vfs_syscalls.c
===================================================================
--- sys/kern/vfs_syscalls.c
+++ sys/kern/vfs_syscalls.c
@@ -446,10 +446,11 @@
size_t *countp, enum uio_seg bufseg, int flags)
{
struct mount *mp, *nmp;
- struct statfs *sfsp, *sp, sb;
+ struct statfs *sfsp, *sp, sb, *tofree;
size_t count, maxcount;
int error;
+restart:
maxcount = bufsize / sizeof(struct statfs);
if (bufsize == 0)
sfsp = NULL;
@@ -464,8 +465,8 @@
mtx_unlock(&mountlist_mtx);
if (maxcount > count)
maxcount = count;
- sfsp = *buf = malloc(maxcount * sizeof(struct statfs), M_TEMP,
- M_WAITOK);
+ tofree = sfsp = *buf =
+ malloc(maxcount * sizeof(struct statfs), M_TEMP, M_WAITOK);
}
count = 0;
mtx_lock(&mountlist_mtx);
@@ -480,9 +481,17 @@
continue;
}
#endif
- if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) {
- nmp = TAILQ_NEXT(mp, mnt_list);
- continue;
+ if (flags == MNT_WAIT) {
+ if (vfs_busy(mp, MBF_MNTLSTLOCK)) {
+ mtx_unlock(&mountlist_mtx);
+ free(tofree, M_TEMP);
+ goto restart;
+ }
+ } else {
+ if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) {
+ nmp = TAILQ_NEXT(mp, mnt_list);
+ continue;
+ }
}
if (sfsp && count < maxcount) {
sp = &mp->mnt_stat;

File Metadata

Mime Type
text/plain
Expires
Mon, Sep 14, 12:06 PM (15 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38906103
Default Alt Text
D8030.id21809.diff (1 KB)

Event Timeline