Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5556473pxj; Wed, 23 Jun 2021 04:04:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydaQoGoqjnhR/BV4iW8rPMzzcPLvOR/kyIQZ+5foqWwUEyIcvoVfAK4kqE6z0BfWYBh9a0 X-Received: by 2002:a05:6402:10c6:: with SMTP id p6mr11408158edu.332.1624446260654; Wed, 23 Jun 2021 04:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624446260; cv=none; d=google.com; s=arc-20160816; b=fyBoAKj7aH53r1TfnGufFIYc7Sb65S+66uqnPn3alO0e7nmCOM6/TwOMRl0UqUQBcD NaJxIZxu50cYNje9DnDUb13Kl45BZv6c5d4oSCU6vJTUMGbHG/bWrAMz0klHXwN4gtDN 1nQyzuvtMzEGGtoQedOTyHFkSOkkYsnhcsCfhl9+iK7iTe/13uUaLLEcPaKBz1QJAdBD zYh+JNKWqYrx0JO8Ioi4Pf3pL+1kDjT26N5f2Tut8tHcQRoh43PC9YTlArOfTM8sLZzl KeTgNtyMUH5nnPz35GRJSv6oz88ffWpsDVvriRYddoDusskx9fdvo2l18A/9+LIaLHd1 4MAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=l8WXhUdDCLyoaqLE/ASdptZOs5V4AdT2Ca24aztnZxs=; b=RCfpxJLnVzZLA5CxNaFNwGhLZv8irWeUj7eN+fJWzwJ2hbhTcbvVmstOQO6TopnMRh +nr0cQKhgbhcXL+AlU6aiEhNQrzfC3xjQ5xkakRG6UvbXFxZoAbLGHBkHlfWI1qgU2QP LKmuADzn9UhG00BTG0uHiM65O1yJZCru0LhmEiFZqBBa4a3t9hwjGotDT48RG4j9eQGX 9b5MfVaE9adIATX2uuok2QmU9g0g+/seR3G2AKtqwd8r9iD2a+E+8deFT8ptz0P6mjVZ xUF65eVyAgeYJ4jXE3d4Wza452ZkB46xFua9Emk4Z9JOz3CugnoqzZToA154L5jRtA6Z yqHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x12si8257622edr.327.2021.06.23.04.03.57; Wed, 23 Jun 2021 04:04:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbhFWLCX (ORCPT + 99 others); Wed, 23 Jun 2021 07:02:23 -0400 Received: from mail-wm1-f44.google.com ([209.85.128.44]:43742 "EHLO mail-wm1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230292AbhFWLCQ (ORCPT ); Wed, 23 Jun 2021 07:02:16 -0400 Received: by mail-wm1-f44.google.com with SMTP id p8-20020a7bcc880000b02901dbb595a9f1so1051229wma.2; Wed, 23 Jun 2021 03:59:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l8WXhUdDCLyoaqLE/ASdptZOs5V4AdT2Ca24aztnZxs=; b=GQt4gDX+BzpqgdlH3SnalvvHlwe/tZdRwTXa8Pyan6VwJHqMoGCoye65vzOynHA0Ue cBzlaukInvBQe88WqQuXqksa6woQZ6H6uugo+L2VE7NgiV9A3nwV62YTuKNIA6stjAmM fZnPAj9+RySFxZPZ3mY9uEkAlGC+j2MaHry0a3vpgwmwUimEtRi5uqhK3BNB+cf6LTAG tIUmjDVo1rFkoSa8zxOThzTQEUYSqOLpSM7cO6j0Wiay+5+E5xPrHIfqyU3hpDpjiNjC PQQ9Q3KzI4LfST7lAv4adJAxJhIjH7OKO0XuaHBwln2BAvN+dW0tR+bUBX95IsOCyHQt +Yiw== X-Gm-Message-State: AOAM531BE37U9ndYAR7iuPPj7sgi/b1NfeJuy2LQWb7R6ipHW/gbAaW+ J0g/JBFzN1FTah3Z7Oeh5+O2OEpGCCfruw== X-Received: by 2002:a7b:ca43:: with SMTP id m3mr9891587wml.74.1624445997681; Wed, 23 Jun 2021 03:59:57 -0700 (PDT) Received: from msft-t490s.. (mob-176-246-29-26.net.vodafone.it. [176.246.29.26]) by smtp.gmail.com with ESMTPSA id r2sm2659458wrv.39.2021.06.23.03.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 03:59:57 -0700 (PDT) From: Matteo Croce To: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jens Axboe Cc: linux-kernel@vger.kernel.org, Lennart Poettering , Luca Boccassi , Alexander Viro , Damien Le Moal , Tejun Heo , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , Niklas Cassel , Johannes Thumshirn , Hannes Reinecke , Matthew Wilcox , Christoph Hellwig , JeffleXu Subject: [PATCH v3 5/6] block: increment sequence number Date: Wed, 23 Jun 2021 12:58:57 +0200 Message-Id: <20210623105858.6978-6-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210623105858.6978-1-mcroce@linux.microsoft.com> References: <20210623105858.6978-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matteo Croce 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 --- 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