Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2235165imm; Thu, 2 Aug 2018 08:17:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpds9qzZ+hWHadlnThaMJQXYy8QxdNNEdimuEjYzepGCBjsP22twLDhfvtiZLAC8wr3nz8rQ X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr2723907plu.211.1533223031820; Thu, 02 Aug 2018 08:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533223031; cv=none; d=google.com; s=arc-20160816; b=oky1U/PZzK6CLkBiDgLdnXwMFpi+TsVspsHJkiuviKV1L8x7t0ieNhsmx70as6O5rY ND6M57XLGxUEkPoqhiDJR7Bfm7CMMzHNNIca5iVggzOK2xXqfOY4WM1zdBv3zWH8NRp/ ya7Ww76ut93aXp9jyBEC6JoPWWSZXix7y9RPO1bT+MgA+fqdKIKS7ij/qWNaUkJdo8je HzkI8ojwa2lJy/ldHjueJ5jjYKZ6tyU9KLPohbUTojVgKhj6E/HobVeQokjSSd0oPAlW C73HBacCUqBrKYcP1tMrwMD/HlMvVjgbJtl7UVt9EGCDRuoFlbCAZ/3CA7LXOCT9Bkna nMHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:openpgp:references:cc:to:subject:from :arc-authentication-results; bh=JNR1A3/u7BLd63o3XrJNWH8uoHPnsysPrV6AwkrwVvY=; b=Wg3WX20EkICdBkYV1omRF8aNKhk3mKFYqq9DyZZHAIXOounRtRpr/2nQYGrMBQxd1y +nrnM45+gek+Oewx36c2hBw5lbZgHuAooufMSMBHJn/kQcxUvzoZY5JbXx+9nSyS2wID 5SVHZeJu2QhpVhecxEMgf5U5FOSBXBfEXuBCVY1xqavTS/lNdDzq/URy7zv/KOvs1Aj2 JEGHi3HIXfNJy8w/kIaAwm8GYp1njogC/QhuiFB03nFzJz1bbX4RICuMLkQiWJnYvFuI 34O623AnMBNZiY67CHxqi8H8ZfoWzR8LSdkeyva5wjat5TubF3/gVkffa0f1IdyGf4Yk eJBw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12-v6si1854173pgr.267.2018.08.02.08.16.56; Thu, 02 Aug 2018 08:17:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732619AbeHBRHh (ORCPT + 99 others); Thu, 2 Aug 2018 13:07:37 -0400 Received: from forward100j.mail.yandex.net ([5.45.198.240]:42991 "EHLO forward100j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732436AbeHBRHh (ORCPT ); Thu, 2 Aug 2018 13:07:37 -0400 X-Greylist: delayed 301 seconds by postgrey-1.27 at vger.kernel.org; Thu, 02 Aug 2018 13:07:35 EDT Received: from mxback3o.mail.yandex.net (mxback3o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1d]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 3D6DE5D86A19; Thu, 2 Aug 2018 18:10:56 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback3o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 7LqZQCLByp-Atp4Clje; Thu, 02 Aug 2018 18:10:56 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id kcj9uGicm6-AtTmC9ON; Thu, 02 Aug 2018 18:10:55 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) From: WGH Subject: LVM snapshot broke between 4.14 and 4.16 To: Ilya Dryomov Cc: Jens Axboe , linux-block , linux-kernel@vger.kernel.org, Sagi Grimberg , Mike Snitzer , dm-devel@redhat.com References: <226835ba-2197-b850-6e5b-8ba14f7fd016@torlan.ru> Openpgp: preference=signencrypt Message-ID: <93bff248-6897-4867-841b-2dace11597de@torlan.ru> Date: Thu, 2 Aug 2018 18:10:54 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/02/2018 04:31 PM, Ilya Dryomov wrote: > 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 After further investigation, this was fixed on lvm2 side (userspace) in https://sourceware.org/git/?p=lvm2.git;a=commit;h=a6fdb9d9d70f51c49ad11a87ab4243344e6701a3 (snapshot: keep COW writable for read-only volumes). So I guess that's it. Time to poke my distribution package maintainers to bump the package version.