Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1648869

[PATCH 4.9 030/164] dm space map disk: fix some book keeping in the disk space map

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.9 030/164] dm space map disk: fix some book keeping in the disk space map
Date 2017-05-24 00:00 +0200
Message-ID <tKq0r-P7-41@gated-at.bofh.it> (permalink)
References <tKoBk-8ko-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Joe Thornber <ejt@redhat.com>

commit 0377a07c7a035e0d033cd8b29f0cb15244c0916a upstream.

When decrementing the reference count for a block, the free count wasn't
being updated if the reference count went to zero.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/persistent-data/dm-space-map-disk.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

--- a/drivers/md/persistent-data/dm-space-map-disk.c
+++ b/drivers/md/persistent-data/dm-space-map-disk.c
@@ -142,10 +142,23 @@ static int sm_disk_inc_block(struct dm_s
 
 static int sm_disk_dec_block(struct dm_space_map *sm, dm_block_t b)
 {
+	int r;
+	uint32_t old_count;
 	enum allocation_event ev;
 	struct sm_disk *smd = container_of(sm, struct sm_disk, sm);
 
-	return sm_ll_dec(&smd->ll, b, &ev);
+	r = sm_ll_dec(&smd->ll, b, &ev);
+	if (!r && (ev == SM_FREE)) {
+		/*
+		 * It's only free if it's also free in the last
+		 * transaction.
+		 */
+		r = sm_ll_lookup(&smd->old_ll, b, &old_count);
+		if (!r && !old_count)
+			smd->nr_allocated_this_transaction--;
+	}
+
+	return r;
 }
 
 static int sm_disk_new_block(struct dm_space_map *sm, dm_block_t *b)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.9 000/164] 4.9.30-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 00:00 +0200
  [PATCH 4.9 003/164] USB: ene_usb6250: fix DMA to the stack Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 00:00 +0200
  [PATCH 4.9 030/164] dm space map disk: fix some book keeping in the disk space map Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 00:00 +0200
  [PATCH 4.9 051/164] drm/nouveau/tmr: ack interrupt before processing alarms Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 00:00 +0200
  [PATCH 4.9 029/164] dm thin metadata: call precommit before saving the roots Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 00:00 +0200
  [PATCH 4.9 015/164] tpm_tis_spi: Add small delay after last transfer Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 00:00 +0200
  [PATCH 4.9 023/164] dm raid: select the Kconfig option CONFIG_MD_RAID0 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 00:00 +0200
  [PATCH 4.9 006/164] USB: core: replace %p with %pK Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 00:00 +0200
  Re: [PATCH 4.9 000/164] 4.9.30-stable review Guenter Roeck <linux@roeck-us.net> - 2017-05-24 06:00 +0200
    Re: [PATCH 4.9 000/164] 4.9.30-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 09:10 +0200
    Re: [PATCH 4.9 000/164] 4.9.30-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-24 09:20 +0200
  Re: [PATCH 4.9 000/164] 4.9.30-stable review Guenter Roeck <linux@roeck-us.net> - 2017-05-24 22:30 +0200

csiph-web