Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs/proc/vmcore: replace vmcoredd_mutex by vmcore_mutex

Now that we have a mutex that synchronizes against opening of the vmcore,
let's use that one to replace vmcoredd_mutex: there is no need to have
two separate ones.

This is a preparation for properly preventing vmcore modifications
after the vmcore was opened.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20241204125444.1734652-3-david@redhat.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

David Hildenbrand and committed by
Michael S. Tsirkin
2083dfe4 cdbc6971

+8 -9
+8 -9
fs/proc/vmcore.c
··· 53 53 #ifdef CONFIG_PROC_VMCORE_DEVICE_DUMP 54 54 /* Device Dump list and mutex to synchronize access to list */ 55 55 static LIST_HEAD(vmcoredd_list); 56 - static DEFINE_MUTEX(vmcoredd_mutex); 57 56 58 57 static bool vmcoredd_disabled; 59 58 core_param(novmcoredd, vmcoredd_disabled, bool, 0); ··· 247 248 size_t tsz; 248 249 char *buf; 249 250 250 - mutex_lock(&vmcoredd_mutex); 251 + mutex_lock(&vmcore_mutex); 251 252 list_for_each_entry(dump, &vmcoredd_list, list) { 252 253 if (start < offset + dump->size) { 253 254 tsz = min(offset + (u64)dump->size - start, (u64)size); ··· 268 269 } 269 270 270 271 out_unlock: 271 - mutex_unlock(&vmcoredd_mutex); 272 + mutex_unlock(&vmcore_mutex); 272 273 return ret; 273 274 } 274 275 ··· 282 283 size_t tsz; 283 284 char *buf; 284 285 285 - mutex_lock(&vmcoredd_mutex); 286 + mutex_lock(&vmcore_mutex); 286 287 list_for_each_entry(dump, &vmcoredd_list, list) { 287 288 if (start < offset + dump->size) { 288 289 tsz = min(offset + (u64)dump->size - start, (u64)size); ··· 305 306 } 306 307 307 308 out_unlock: 308 - mutex_unlock(&vmcoredd_mutex); 309 + mutex_unlock(&vmcore_mutex); 309 310 return ret; 310 311 } 311 312 #endif /* CONFIG_MMU */ ··· 1517 1518 dump->size = data_size; 1518 1519 1519 1520 /* Add the dump to driver sysfs list */ 1520 - mutex_lock(&vmcoredd_mutex); 1521 + mutex_lock(&vmcore_mutex); 1521 1522 list_add_tail(&dump->list, &vmcoredd_list); 1522 - mutex_unlock(&vmcoredd_mutex); 1523 + mutex_unlock(&vmcore_mutex); 1523 1524 1524 1525 vmcoredd_update_size(data_size); 1525 1526 return 0; ··· 1537 1538 static void vmcore_free_device_dumps(void) 1538 1539 { 1539 1540 #ifdef CONFIG_PROC_VMCORE_DEVICE_DUMP 1540 - mutex_lock(&vmcoredd_mutex); 1541 + mutex_lock(&vmcore_mutex); 1541 1542 while (!list_empty(&vmcoredd_list)) { 1542 1543 struct vmcoredd_node *dump; 1543 1544 ··· 1547 1548 vfree(dump->buf); 1548 1549 vfree(dump); 1549 1550 } 1550 - mutex_unlock(&vmcoredd_mutex); 1551 + mutex_unlock(&vmcore_mutex); 1551 1552 #endif /* CONFIG_PROC_VMCORE_DEVICE_DUMP */ 1552 1553 } 1553 1554