From: Yu Watanabe Date: Sun, 4 Sep 2022 17:05:52 +0000 (+0900) Subject: loop-util: also set LoopDevice.diskseq when created with loop_device_open() X-Git-Tag: v252-rc1~258^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ffcb33241e182a4f7b47f39ca84b49c9aa7ae314;p=thirdparty%2Fsystemd.git loop-util: also set LoopDevice.diskseq when created with loop_device_open() --- diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c index 928792281c5..90451415ff9 100644 --- a/src/shared/loop-util.c +++ b/src/shared/loop-util.c @@ -800,6 +800,7 @@ int loop_device_open( _cleanup_close_ int loop_fd = -1, lock_fd = -1; _cleanup_free_ char *p = NULL; struct loop_info64 info; + uint64_t diskseq = 0; struct stat st; LoopDevice *d; int nr; @@ -826,6 +827,10 @@ int loop_device_open( } else nr = -1; + r = fd_get_diskseq(loop_fd, &diskseq); + if (r < 0 && r != -EOPNOTSUPP) + return r; + if ((lock_op & ~LOCK_NB) != LOCK_UN) { lock_fd = open_lock_fd(loop_fd, lock_op); if (lock_fd < 0) @@ -847,6 +852,7 @@ int loop_device_open( .node = TAKE_PTR(p), .relinquished = true, /* It's not ours, don't try to destroy it when this object is freed */ .devno = st.st_dev, + .diskseq = diskseq, .uevent_seqnum_not_before = UINT64_MAX, .timestamp_not_before = USEC_INFINITY, };