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 A134F802A5 for ; Thu, 8 Oct 2026 16:53:05 +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 698GpnLi026128; Thu, 8 Oct 2026 19:51:50 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 698GpnLi026128 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1791478312; bh=MDsdLHkjATy5My8/8Y7iS0Db/9fuRADDtRGVH7PNRvQ=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=sm+FP913sPfPH4Zl1UpFy0yDGrLt6rgZIkU0Auf6bDIHSBxNe+MusU7rITm2TLvc4 raiOx1rLMqqAduGmI3bjGWLlyGEsa3PuAcbm5+lj9oIGn/UKT2m5K3sNx2xOydZwAC 5FtrBTbboWR8ofJXyj6wvZGKtOwv9xKXBIuyoWsGJVW6HswCqidCQB9hsMyLM3AMeE gF+4Y6nUiJ2dtHsimIT+XBA94eiXmQYp4UnzEShLPY5wOt8kfm3o0dCpYeSzwWjUBp 6j9KbGOyJTKyLYVx7il4nZvfTWcDYHLix8TNfHM8T/B1BKDPNB5PdPCllx0R8R6/na h2IJG7sDHHoRg== Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 698GpXDU026096 (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 698GpXDU026096 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="CBWDRpIA" Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4a01b112fa2so74759065e9.1 for ; Thu, 08 Oct 2026 09:51:33 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwfttYPYW87rfQ+tR95SALY1zD3WMvfu4qevOAVXbe4M5c6qWFxoopv8wg0LZJc89I37Mfecg==@openvz.org X-Gm-Message-State: AFuF++l6DiGjws1BFhloQrvYx6gnN4EphN3BnYRjDVvEgynjULsCmSTx 68cf3TouprDQYaXc47X1s2p+V1YpQoWkZqCNzq1ZeaTilYiNQGbAbN999peq1W0gP09l8hd2LNO L/Bxzwm+m2rEEY+yg5ozlhgyCDMn4AriKW9XE4PoUG6lAitELTXzIlg== X-Gm-Gg: AYBFou125lmj78lmWpUrW1ZeFf9N9j0bHIBOBRZfM7Y+zOZ9CkQO2KkPCxKszFcs+ln 9X9eLJguaqcLUG7SkQ5PaAQDfNpCaw5Q7D8NxQcXuBq1LPXHWijOQU15EnQMkzFymODVtwFnW5A 5H0aDrZxG3QZZ3YKk9iFsmaABktc6F6Q37Fkr9HWQnktOjQwOK3Drv23+cINRTn6rFIBIzDzajo MbH8dkcKXXsctOjr/oYZeD6xANb1ImEiF7mTrYEhZn2fkWPQZ9nW92TkRHmZ1V76gLmg94Konuh iFzGyRrZRQ== X-Received: by 2002:a05:600c:6986:b0:4a0:2533:c8b7 with SMTP id 5b1f17b1804b1-4a18068313emr90971995e9.35.1791478293498; Thu, 08 Oct 2026 09:51:33 -0700 (PDT) X-Received: by 2002:a05:600c:6986:b0:4a0:2533:c8b7 with SMTP id 5b1f17b1804b1-4a18068313emr90971605e9.35.1791478292914; Thu, 08 Oct 2026 09:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791478292; cv=none; d=google.com; s=arc-20260327; b=Ky87lTFHTRv9FCcVzww6XYBl5IFMEjhgdztsSTpwUEVLmZph8JylEjdIRUYylCLNmI DQKKasPvD5Pna7F0ist3a1fzGjSyu9m6p859PPRjHS1SjqkNTL6Jwby5USFjxWxdLEBD OPEenbaEK/WV88EcREKu9uHNKq/lLLzA2VUlwojVsV+zyBjD4ZvhdaGO6FC2JkICJ7wf CBqfFMTDu19yWW/Q05OZQsjUQ9ISc39ek45Uo07s9lh+wXE5ZJxUypDW3PHKFcM7QGCS 3Uf+g5T9PKutC5GIZPKi2vIrEJnFlzWihJFahDG+p7YqEe+NICilAMHRypQfO7k2sZJz tuQQ== 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=EZk3ke+nJWyvgzLDHatQG9P4RamfWCNqa4lm5VMf64w=; fh=938T6n0vNMas3wrYTYGjMsH0P6aGBA2pIKAh+VD84R8=; b=Avjm1go9H998OifAnkltQy5H1kYkIHhzqc90j4Nz2PibNqe8vmmWOYzuu1J1EQk05b gj6Gw6As6+Zys9rK17ZJl+LLCzDckaqlKxCIyssy4DVFP5mRwbisTGEqL55qxXEfUxX4 Dt5Psq8NxHLvt5dZ9QooIUaB0E7L6aUJdCyRbf/MpC/dB7rV7X7PwllcEdAlZ1mkgW+o DqcQHze6LF3vv6FtaPMUJ9qP2rMItNTtkbi5/OfiuqKiG+Y44p/t0yz13GbYHpChc+Dr ygwQr4DKFjqr7MrdgqGfwPg+q5Zbza6gaKNWeeScMLRRNr+ip8xRNvev5JmjNPZ+O+3j i++g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=CBWDRpIA; 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 5b1f17b1804b1-4a18ae41a6csor159465e9.4.2026.10.08.09.51.32 for (Google Transport Security); Thu, 08 Oct 2026 09:51:32 -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=CBWDRpIA; 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=1791478292; x=1792083092; 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=EZk3ke+nJWyvgzLDHatQG9P4RamfWCNqa4lm5VMf64w=; b=CBWDRpIAGapexWYQHKtxnJLjhZwI7fzWpPZgEqvfmEifpyZGqHhB+Ug9WvXH2yw8Iy b9xQcAGKa+fKRWEr9RL2UDDuFCDz+aaTQygm66TC8Rh90MDLyXIKy7nA9amBVKXKbMhg PLIZRPVl7vZMyLHrh0Xnfvc0qYSJwGvaEQ92M8H4DW49WcWI2uIihwMvRDQyzXME2/7v orXHJDV2YkGjbgUSU51AX3PmaIM2QbLK42os06FBbbWwjaVv0VqxspzDCHgkIIq4fd/r yqio4iKkxsJKL5hZwIL/aYNmAWOJu5X/nfJ25rcWAOUwAZg+PCKVGcoy1l0sTQ11iVXF BJ3g== X-Forwarded-Encrypted: i=1; AKwUvBxHB6wmO97WntjlKBgL7kdat41O5CEpWpmABwOjlMirDUjDY7ykI875pDJVqdBhwCA8BIx6EA==@openvz.org X-Received: by 2002:a05:600c:474c:b0:49e:74b6:740f with SMTP id 5b1f17b1804b1-4a18044dd41mr106414245e9.17.1791478292476; Thu, 08 Oct 2026 09:51:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2026 09:51:32 -0700 (PDT) From: "Denis V. Lunev" To: Alexander Ivanov Date: Thu, 8 Oct 2026 18:51:23 +0200 Message-ID: <20261008184504.review-dmploop-v3-5@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261008140333.614909-6-alexander.ivanov@virtuozzo.com> References: <20261008140333.614909-1-alexander.ivanov@virtuozzo.com> <20261008140333.614909-6-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.1 v3 5/5] dm-ploop: truncate unused tail of top delta on suspend 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: > + end = ploop_calc_used_end(ploop, top->file); > + if (end < 0) { > + PL_ERR("Can't find used end of top delta: %lld", end); > + return; > + } > + if (end >= top->file_size) > + return; > + > + ret = do_ftruncate(top->file, end, 0); Two problems here. 1. A device in standby. ploop switches the queue to standby when the lease of the delta is stolen (-EBUSY) or the mount is gone. dm_replace() in libploop recovers such a device: it suspends it and reloads the table with fresh files. With this patch postsuspend first reads the BAT from the dead file and then truncates it, and a truncate on a dead file hangs. That happens with md->suspend_lock held, so the device can be neither replaced nor removed afterwards. Please do nothing in postsuspend when blk_queue_standby(ploop_blk_queue(ploop)) is set, and skip the prealloc wait from 4/5 in that case too. 2. Another live writer. The truncation assumes the ploop being suspended is the only one writing to the top delta. libploop can break that on the ploop_tg_deinit() error path (see my reply to 4/5). Then suspending or removing the stale instance cuts clusters that the live one has written but whose BAT update is not on disk yet. Before this patch that was harmless, since postsuspend never wrote. A cheap guard: do not truncate when i_size_read(file_inode(top->file)) != top->file_size. Any other writer grows the file, so the sizes no longer match. > + ext_clu = SEC_TO_CLU(ploop, ext_off); > + if (CLU_TO_SEC(ploop, ext_clu) != ext_off || > + ext_clu >= BAT_ENTRY_NONE) { > + used_end = -EPROTO; > + goto out; > + } I checked this against delta_save_optional_header(): the bitmap blocks are appended at EOF and the header block goes after them, so keeping everything up to the header cluster is right. A bogus offset leads to "Can't find used end of top delta" on every suspend. That is fine as long as it stays rare. The comment above ploop_calc_used_end() and the one inside it repeat the commit message almost word for word. One line pointing to delta_save_optional_header() is enough. _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel