From owner-freebsd-fs@freebsd.org Mon Apr 12 21:19:09 2021 Return-Path: Delivered-To: freebsd-fs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0BEC5DEF9F for ; Mon, 12 Apr 2021 21:19:09 +0000 (UTC) (envelope-from alexander.lochmann@tu-dortmund.de) Received: from unimail.uni-dortmund.de (mx1.hrz.uni-dortmund.de [129.217.128.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "unimail.tu-dortmund.de", Issuer "DFN-Verein Global Issuing CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FK1nm6Fm9z4v38 for ; Mon, 12 Apr 2021 21:19:08 +0000 (UTC) (envelope-from alexander.lochmann@tu-dortmund.de) Received: from [192.168.111.113] (p4fd97a03.dip0.t-ipconnect.de [79.217.122.3]) (authenticated bits=0) by unimail.uni-dortmund.de (8.16.1/8.16.1) with ESMTPSA id 13CLJ5T1020613 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 12 Apr 2021 23:19:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tu-dortmund.de; s=unimail; t=1618262346; bh=JUH0raRnJy49kKCBj9wKVEhccivQuRb8tP/DGSFRC7U=; h=To:From:Subject:Date; b=M1ecCoxARcwlft0ErR1MfyeFpP1RmSWpGwNg5iA76aOW0rntnGkuDJrvds0mEAF08 gBqtTLdlxmSHVf1TqtURPM+k4WpBktxh8JQlcFf6aww0Hry8O50FRNN+sBxFDvPqKb T1QTV2ZeTSjecJsLqPWbWgkOZmtqmH9pxon4cw0Y= To: freebsd-fs@freebsd.org From: Alexander Lochmann Subject: [struct buf] Unlocked access to b_vflags? Message-ID: <792c8a3d-8ea6-073f-3fda-b3eb793ef2b9@tu-dortmund.de> Date: Mon, 12 Apr 2021 23:19:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Xz9eTg4I9kRVYnhegqAunRptWFws7ufoi" X-Rspamd-Queue-Id: 4FK1nm6Fm9z4v38 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tu-dortmund.de header.s=unimail header.b=M1ecCoxA; dmarc=none; spf=pass (mx1.freebsd.org: domain of alexander.lochmann@tu-dortmund.de designates 129.217.128.51 as permitted sender) smtp.mailfrom=alexander.lochmann@tu-dortmund.de X-Spamd-Result: default: False [-4.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[129.217.128.51:from]; R_SPF_ALLOW(-0.20)[+ip4:129.217.128.0/24]; HAS_ATTACHMENT(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; RCVD_IN_DNSWL_MED(-0.20)[129.217.128.51:from]; DKIM_TRACE(0.00)[tu-dortmund.de:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:680, ipnet:129.217.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[79.217.122.3:received]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[tu-dortmund.de:s=unimail]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-fs@freebsd.org]; DMARC_NA(0.00)[tu-dortmund.de]; RCPT_COUNT_ONE(0.00)[1]; DWL_DNSWL_LOW(-1.00)[tu-dortmund.de:dkim]; NEURAL_SPAM_LONG(1.00)[1.000]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-fs] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2021 21:19:10 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Xz9eTg4I9kRVYnhegqAunRptWFws7ufoi Content-Type: multipart/mixed; boundary="OaWKHepOEHtS7AaXTO6zf8SCoFordbWxv"; protected-headers="v1" From: Alexander Lochmann To: freebsd-fs@freebsd.org Message-ID: <792c8a3d-8ea6-073f-3fda-b3eb793ef2b9@tu-dortmund.de> Subject: [struct buf] Unlocked access to b_vflags? --OaWKHepOEHtS7AaXTO6zf8SCoFordbWxv Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi folks, I'm was digging through our data set when I encountered a strange situati= on: According to the code in trunc_dependencies() in sys/ufs/ffs/ffs_softdep.= c, the bo_lock should be held. At least that's how I read the code. However, we see several thousands of accesses to b_vflags without the=20 bo_lock held. At least the own b_lock is acquired. The access happens in line 7549: bp->b_vflags |=3D BV_SCANNED; [1] Can you please shed some light on this situation? Is the b_lock sufficeint, and somehow overrules the bo_lock? Am I missing something? FYI, some information about the greater context: I'm still trying to=20 understand FreeBSD's locking. This is needed to properly port our=20 approach. LockDoc, at the moment, seems to miss some cases on FreeBSD. Regards, Alex [1]=20 https://github.com/freebsd/freebsd-src/blob/main/sys/ufs/ffs/ffs_softdep.= c#L7549 --=20 Technische Universit=C3=A4t Dortmund Alexander Lochmann PGP key: 0xBC3EF6FD Otto-Hahn-Str. 16 phone: +49.231.7556141 D-44227 Dortmund fax: +49.231.7556116 http://ess.cs.tu-dortmund.de/Staff/al --OaWKHepOEHtS7AaXTO6zf8SCoFordbWxv-- --Xz9eTg4I9kRVYnhegqAunRptWFws7ufoi Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEElhZsUHzVP0dbkjCRWT7tBbw+9v0FAmB0uUkFAwAAAAAACgkQWT7tBbw+9v3g Ng//d7n02bCqGpTXFLktsM2AWic4waI9AfGBcbZfxeNDMjVML/IMkLg7HDR7z5HE1QfXs2V2F12R yVypFjrtlFyKbilVhiBz8IJ88toonNPwzW121JpanJ2OVr+C4ZYz7y/3KiUMRnGsP0A6S+Ii1r4X 0/FR7N5bP2o3bII72LPnjnkNMwq7dm7pCOFFvO271m+/bbhyITGpC6UVdfpB3SvtBjMkV3wctcFE GAzVk+OwPWDMYtimSOe9tmcQsjFl/t3+WUIHNvg+yW2YcolDqmQ+beCjCB33IUCzmH4FLMycl3Pp oVCXrfRg2GRiUCBAUJy3X2yLc7izxPdURXGZR1zsZ4qaOnA6RqDnSFUURx29Fxp/8f6/xW+NhtQR AXY8gPixFHbAz/fzt5t/f+L1wmBixBrUEH77qpTUPusRy8ZpDNVWvkHtfx0nAcMV/iAaGjZhbVl4 Sst8IIiLUZYWPZu8dRk2sYrdPJPuzrqwsaHKab/V9M/pfVtXbNY0sdS7yyFg866di72qUjaGsVbd CWT/gkghF2nDqmz/6YaI9EpQcGL8qNYrSV66TRC3YqZ7JXTSAuzR0E1+AIUkM8IpQRbrnUhNRnEu O1SnrO2er65SiBo8DySV9lNObbm7Eg+tP068jc9ZF9nSBtB3D8rwWk0gdlUay4GbRUmxue9yqOh1 ajI= =YaYS -----END PGP SIGNATURE----- --Xz9eTg4I9kRVYnhegqAunRptWFws7ufoi--