Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2115470imm; Thu, 2 Aug 2018 06:32:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpetRSZU+GzEceItWvcGlXVKDcO2jhqalpeKOpMaqgpohO+2TaxPAOsaQdRHQcGBe6/5wWqn X-Received: by 2002:a63:68c1:: with SMTP id d184-v6mr2834809pgc.239.1533216750002; Thu, 02 Aug 2018 06:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533216749; cv=none; d=google.com; s=arc-20160816; b=aospQIqLEUqEpoo5gn74mPB05f2al35/ODxqZPtBv4eIL6ln6LweJOP8LGgTOPLjoh f85f7P/yQ4mb9/dGFB7njkkOE1jmtSUJWtO4XaPBHKIbJoWo9TqohQmwJjBDwMqsy8Yj TYiSkr+Ff4p7WZlZLu5xzdD70wMqvGfX7kgRdyEkMyjy9CUJ6g2+jI307bFvaRzr/qb0 TAoHASC9aJKD3QegQ/FljwjJsIOUqyodhcLeK2FG0RxWPvSXWlLfMFBbyPCaRpZLiPCB 6nsLr96FHVGq75u1nnu4vOdBaDaqZ+R6H8HS9DBaquLrRrG/LbmtcJulyiJZOaJGfCGA w12g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=0pHMjIl6Vb3EaDIrGcHCh8h5y95IxbFQUCGvk51MQuA=; b=Wt3tFxxYgW5yoUiuGHd1myefOeKCTfMVnGBYQw1LiFoIWlrjITWrHFNeSxXU8zsYfs zwkRicjvIoEf5wPT45QP6FyrfF5KFHFo9ib0sxKfGkLzwNDo2ddQw3QYvd9UWvoFJyQ6 6IyZsZ2XyBlCQADhFQ/IZ3k9l08+829MQcXtjFj6BrPj+iA6ikZg5Naw64tkE38j2Puc 94owGX1/lZS8hkjFiuvyMshBQpbHZLxocZGhF78XbvdbIBZB8qbFBDjcFXV3rQf7ZMG0 6zp1/t6+9j1vvtmR2LxHhq4sjIAPP7XXGjQd/cIfc+5bq30Xctv0/I4Ks1sAvFp39W18 eukg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aMYiAP5e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4-v6si2187568pgg.537.2018.08.02.06.32.15; Thu, 02 Aug 2018 06:32:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aMYiAP5e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387591AbeHBPWa (ORCPT + 99 others); Thu, 2 Aug 2018 11:22:30 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:43923 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387569AbeHBPWa (ORCPT ); Thu, 2 Aug 2018 11:22:30 -0400 Received: by mail-io0-f194.google.com with SMTP id y10-v6so1777460ioa.10; Thu, 02 Aug 2018 06:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0pHMjIl6Vb3EaDIrGcHCh8h5y95IxbFQUCGvk51MQuA=; b=aMYiAP5eD+YvuS/s6Mym/DoyDbW7LlcDVkyKTegf6Tzbj/iPz7LOL9tAzeVlz30inR itdAbYPaQxOTlS4LjdLg/Agrd8eykgpe2xsUVPBo/VBmsGeLADPwvK85DkAoLnBaFIf4 lFZVIcjOjlq3XOA2q13xHqKGzRnW9n/Q+m37/YVQheljeN9uYAljq+qvmVX6Flfg4Pzf ndbyw6Z0YwyWK7xprvxxkXkWqMfPoKCX/Dqn0Fek0RGdG7MZk1hBEZsYu4RXZrQU9WBt 8+NDF1tNyb7MtLuze0ElJFg8hSOO1JBO0e0hKIrkCvp9R7IzuCi4qrJ6JrRVtNOOJAYI PIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0pHMjIl6Vb3EaDIrGcHCh8h5y95IxbFQUCGvk51MQuA=; b=VMxrF/yWeJdBCwk6bQa9Y0dQ7CT3R+busCXMZSEzyYsBT+JUsa4QY9lAsRndtnWk+n EPHNXW6kEPEUAET5mCzxTIoKHVhekNiBQJkyI4A0Mr2TbbTk/Lj6WsGZfeNKg6mNxJql CO8Xmie88soD7gy9k0HU+BOFuuPzirr5Ma/mDsn6o11DZrXt62wWZP2vmOppuua0qZpB /CNZNMV9ba/jL7UEhTIgKgsxWBl7kE3ppKy/qXaOhSouiv1sx0TzHWuSJ5j9jkyaqiHJ viO+HThzf0hUJgg18ilK6UUEYsQxq9Qi3F4aLTfb6hQclsN2c10s/Um31wduqBC1C/mC xROQ== X-Gm-Message-State: AOUpUlEw/4V3t7+KJWwAeQJdvn3nDxsBjWVigvYGqU5C3NjFAPNz3XeY uZg0lmBzRfG8WhB+nTmocWMzadEt+wfczih+RiY= X-Received: by 2002:a6b:b5ca:: with SMTP id e193-v6mr2332128iof.153.1533216676133; Thu, 02 Aug 2018 06:31:16 -0700 (PDT) MIME-Version: 1.0 References: <226835ba-2197-b850-6e5b-8ba14f7fd016@torlan.ru> In-Reply-To: <226835ba-2197-b850-6e5b-8ba14f7fd016@torlan.ru> From: Ilya Dryomov Date: Thu, 2 Aug 2018 15:31:05 +0200 Message-ID: Subject: Re: LVM snapshot broke between 4.14 and 4.16 To: wgh@torlan.ru Cc: Jens Axboe , linux-block , linux-kernel@vger.kernel.org, Sagi Grimberg , Mike Snitzer , dm-devel@redhat.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 2, 2018 at 2:26 PM WGH wrote: > > (I originally reported this problem here: > https://bugzilla.kernel.org/show_bug.cgi?id=200439) > > When I updated from 4.14 to 4.16, my LVM snapshotting script broke for > no apparent reason. > > My script has the following line, and it fails like this: > + lvcreate --size 5G --snapshot --name snap0 --permission r > /dev/mapper/vg0-lvol_rootfs > device-mapper: create ioctl on > vg0-snap0-cowLVM-sDdIeh9cecWdaNyRfZC31mxgfwTa4sOeHMJXVOykGVRtfP6Aii7IHvwS066AOLOM-cow > failed: Device or resource busy > Failed to lock logical volume vg0/lvol_rootfs. > Aborting. Manual intervention required. > > At the same time, some errors appear in dmesg as well: > [ 26.145279] generic_make_request: Trying to write to read-only > block-device dm-3 (partno 0) > [ 26.145288] device-mapper: persistent snapshot: write_header failed > [ 26.145847] device-mapper: table: 253:4: snapshot: Failed to read > snapshot metadata > [ 26.145851] device-mapper: ioctl: error adding target to table > > I bisected the vanilla kernel, and the first bad commit is > [721c7fc701c71f693307d274d2b346a1ecd4a534] block: fail op_is_write() > requests to read-only partitions Adding Mike and dm-devel. From a quick look, --permission r sets DM_READONLY_FLAG, which makes dm mark the disk read-only with set_disk_ro(dm_disk(md), 1) in do_resume(). A bit later it tries to write to the disk from write_header(): return chunk_io(ps, ps->header_area, 0, REQ_OP_WRITE, 0, 1); Thanks, Ilya