Message ID | 41c08d979d1d994803317fbfd98fe91c1e9f6b9e.1690465916.git.anand.jain@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Btrfs: improve message log due to race with systemd and mount | expand |
On 27/07/2023 21:53, Anand Jain wrote: > There is a race between systemd and mount, as both of them try to register > the device in the kernel. When systemd loses the race, it prints the > following message: > > BTRFS error: device /dev/sdb7 belongs to fsid 1b3bacbf-14db-49c9-a3ef-547998aacc4e, and the fs is already mounted. > > The 'btrfs dev scan' registers one device at a time, so there is no way > for the mount thread to wait in the kernel for all the devices to have > registered as it won't know if all the devices are discovered. > > For now, improve the error log by printing the command name and process > ID along with the error message. > > Signee-off-by: Anand Jain <anand.jain@oracle.com> ^d Strange. It wasn't manually created; git -s did. Can this be fixed while merging? Thanks. > --- > fs/btrfs/volumes.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c > index 1ebf8c2222ab..82ac9d3d0981 100644 > --- a/fs/btrfs/volumes.c > +++ b/fs/btrfs/volumes.c > @@ -851,8 +851,9 @@ static noinline struct btrfs_device *device_list_add(const char *path, > > if (fs_devices->opened) { > btrfs_err(NULL, > - "device %s belongs to fsid %pU, and the fs is already mounted", > - path, fs_devices->fsid); > +"device %s belongs to fsid %pU, and the fs is already mounted. Scanned by %s (%d)", > + path, fs_devices->fsid, current->comm, > + task_pid_nr(current)); > mutex_unlock(&fs_devices->device_list_mutex); > return ERR_PTR(-EBUSY); > }
On Thu, Jul 27, 2023 at 09:53:03PM +0800, Anand Jain wrote: > There is a race between systemd and mount, as both of them try to register > the device in the kernel. When systemd loses the race, it prints the > following message: > > BTRFS error: device /dev/sdb7 belongs to fsid 1b3bacbf-14db-49c9-a3ef-547998aacc4e, and the fs is already mounted. > > The 'btrfs dev scan' registers one device at a time, so there is no way > for the mount thread to wait in the kernel for all the devices to have > registered as it won't know if all the devices are discovered. > > For now, improve the error log by printing the command name and process > ID along with the error message. > > Signee-off-by: Anand Jain <anand.jain@oracle.com> With the fixup, added to misc-next, thanks.
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 1ebf8c2222ab..82ac9d3d0981 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -851,8 +851,9 @@ static noinline struct btrfs_device *device_list_add(const char *path, if (fs_devices->opened) { btrfs_err(NULL, - "device %s belongs to fsid %pU, and the fs is already mounted", - path, fs_devices->fsid); +"device %s belongs to fsid %pU, and the fs is already mounted. Scanned by %s (%d)", + path, fs_devices->fsid, current->comm, + task_pid_nr(current)); mutex_unlock(&fs_devices->device_list_mutex); return ERR_PTR(-EBUSY); }