From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id D68248017D for ; Thu, 8 Oct 2026 16:53:00 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 698GpiGh026121; Thu, 8 Oct 2026 19:51:45 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 698GpiGh026121 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1791478308; bh=vnRITYyjl5XseOqP5uWNTxBU6VDTB2u1IL7RiwZGsZg=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=YrsV8xVf/3g8cUo99ZzEnpTy0X1bbto67KGi6TxQuNyqhHd1onC1I52LrbD0475TT 5mNPQLlfRMcdTPh+nYdTesod0JlZNXSghw7XxEFZrzsJZ8/ywIr9np0Ol07zEJgQc7 4iSwLrrjmJwKtANjISvQS7CckzkDMA0zYf408DF1/8Y4aptvt3eXCIcY/Zf3YLmYRR VJBpJ2FRjK9n0NWVa1Hrjjx14HoaoARBtZkPwiesu80Mr01Ku5MCKkZLqbCoBe1G3e bTCBp2PvDj6hQisLUrq8f41acaeHs8zt1/+ttuCpYjW6mhPn1DHm84Q/dApGpgKfY9 3Lgxi9StGCmfg== Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 698GpWh5026092 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 8 Oct 2026 19:51:33 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 698GpWh5026092 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="S2+1yAhh" Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-48afe67dfc2so598109f8f.1 for ; Thu, 08 Oct 2026 09:51:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBxS2RC3Sozn27g8SSbXwfEFEvKj/TOJrx2Cjydwjrn2ZnYNvqfpLs6etNd0ZmpTh0/C8AjKcg==@openvz.org X-Gm-Message-State: AFuF++l8TpVCvqNuw0ErUJoQSnEy6Me4Z2Zu5SsS+InOCd4boXtoIk0k LRPmIm7ACxOGBbw684dP9mBDiIg8xHA+sjqEOVTbAa1llRUqPUtYz+WwI91mlrcuYRVgtda544u SIDcmgS+7Qv6MZt58RbwDnVaoRRdQT09o9ZGTXs/n+bLPeIzrhdoOaA== X-Gm-Gg: AYBFou1W+LN05afMNJ8TIRLFLxGzF6qgE0qwydjzc0To5rgFkpYdCO+hThr3/d0NMYT gyjyyldVDyTQBys/3V2rqFJOeMb9r6pxY5ep/Wnk2iP6zFvvS6SrmE9AvQMPYEwWGATjMBN6FRn ObFY/CUOlwOw58OO5Z5pHlEnE3qIH4tK6iNStv9bbAPJuuYtbTbCakkIpDKNiilV9+qtf8drUPm CtjPHYUNNcNyI6IShkDGqPZWvgeRzY8EVqBCNlbk+a5AkFpPyjRRYAseRLIVzgXdfXhFg0DPHhR 92XaJB6KmA== X-Received: by 2002:a05:600c:3643:b0:49d:2589:d8e9 with SMTP id 5b1f17b1804b1-4a1854eb5bdmr41117595e9.11.1791478292547; Thu, 08 Oct 2026 09:51:32 -0700 (PDT) X-Received: by 2002:a05:600c:3643:b0:49d:2589:d8e9 with SMTP id 5b1f17b1804b1-4a1854eb5bdmr41117225e9.11.1791478291979; Thu, 08 Oct 2026 09:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791478291; cv=none; d=google.com; s=arc-20260327; b=LfnKs+bdoSYyGRtFyFDkAn3JwYNgwuzIRDsrOW77M//lFyFab4thJhvKD2FhtnAHaI +1+aU/FAhBa39yOPNW6qPHR6LEvx3o6QJZsbuqIW5g1LvXzHj18Xc31VX9Jt7NJUzv8n TATQNPXhlUmNTmnumNU8McjAPGrr6vC+LUbohOSaT9vJouYR0nAlzkZNE35ESeaiJ8eq K3AEsaPxU3skGYvcikU5b+TbNs8WXP7e99GRgc4Bjq1bxfqRF/ysj+uNDZfSiNh4t3ag 7NHIeoAdoUCUKS99j1VM8hm0tQbZV4A1a13uo+bsZZy9tbtlc1a1dlOXIhj95wmfcrM5 uaqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=1a1wOm5teIm+DyXgBLjOJPlwDKJNX7jNG4wmSTGi/3o=; fh=7KDjePtSthVeMCQSiyJQgFfZNygBQir1fqbonK7Buk0=; b=eauVOwQNrAJvl7naleKTqK+7cIW8LudqOmDt5dl+HcJtS3FWQ/3O64DAoJfk5aoviO wy6NsifA9olu4kGavTV3o/BcaCitfUTeJ19ZjXOkx9E/9pnzH8xEzrUdAiuZVrwCOart ACOUSJCOBwjQiHFFO+HUvWRRoF8Wi+psiD3A+GkUqo0Qja+vHcTD+EtIy4yYbfleIPnx 8Kl1C69JuyD1O4qcdIOt09+LxpiHs+svywAeuy1XR2R6UM7bdTKTJMuS+mx3ua77B5Td xC8LoKzW774B4jbSoM8d+sLUhqP5wVBH6/8c5kINOrGQ1k0yVn9i/y3nvqeBc0YN/9aV XOsg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=S2+1yAhh; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:6a7a:5218:3cb9:a82b as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-48c7c369becsor399162f8f.7.2026.10.08.09.51.31 for (Google Transport Security); Thu, 08 Oct 2026 09:51:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:6a7a:5218:3cb9:a82b as permitted sender) client-ip=2a06:5b06:b600:300:6a7a:5218:3cb9:a82b; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=S2+1yAhh; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:6a7a:5218:3cb9:a82b as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1791478291; x=1792083091; darn=openvz.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=1a1wOm5teIm+DyXgBLjOJPlwDKJNX7jNG4wmSTGi/3o=; b=S2+1yAhhR21GuEuo/VRs/3yz3+n9OoKXOlzP+NcEqTSa4pXClESHvJgMKQ9m7bd+2r gTfmjjs4aUayintOdxZAZko5SArRrr78f9L8zWDUlyqxsp5JXXLIMOtkbk/xE4a4jS6c eO/GqsJ891Pt5J/2QYOstOz4oh/bSlCOhYTbBPTV3SXQzlLnSrQcUfue7XGaOKquS0qS wB0v278/plcF5QRHP0Fo5f9Bxwgr1/vutYR7aU9Ik/wDNn6cKkXjNydd1iNvYaqFWa4y nks3EXzw765WjUYiwRwqkg1Pr+vBeopEPmay+y/4W5ethduaR+akxDJIiXzdMGMvvE/p pL/A== X-Forwarded-Encrypted: i=1; AKwUvBwfzPO9wxWwaz4+L8Oq78mZHCJvzZUJvaEhAZWfJdtAzo6a8r9EqRtcom8kGJXPDCq9huOTsQ==@openvz.org X-Received: by 2002:a05:600c:3d8f:b0:49e:6581:7baf with SMTP id 5b1f17b1804b1-4a1851a3ebcmr59498695e9.2.1791478291471; Thu, 08 Oct 2026 09:51:31 -0700 (PDT) Received: from athena.sw.ru ([2a06:5b06:b600:300:6a7a:5218:3cb9:a82b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1843d8997sm90383545e9.10.2026.10.08.09.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2026 09:51:31 -0700 (PDT) From: "Denis V. Lunev" To: Alexander Ivanov Date: Thu, 8 Oct 2026 18:51:22 +0200 Message-ID: <20261008184503.review-dmploop-v3-4@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261008140333.614909-5-alexander.ivanov@virtuozzo.com> References: <20261008140333.614909-1-alexander.ivanov@virtuozzo.com> <20261008140333.614909-5-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.1 v3 4/5] dm-ploop: reload metadata on resume X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org On 08.10.2026 16:03, Alexander Ivanov wrote: > +static bool ploop_md_pages_are_clean(struct ploop *ploop) > +{ > + struct rb_node *node; > + struct md_page *md; > + > + if (!llist_empty(&ploop->wb_batch_llist) || > + atomic_read(&ploop->inflight_md)) > + return false; > + > + ploop_for_each_md_page(ploop, md, node) { > + if (md->status & (MD_DIRTY | MD_WRITEBACK | MD_UPDATING) || MD_* are bit numbers, not masks. Everybody else does set_bit(MD_UPDATING, &md->status) and test_bit(). MD_UPDATING is (1U << 4), so set_bit() sets bit 16, while this expression tests bits 1, 2 and 4. MD_DIRTY and MD_WRITEBACK are caught only because their values happen to line up with the bits of other flags. MD_UPDATING is never caught. Please use test_bit() for each flag. [...] > @@ -2771,6 +2777,16 @@ loff_t ploop_llseek_hole(struct dm_target *ti, loff_t offset, int whence) [...] > + down_read(&ploop->ctl_rwsem); > + if (ploop->suspended) { > + result = -EAGAIN; > + goto unlock; > + } ploop_message() holds ctl_rwsem for write for the whole command. "merge" walks every cluster of the device in ploop_process_merge_latest_snapshot() and "resize" relocates clusters. SEEK_DATA/SEEK_HOLE used to return at once, now it sleeps uninterruptibly until the merge is over. -EAGAIN is already the "come back later" answer here, so down_read_trylock() returning -EAGAIN fits better. [...] > static void ploop_postsuspend(struct dm_target *ti) > { > + struct ploop *ploop = ti->private; > + > + /* > + * Let the next resumed ploop (maybe of reloaded table) > + * see final size of the top delta. > + */ > + ploop_wait_prealloc(ploop); This is the uninterruptible wait for the allocator. On a device in standby (lease stolen or the mount gone) the allocator may be stuck in fallocate on the dead file forever. Then postsuspend never returns, under md->suspend_lock, and dm_replace() in libploop, which is exactly the tool that recovers a standby device, hangs instead. Before this patch postsuspend never touched the storage. Please skip the wait when blk_queue_standby() is set. See also my reply to 5/5, which has the same problem with the truncate. [...] > - down_read(&ploop->ctl_rwsem); > - if (ploop->noresume) > + down_write(&ploop->ctl_rwsem); > + if (ploop->noresume) { > ret = -EAGAIN; > - up_read(&ploop->ctl_rwsem); > + } else { [...] > + ret = ploop_reload_metadata(ploop); Until now preresume could fail only because of noresume. Now it fails on -ENOMEM (a second copy of the whole BAT tree and holes_bitmap is built under NOIO), on I/O errors and on -EPROTO/-EBADSLT from the images, and the device stays suspended. The message has to say so, and userspace has to be ready for it. It is not today: - create_snapshot_online() ignores the result of ploop_resume_device() and reports success with the device left suspended. So do ploop_stop(), lib/di.c and the qcow2 path in lib/dm.c. - ploop_tg_deinit() is worse. DM swaps the new table into dev before calling preresume, so when dm_resume(dev) fails, dev keeps the new ploop and the tracking table is already gone. The error path then resumes devtg and dev again, and if the retry succeeds two ploop instances are live on the same images. With 5/5 a later suspend or removal of devtg truncates the top delta under the live instance. > + old_hdr = ploop_md_first_entry(&old_bat_entries)->kmpage; > + hdr = ploop_md_first_entry(&ploop->bat_entries)->kmpage; > + hdr->m_DiskInUse = old_hdr->m_DiskInUse; This is needed after flip_upper_deltas, but it is done on every resume. save_cbt() in libploop writes SIGNATURE_DISK_CLOSED_V21 and m_FormatExtensionOffset to the suspended device and then resumes it. If BAT page 0 is written before the device is removed, IN_USE goes back to disk. The check at umount then sees the image in use and trims it at the last data cluster, which cuts off the CBT blocks. This needs a write after the filesystem is unmounted, so it is unlikely. Still, please restrict the override to the flip case or explain why it is safe in general. The patch does four things: the reload, moving prealloc to preresume with the wait on postsuspend, wake_up_interruptible() -> wake_up() for inflight_md_wq, and ctl_rwsem in ploop_llseek_hole(). The last two stand on their own and would be easier to review as separate patches. That would also cut the commit message down to the reload itself. _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel