mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 15:42:23 +00:00
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:
parent
f5ad6b0444
commit
4d7ea19ca0
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user