Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Nov 2009 13:01:23 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Doug Barton <dougb@dougbarton.us>
Cc:        freebsd-current@freebsd.org, delphij@freebsd.org
Subject:   Re: multimedia/vlc causes a panic if media files are on msdosfs
Message-ID:  <20091120110123.GG2331@deviant.kiev.zoral.com.ua>
In-Reply-To: <4B05C709.2090005@dougbarton.us>
References:  <4B05C709.2090005@dougbarton.us>

next in thread | previous in thread | raw e-mail | index | archive | help

--3aDvBnBjnpP7iyLb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Nov 19, 2009 at 02:30:33PM -0800, Doug Barton wrote:
> Please see http://www.freebsd.org/cgi/query-pr.cgi?pr=3D140648 for more
> information, including a trace.
>=20
> There is also some evidence that the same problem is triggered by
> accessing files on an NTFS partition. The VLC folks have suggested
> that the problem may be related to threading.

This is because msdosfs and ntfs are not mpsafe, and it seems that
VLC using recently added F_RDAHEAD/F_READAHEAD fcntls.

Please try this.

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 434f54a..676de65 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -718,14 +718,15 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr=
_t arg)
 			do {
 				new =3D old =3D fp->f_flag;
 				new |=3D FRDAHEAD;
-			} while (atomic_cmpset_rel_int(&fp->f_flag, old, new) =3D=3D 0);
+			} while (!atomic_cmpset_rel_int(&fp->f_flag, old, new));
 readahead_vnlock_fail:
 			VFS_UNLOCK_GIANT(vfslocked);
+			vfslocked =3D 0;
 		} else {
 			do {
 				new =3D old =3D fp->f_flag;
 				new &=3D ~FRDAHEAD;
-			} while (atomic_cmpset_rel_int(&fp->f_flag, old, new) =3D=3D 0);
+			} while (!atomic_cmpset_rel_int(&fp->f_flag, old, new));
 		}
 		fdrop(fp, td);
 		break;

--3aDvBnBjnpP7iyLb
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAksGdwEACgkQC3+MBN1Mb4j1gQCg0gTFmpVjn8mwWfsiLGnvKSB0
cdMAoLUn7PzHF9d132OX3+jiVWZplzRQ
=aSIm
-----END PGP SIGNATURE-----

--3aDvBnBjnpP7iyLb--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091120110123.GG2331>