Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2013 19:38:33 +0100
From:      Harald Schmalzbauer <h.schmalzbauer@omnilan.de>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        Jan Mikkelsen <janm@transactionware.com>, freebsd-stable@freebsd.org
Subject:   Re: Help with filing a [maybe] ZFS/mmap bug.
Message-ID:  <52939929.2090705@omnilan.de>
In-Reply-To: <5289DFFD.7080607@FreeBSD.org>
References:  <20967.760.95825.310085@gargle.gargle.HOWL><51E80B30.1090004@FreeBSD.org><20968.10645.880772.30501@gargle.gargle.HOWL><520202E5.30300@FreeBSD.org><20994.55913.93606.436124@gargle.gargle.HOWL><FEE7BDCF7F494EE1BA0BE9424275AA91@multiplay.co.uk> <21111.12085.958991.356982@gargle.gargle.HOWL> <4EB902F80CE84DD2BF36C85EF4CE8EF8@multiplay.co.uk> <5284B8A5.8040604@FreeBSD.org> <52889105.7040404@FreeBSD.org> <4B5798F5-269A-4E71-9799-E1B4E0C1545F@transactionware.com> <5289DFFD.7080607@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig3448F188F5A0814D37ED50B7
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

 Bez=FCglich Andriy Gapon's Nachricht vom 18.11.2013 10:38 (localtime):
> ...
>>> Here is a patch (for head) that should fix the described above issue:=

>>>
>>> diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops=
=2Ec
>>> b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
>>> index 2e2cbd6..4fcd571 100644
>>> --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
>>> +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
>>> @@ -328,6 +328,20 @@ page_busy(vnode_t *vp, int64_t start, int64_t of=
f, int64_t
>>> nbytes)
>>> {
>>> 	vm_object_t obj;
>>> 	vm_page_t pp;
>>> +	int64_t end;
>>> +
>>> +	/*
>>> +	 * At present vm_page_clear_dirty extends the cleared range to DEV_=
BSIZE
>>> +	 * aligned boundaries, if the range is not aligned.  As a result a
>>> +	 * DEV_BSIZE subrange with partially dirty data may get marked as c=
lean.
>>> +	 * It may happen that all DEV_BSIZE subranges are marked clean and =
thus
>>> +	 * the whole page would be considred clean despite have some dirty =
data.
>>> +	 * For this reason we should shrink the range to DEV_BSIZE aligned
>>> +	 * boundaries before calling vm_page_clear_dirty.
>>> +	 */
>>> +	end =3D rounddown2(off + nbytes, DEV_BSIZE);
>>> +	off =3D roundup2(off, DEV_BSIZE);
>>> +	nbytes =3D end - off;
>>>
>>> 	obj =3D vp->v_object;
>>> 	zfs_vmobject_assert_wlocked(obj);
>>> @@ -362,7 +376,8 @@ page_busy(vnode_t *vp, int64_t start, int64_t off=
, int64_t
>>> nbytes)
>>> 			ASSERT3U(pp->valid, =3D=3D, VM_PAGE_BITS_ALL);
>>> 			vm_object_pip_add(obj, 1);
>>> 			pmap_remove_write(pp);
>>> -			vm_page_clear_dirty(pp, off, nbytes);
>>> +			if (nbytes !=3D 0)
>>> +				vm_page_clear_dirty(pp, off, nbytes);
>>> 		}
>>> 		break;
>>> 	}
>>
>> 9.2 does not seem to have a rounddown2() macro.
> Thanks for the heads-up!
> You could use a plain rounddown() or just 'x & ~(DEV_BSIZE - 1)'.

Hello,

saw that this fix made it int 9-stable:
http://svnweb.freebsd.org/base/stable/9/sys/cddl/contrib/opensolaris/uts/=
common/fs/zfs/zfs_vnops.c?r1=3D255517&r2=3D258555

But it uses rounddown2(), so I guess it's not workit atm, right?

Thanks,

-Harry



--------------enig3448F188F5A0814D37ED50B7
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAlKTmS8ACgkQLDqVQ9VXb8hvXQCfbZW87zScPG453DUiaE1WFou4
jIsAoK55BFn9S0667zSkCYyn0wB6F3eo
=ywUQ
-----END PGP SIGNATURE-----

--------------enig3448F188F5A0814D37ED50B7--



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