From owner-freebsd-geom@freebsd.org Thu Oct 26 14:57:31 2017 Return-Path: Delivered-To: freebsd-geom@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3921BE4B756 for ; Thu, 26 Oct 2017 14:57:31 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26FC780DE4 for ; Thu, 26 Oct 2017 14:57:31 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v9QEvV5S056019 for ; Thu, 26 Oct 2017 14:57:31 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-geom@FreeBSD.org Subject: [Bug 207247] GEOM multipath cycles through all paths to a device even in error conditions Date: Thu, 26 Oct 2017 14:57:31 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 10.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: crest@bultmann.eu X-Bugzilla-Status: Closed X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-geom@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 14:57:31 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207247 Jan Bramkamp changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Status|New |Closed --- Comment #1 from Jan Bramkamp --- *** This bug has been marked as a duplicate of bug 178473 *** --=20 You are receiving this mail because: You are the assignee for the bug.= From owner-freebsd-geom@freebsd.org Thu Oct 26 14:58:12 2017 Return-Path: Delivered-To: freebsd-geom@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63651E4B7FA for ; Thu, 26 Oct 2017 14:58:12 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5127680ED9 for ; Thu, 26 Oct 2017 14:58:12 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v9QEwCWi056927 for ; Thu, 26 Oct 2017 14:58:12 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-geom@FreeBSD.org Subject: [Bug 207247] GEOM multipath cycles through all paths to a device even in error conditions Date: Thu, 26 Oct 2017 14:58:12 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 10.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: crest@bultmann.eu X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-geom@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 14:58:12 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207247 Jan Bramkamp changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|DUPLICATE |--- Status|Closed |In Progress --- Comment #2 from Jan Bramkamp --- The original bug is still unfixed. --=20 You are receiving this mail because: You are the assignee for the bug.= From owner-freebsd-geom@freebsd.org Thu Oct 26 15:06:45 2017 Return-Path: Delivered-To: freebsd-geom@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FBD8E4BB9E for ; Thu, 26 Oct 2017 15:06:45 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D8D881389 for ; Thu, 26 Oct 2017 15:06:45 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v9QF6j77049385 for ; Thu, 26 Oct 2017 15:06:45 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-geom@FreeBSD.org Subject: [Bug 207247] GEOM multipath cycles through all paths to a device even in error conditions Date: Thu, 26 Oct 2017 15:06:45 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: crest@bultmann.eu X-Bugzilla-Status: In Progress X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-geom@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: version Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 15:06:45 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207247 Jan Bramkamp changed: What |Removed |Added ---------------------------------------------------------------------------- Version|10.2-RELEASE |11.1-RELEASE --=20 You are receiving this mail because: You are the assignee for the bug.= From owner-freebsd-geom@freebsd.org Fri Oct 27 13:30:09 2017 Return-Path: Delivered-To: freebsd-geom@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 538A2E45076 for ; Fri, 27 Oct 2017 13:30:09 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D9154655DA for ; Fri, 27 Oct 2017 13:30:08 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf0-f45.google.com with SMTP id g70so7444061lfl.3 for ; Fri, 27 Oct 2017 06:30:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qYIVLEMK+3iLkivIlrB+YGRIGaQDxfwfRaCBMYd2zuk=; b=IowBHK5vbFkOYwPyXgKj7w0oPK5co0YhoLriQEs2Zj0G13hgUhT1cGxDMkGIpuImOV 99D21LUn5JTuphJzVyiemiALGFhKpZfr5xBk7WSCOMArFpRTslPYa7gRaIXo2xpVLHIg Z4xdxc16PZxQDkUBAF41aK0FBNREw9MtEQY4g8CoxJ34ZYPhs1pVyy7DGr9TEjI9jjnp tdC2PPnQeygEfU/E3i5azlCxL0stHjWVnWrCPoNxyedkcN3dLATUob2Jp8mdjkNHq93M Z98lby7l9bWcc+ucfv2UkklHyFCvQdmbxThXLqnR1Nc0nCqrIOD+yEXRIzmhnvcDyugm 8GWg== X-Gm-Message-State: AMCzsaUeBplrGhIVL7BbqByqP1heGIksZtGKXuWKSBchUlKDMfB1yjJS YFKvXJrGpBzSacAPFvYTNWdBHy42HeI= X-Google-Smtp-Source: ABhQp+R/V575c+oxDhwcKEkrGPaWnqBdZ/LnZrIRaqsXGjvVGGv8zyu76DxshMMzjeTKwmVtIbcuSA== X-Received: by 10.46.2.208 with SMTP id y77mr208544lje.183.1509111001301; Fri, 27 Oct 2017 06:30:01 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id m27sm2030605lje.21.2017.10.27.06.29.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 06:30:00 -0700 (PDT) Subject: Re: g_slice_orphan is unsafe? orphanization in general? From: Andriy Gapon To: freebsd-geom@FreeBSD.org References: <02411be8-b5c5-9e0d-c16d-8cdbdf480cf1@FreeBSD.org> Message-ID: Date: Fri, 27 Oct 2017 16:29:59 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <02411be8-b5c5-9e0d-c16d-8cdbdf480cf1@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 13:30:09 -0000 On 09/10/2017 10:17, Andriy Gapon wrote: > > void > g_slice_orphan(struct g_consumer *cp) > { > struct g_slicer *gsp; > > g_trace(G_T_TOPOLOGY, "g_slice_orphan(%p/%s)", cp, cp->provider->name); > g_topology_assert(); > > /* XXX: Not good enough we leak the softc and its suballocations */ > gsp = cp->geom->softc; > cp->geom->softc = NULL; <--- I think that doing this is unsafe > g_slice_free(gsp); <--- and this > g_wither_geom(cp->geom, ENXIO); > } So, g_slice_orphan() is obviously unsafe as it destroys its softc even before it errors its geom and its providers. I have created a review request for my attempt to fix the problem: https://reviews.freebsd.org/D12809 I am still somewhat concerned about the lack of a lock-step mechanism between setting an error on a provider and checking nstart/nend (described below). But given the amount of inter-thread communication required before a provider is actually "finished", I do not think that any problem are likely because of that. > I do not see how g_slice_orphan() - or, in fact, the whole orphanization process > - is synchronized with g_io_request() and g_io_schedule_down(). I think that it > is quite possible for a geom to become orphaned after g_io_check() succeeds and > before geom->start is executed (or while it's being executed). > I see that there is an attempt to prevent orphanization while a geom is in use. > The code in one_event() does not call geom->orphan until pp->nstart == pp->nend. > But there is no common lock to actually synchronize the check and updates of > the variables. Atomic operations are not used either. So, in my opinion, the > check is not really safe. > > It looks like r162200 attempted to fix the general problem but either it was not > a complete solution or the I/O code was later changed: > https://svnweb.freebsd.org/base?view=revision&revision=162200 > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=102766 > > Back to g_slice, I see that g_slice_start() makes use of the softc. So, this is > why I believe that destroying it right in g_slice_orphan is not correct. > > It seems that other GEOM classes go to greater lengths to ensure that there is > no race between orphanization and I/O processing. Typically an internal lock > and a flag seems to be used. > > I wonder if g_slice should follow that technique. > Or maybe it's better to use a lock or atomic operations at GEOM infrastructure > level to ensure that changes to pp->error, pp->flags, pp->nstart and pp->nend > are really seen by other threads and in the correct order. > -- Andriy Gapon From owner-freebsd-geom@freebsd.org Sat Oct 28 08:30:29 2017 Return-Path: Delivered-To: freebsd-geom@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73F99E5F2FD for ; Sat, 28 Oct 2017 08:30:29 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "gate2.funkthat.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D8D06843D for ; Sat, 28 Oct 2017 08:30:28 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.15.2/8.15.2) with ESMTPS id v9S8URBY018225 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 28 Oct 2017 01:30:28 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.15.2/8.15.2/Submit) id v9S8URTD018224; Sat, 28 Oct 2017 01:30:27 -0700 (PDT) (envelope-from jmg) Date: Sat, 28 Oct 2017 01:30:27 -0700 From: John-Mark Gurney To: HSR Hackspace Cc: freebsd-geom@freebsd.org Subject: Re: Fwd: EXT2 partitioning in BSD Message-ID: <20171028083027.GH42467@funkthat.com> Mail-Followup-To: HSR Hackspace , freebsd-geom@freebsd.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 11.0-RELEASE-p7 amd64 X-PGP-Fingerprint: D87A 235F FB71 1F3F 55B7 ED9B D5FF 5A51 C0AC 3D65 X-Files: The truth is out there X-URL: https://www.funkthat.com/ X-Resume: https://www.funkthat.com/~jmg/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.6.1 (2016-04-27) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (gold.funkthat.com [127.0.0.1]); Sat, 28 Oct 2017 01:30:28 -0700 (PDT) X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 08:30:29 -0000 HSR Hackspace wrote this message on Thu, Sep 07, 2017 at 22:36 +0530: > Hi folks; > > I'm writing this mail regarding a strange issue while formatting a > parting as ext2 on a x86 > machine running Freebsd 10.1 with MBR partitioning with BSDDISKLABEL > support enabled. > > Warning: could not erase sector 0: Operation not permitted or > Warning: could not erase sector 0: Attempt to write block to file > system resulted in short write > > If I try to format same partition as UFS. Formatting is clean which I > think proves that HDD (512 byte sectors) is good. > > This is not HDD or kernel issue as in GPT partitioning case I use > same kernel. Does BSD disk label or MBR partitioning require anything > extra (other > than FS system support) to be enabled in kernel? > > I have posted more details and logs here: > > https://unix.stackexchange.com/questions/390050/creating-a-ext2-partition-on-freebsd-10-1-running-on-x86-based-box-with-mbr-part > > Appreciate any help that can guide my debugging for this issue. Sorry for the late reply. The issue is that your partion a, starts at the begining of the slice: => 0 2339839908 mfid0s1c BSD (1.1T) 0 4194304 1 (null) (2.0G) GEOM protects the first 16 sectors in order to prevent file systems from overwriting the bsdlabel... If you move this to start at sector 16 instead of 0, then you will not get the error... UFS "knew" about the bsdlabel, and always skipped the first 16 sectors to not overwrite them. If you tried this on pre-geom machines, you would have corrupted your bsdlabel. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."