Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2449317imm; Thu, 2 Aug 2018 11:46:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfYpJVpfxIdP/vVpDVx2trqUv+bxy543aaRwcvQd0510dmmmgAqRPwN7c0oJEt41Rp9BcDx X-Received: by 2002:a63:35c3:: with SMTP id c186-v6mr588469pga.217.1533235602391; Thu, 02 Aug 2018 11:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533235602; cv=none; d=google.com; s=arc-20160816; b=phFRTSevLFIWekUWPyVl4gm4o92iI2EicWqQbhG3WR0z6MK+3FCgo1syUPdzlqrgzB dESKf5HgK51W1iUxRwfNvP/AsqAykRDTOXydQBDjxAVV9k52B5YWL2cLXH5x0kqd1Thq DkfNxVCglv0nqpAeq2diUbeK/RPKYAsa4FY9cBeyvnrQOUBAyxN5vYfWp3wwimp3qU+J 5+uMI0J/AKugrRgt1iwK6zukvlJOp8Oa1XH/k8Nr42Wllgg7sof3PeTIzdE576jc2z4C pLizv80XPGL1RHiXz5zKePG6OHZCfBwyeDBrIUFEzIIOnIkhKMhPpHK0nA9fWjNshFkJ FxCQ== 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=PQhzsLQokyanw3VY71M9pyBKOUWZ1iBB2Il3h/g6KKQ=; b=MGoyA3W6fgcfwth9lB7/A9UOwXkdVUUEu/VSs5r+sYDG+SmlXuuGc7/e8cmUdJJynF 07jrso5W/ry9kPubNhLP84QGO/ur4boNa6saiNsq8W9DT5wwRW4PeKTzTCTdVdkdXxvi zEuEbcST5TvUHvhQmsCVSapVsxvZ2BQ50ofre/Nl/KCHLlr1zFWmmi2HOyMdaFpoQh7x y7zWaEGNHNJOVc4lPMUv0IIBbihk3nzohMNP8hmgYbL5c6X6eNoxlfokBzLbuODOssV9 E/PuP34wKwpStgPgoBKFBuAGQiwL8Qtt7yc9AaelpZ+c5ymDRpCHxYnCzKI1jU/M+GNJ rVAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=C2xUv1Rh; 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 d191-v6si2382530pga.157.2018.08.02.11.46.27; Thu, 02 Aug 2018 11:46:42 -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=C2xUv1Rh; 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 S1732491AbeHBULL (ORCPT + 99 others); Thu, 2 Aug 2018 16:11:11 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:52700 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726217AbeHBULL (ORCPT ); Thu, 2 Aug 2018 16:11:11 -0400 Received: by mail-it0-f67.google.com with SMTP id d9-v6so4889039itf.2; Thu, 02 Aug 2018 11:18:56 -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=PQhzsLQokyanw3VY71M9pyBKOUWZ1iBB2Il3h/g6KKQ=; b=C2xUv1Rh6qMTXdnUCCVgLhkoLlNw94sno0ahbSCa8HJkDG2pjvDIiIIROeyaqyYm0X tl/LjhgWWBC1e9Ln0UbDVKEllZhdJMQ1UMMWt73TTfPEVRlp1UE6PIVfDpP0uJu8YWIl uif4WILm5PVjs0gO7We53QL9SzR87Gtfyz2QxPu+iwXPwuwyvjeSv7yqer0+tihXttRm YaXZrfbOrk+GW6JyfEDAE/Z2s609OESWzTY7VnPQuy+qZJmhIMY+9K9WnJ/OzWB5qbLE OW3OqoGFvXyricV6pKb6kSQ6YDqkqN1x8HEqlVvkJG9soeBzMcjHVDMrKY4+RCOGYLkN ijTw== 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=PQhzsLQokyanw3VY71M9pyBKOUWZ1iBB2Il3h/g6KKQ=; b=JLV5tith0vk5qry5DTzEgBso1gMkDOfkPcb+H1im0tUhgh9RJhfqn7OPACF13N37d8 wuzkOip127AglM+E93qHW0QX7WGZuXQnZCM/lsPZ8Z1Y++cjrn4aJ/Vw0a4eQnFtyIJQ y6CgI0MgnUBP+NpyXDOMzibp11jD+YZ7OlvF+a4gpu4B6yOMjOla/XZfPnpQhx/HiN4I ZHGKq8jNGCRYy/kvtmFzkM1v9X+9STeyWIGcny2r93bg7A4mkR8RIhHAiztEjL2458c/ xte/Qft/lW4HvjXL/3lvyIy4mwyuVqrzSIRnplzhwAsPYWpam9ugpOoSGpAfH9YRx/R1 50Ug== X-Gm-Message-State: AOUpUlGw4AuBx9x8SBQr1uWdKfrKXt17Uz9kM7wKPXbrdGN/5v2uxDmf Fz6u3jeMehff/UxZyXTvEQ0rlRP2LJG1h/+6Zwk= X-Received: by 2002:a24:68c2:: with SMTP id v185-v6mr3738815itb.128.1533233936128; Thu, 02 Aug 2018 11:18:56 -0700 (PDT) MIME-Version: 1.0 References: <226835ba-2197-b850-6e5b-8ba14f7fd016@torlan.ru> <93bff248-6897-4867-841b-2dace11597de@torlan.ru> In-Reply-To: From: Ilya Dryomov Date: Thu, 2 Aug 2018 20:18:44 +0200 Message-ID: Subject: Re: LVM snapshot broke between 4.14 and 4.16 To: Linus Torvalds Cc: wgh@torlan.ru, 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 6:41 PM Linus Torvalds wrote: > > On Thu, Aug 2, 2018 at 8:16 AM WGH wrote: > > > > On 08/02/2018 04:31 PM, Ilya Dryomov wrote: > > > > > > 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. > > That is *not* how kernel development is supposed to work. If your > script used to work, it should continue to work. > > Why did it use to work despite that read-only flag? And what was it > that actually broke this? I think it was my commit 721c7fc701c7 ("block: fail op_is_write() requests to read-only partitions"). The block layer was previously allowing non-blkdev_write_iter() writes to read-only disks and partitions. dm's chunk_io() boils down to submit_bio(), so in 4.16 it started to fail if the underlying device was marked read-only. > > We remain bug-for-bug compatible with older kernel versions when > people depend on the bugs. Unless the old bugs are security issues, > and even then we try to make it _look_ like we work the same way. > > Or was it a user-space lvm tool that broke in the first place, and the > kernel release update was a red herring? Apparently at least some versions of lvm(8) instruct dm to mark the COW device read-only even though it is always written to. It comes up only if the user asks for a read-only snapshot (the default is writable). One option might be to ignore the supplied DM_READONLY_FLAG for COW devices. Marking the COW device (i.e. the exception store) read-only is probably never sane... Thanks, Ilya