btrfs-progs: property set: skip opening char devices completely

Previous fix for char devices and properties opens the path in non
blocking mode but this still triggers the watchdog, as reported. Add a
workaround to properties to completely skip opening the path and just
stat() it.

Issue: #699
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-11-14 15:48:00 +01:00
parent f5ad6b0444
commit 4d7ea19ca0

View File

@ -286,6 +286,19 @@ static int check_btrfs_object(const char *object)
{
int ret;
u8 fsid[BTRFS_FSID_SIZE];
struct stat st;
ret = stat(object, &st);
if (ret < 0)
return 0;
/*
* Don't try to read fsid on char devices, this will fail anyway. In
* some cases opening the device can trigger some system events (like a
* watchdog) so do only stat.
*/
if ((st.st_mode & S_IFMT) == S_IFCHR || (st.st_mode & S_IFMT) == S_IFIFO)
return 0;
ret = get_fsid(object, fsid, 0);
if (ret < 0)