Skip to content

tests: (lsfd::mkfds-inotify) use findmnt(1) instead of stat(1) to get bdev numbers#2683

Merged
karelzak merged 3 commits intoutil-linux:masterfrom
masatake:tests--lsfd--mkfds-inotify-on-btrfs
Jan 8, 2024
Merged

tests: (lsfd::mkfds-inotify) use findmnt(1) instead of stat(1) to get bdev numbers#2683
karelzak merged 3 commits intoutil-linux:masterfrom
masatake:tests--lsfd--mkfds-inotify-on-btrfs

Conversation

@masatake
Copy link
Member

@masatake masatake commented Jan 5, 2024

Close #2349

stat(2) on some filesystems including btrfs reports a block device
number (bdev number) with a offset. On the other hand, "inotify wd"
field of /proc/$pid/fdinfo/$fd for an inotify file reports bdev
numbers without offsets.

The offset caused the failure of lsfd::mkfds-inotify test case on
btrfs. Unlike stat(2), findmnt can report bdev numbers without
offsets.

… bdev numbers

Close util-linux#2349

stat(2) on some filesystems including btrfs reports a block device
number (bdev number) with a offset. On the other hand, "inotify wd"
field of /proc/$pid/fdinfo/$fd for an inotify file reports bdev
numbers without offsets.

The offset caused the failure of lsfd::mkfds-inotify test case on
btrfs.  Unlike stat(2), findmnt can report bdev numbers without
offsets.

Signed-off-by: Masatake YAMATO <[email protected]>
if ! mount $IMG $MNTPNT; then
ts_skip "failed to mount a btrfs image, $IMG to $MNTPNT"
fi
trap "umount $MNTPNT; rm -f $IMG" EXIT

Check warning

Code scanning / shellcheck

Use single quotes, otherwise this expands now rather than when signalled.

Use single quotes, otherwise this expands now rather than when signalled.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional.

INODES_RAW=$(${TS_CMD_LSFD} --raw -n -o INOTIFY.INODES.RAW -Q "${EXPR}")
echo "INOTIFY.INODES.RAW": $?
if [[ "$INODES_RAW" == "${FSTAB}"'\x0a'"${ROOT}" ]]; then
echo "INOTIFY.INODES.RAW" == FSTAB'\x0a'ROOT

Check warning

Code scanning / shellcheck

This apostrophe terminated the single quoted string!

This apostrophe terminated the single quoted string!
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional.

@karelzak karelzak merged commit f7299d8 into util-linux:master Jan 8, 2024
@masatake masatake deleted the tests--lsfd--mkfds-inotify-on-btrfs branch January 8, 2024 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lsfd: INOTIFY.INODES column for files on btrfs

2 participants