Condition was apparently reversed so GRUB assumed all devices were
files. This later made it skip BLKFLSBUF ioctl on Linux which caused
various page cache coherency issues. Observed were
- failure to validate blocklist install (read content did not match
just written)
- failure to detect Linux MD on disk after online hot addition
(GRUB got stale superblock)
Closes: 46691
{
struct stat st;
# if GRUB_DISK_DEVS_ARE_CHAR
- if (fstat (fd, &st) < 0 || ! S_ISCHR (st.st_mode))
+ if (fstat (fd, &st) >= 0 && S_ISCHR (st.st_mode))
# else
- if (fstat (fd, &st) < 0 || ! S_ISBLK (st.st_mode))
+ if (fstat (fd, &st) >= 0 && S_ISBLK (st.st_mode))
# endif
data->is_disk = 1;
}