lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Jun 2021 12:58:57 +0200
From:   Matteo Croce <mcroce@...ux.microsoft.com>
To:     linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        Jens Axboe <axboe@...nel.dk>
Cc:     linux-kernel@...r.kernel.org,
        Lennart Poettering <lennart@...ttering.net>,
        Luca Boccassi <bluca@...ian.org>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Damien Le Moal <damien.lemoal@....com>,
        Tejun Heo <tj@...nel.org>,
        Javier González <javier@...igon.com>,
        Niklas Cassel <niklas.cassel@....com>,
        Johannes Thumshirn <johannes.thumshirn@....com>,
        Hannes Reinecke <hare@...e.de>,
        Matthew Wilcox <willy@...radead.org>,
        Christoph Hellwig <hch@...radead.org>,
        JeffleXu <jefflexu@...ux.alibaba.com>
Subject: [PATCH v3 5/6] block: increment sequence number

From: Matteo Croce <mcroce@...rosoft.com>

Increment the disk sequence number when the media has changed,
i.e. on DISK_EVENT_MEDIA_CHANGE event.

    $ cat /sys/class/block/sr0/diskseq
    12
    $ eject
    $ cat /sys/class/block/sr0/diskseq
    22

Signed-off-by: Matteo Croce <mcroce@...rosoft.com>
---
 block/genhd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/genhd.c b/block/genhd.c
index 768d8d5d1eca..9d58e0ea18ae 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1657,6 +1657,9 @@ static void disk_check_events(struct disk_events *ev,
 
 	spin_unlock_irq(&ev->lock);
 
+	if (events & DISK_EVENT_MEDIA_CHANGE)
+		inc_diskseq(disk);
+
 	/*
 	 * Tell userland about new events.  Only the events listed in
 	 * @disk->events are reported, and only if DISK_EVENT_FLAG_UEVENT
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ