Skip to contentSkip to conversation

dm writecache: correct uncommitted_block when discarding uncommitted entry

PATCH In review Huaisheng Ye 3 participants 3 messages Jun 12, 2020 – Jun 17, 2020 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm writecache: correct uncommitted_block when discarding uncommitted entry

From: Huaisheng Ye <[email protected]>

When uncommitted entry has been discarded, correct wc->uncommitted_block for getting the exact number.

---
 drivers/md/dm-writecache.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/md/dm-writecache.c +2 -0
index 4367cc7..64b4527 100644
@@ -855,6 +855,8 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
 				}
 				discarded_something = true;
 			}
+			if (!writecache_entry_is_committed(wc, e))
+				wc->uncommitted_blocks--;
 			writecache_free_entry(wc, e);
 		}
 
Signature · 1 line
1.8.3.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Huaisheng Ye

From: Huaisheng Ye <[email protected]>

When uncommitted entry has been discarded, correct wc->uncommitted_block for getting the exact number.

Also, add:
Cc: [email protected]

Quoted 20 lines
---
 drivers/md/dm-writecache.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/md/dm-writecache.c +2 -0
index 4367cc7..64b4527 100644
@@ -855,6 +855,8 @@ static void writecache_discard(struct dm_writecache *wc, sector_t start, sector_
 				}
 				discarded_something = true;
 			}
+			if (!writecache_entry_is_committed(wc, e))
+				wc->uncommitted_blocks--;
 			writecache_free_entry(wc, e);
 		}
 
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 9 lines · Mikulas Patocka
Quoted 5 lines · Huaisheng Ye

From: Huaisheng Ye <[email protected]>

When uncommitted entry has been discarded, correct wc->uncommitted_block for getting the exact number.

Quoted 6 lines
Quoted 1 line

Also, add:
Cc: [email protected]

I picked this up for 5.8 but I inverted the patch order because this stable@ fix was dependent on the prior patch to skip waiting if in pmem mode (due to locality of changes within same function).

See:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-5.8&id=39495b12ef1cf602e6abd350dce2ef4199906531

Mike