Bug 257240 - glabel(8): glabel status can be difficult to terminate/kill when presented with a failing drive
Summary: glabel(8): glabel status can be difficult to terminate/kill when presented wi...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-18 05:41 UTC by Graham Perrin
Modified: 2021-07-18 06:23 UTC (History)
0 users

See Also:


Attachments
Screenshot: lsblk (not responding to Control-C) running glabel status, `tail -f -n 0 /var/log/messages` in the background (533.96 KB, image/png)
2021-07-18 05:41 UTC, Graham Perrin
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Perrin 2021-07-18 05:41:42 UTC
Created attachment 226523 [details]
Screenshot: lsblk (not responding to Control-C) running glabel status, `tail -f -n 0 /var/log/messages` in the background

I used sysutils/lsblk, sysutils/gdisk and newfs(8) to prepare a USB flash drive to demonstrate use of sysutils/stressdisk

Following a failed test with StressDisk, run as root (comparable to <https://github.com/ncw/stressdisk/issues/14>) I rebooted the computer then ran lsblk (as root) to determine the /dev/da⋯ number of the affected device. 

lsblk ran endlessly and did not respond to Control-C, so I used sysutils/htop to terminate two lsblk processes (two of three in a tree). 

----

root@mowa219-gjp4-8570p:~ # lsblk 
^C    
load: 0.28  cmd: glabel 3767 [g_waitfor_event] 173.22r 0.00u 0.00s 0% 2548k
mi_switch+0xc1 sleepq_timedwait+0x2f _sleep+0x1ab g_waitfor_event+0xc1 sysctl_kern_geom_confany+0xc1 sysctl_root_handler_locked+0x91 sysctl_root+0x24c userland_sysctl+0x173 sys___sysctl+0x5c amd64_syscall+0x10c fast_syscall_common+0xf8 
load: 0.67  cmd: glabel 3767 [g_waitfor_event] 423.27r 0.00u 0.00s 0% 2548k
mi_switch+0xc1 sleepq_timedwait+0x2f _sleep+0x1ab g_waitfor_event+0xc1 sysctl_kern_geom_confany+0xc1 sysctl_root_handler_locked+0x91 sysctl_root+0x24c userland_sysctl+0x173 sys___sysctl+0x5c amd64_syscall+0x10c fast_syscall_common+0xf8 
Terminated
root@mowa219-gjp4-8570p:~ # 


----

The third process from the tree: 

glabel status

– continues, and does not stop in response to SIGTERM (15) and SIGKILL (9) issued by htop …
Comment 1 Graham Perrin 2021-07-18 05:49:53 UTC
% pkg query '%o %v %R' gdisk htop lsblk
sysutils/gdisk 1.0.8 FreeBSD
sysutils/htop 3.0.4_1 FreeBSD
sysutils/lsblk 3.5 FreeBSD
% file /sbin/glabel
/sbin/glabel: ELF 64-bit LSB pie executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 14.0 (1400025), FreeBSD-style, stripped
% uname -KUv
FreeBSD 14.0-CURRENT #100 main-n247798-f39dd6a9784: Thu Jul  8 07:38:23 BST 2021     root@mowa219-gjp4-8570p:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG  1400025 1400025
% gpart show
=>       40  976773088  ada0  GPT  (466G)
         40     409600     1  efi  (200M)
     409640       1024     2  freebsd-boot  (512K)
     410664        984        - free -  (492K)
     411648   33554432     3  freebsd-swap  (16G)
   33966080  942807040     4  freebsd-zfs  (450G)
  976773120          8        - free -  (4.0K)

=>      34  60437425  da0  GPT  (29G)
        34      2014       - free -  (1.0M)
      2048  60435411    1  freebsd-zfs  (29G)

=>       34  976773101  da1  GPT  (466G)
         34       2014       - free -  (1.0M)
       2048  976771087    1  freebsd-zfs  (466G)

% zpool status
  pool: Transcend
 state: ONLINE
  scan: scrub repaired 0B in 03:43:58 with 0 errors on Sat Jul  3 22:44:29 2021
config:

        NAME                 STATE     READ WRITE CKSUM
        Transcend            ONLINE       0     0     0
          gpt/FreeBSD%20ZFS  ONLINE       0     0     0
        cache
          da2                ONLINE       0     0     0

errors: No known data errors

  pool: copperbowl
 state: ONLINE
  scan: scrub repaired 0B in 01:36:53 with 0 errors on Sun Jun 20 21:25:07 2021
config:

        NAME                    STATE     READ WRITE CKSUM
        copperbowl              ONLINE       0     0     0
          ada0p4.eli            ONLINE       0     0     0
        cache
          gpt/cache-copperbowl  ONLINE       0     0     0

errors: No known data errors
%
Comment 2 Graham Perrin 2021-07-18 06:21:26 UTC
… eventually I realised that glabel had disappeared from the htop view of things ☑

I guess that it ended at 06:44 BST – maybe around thirty-five minutes after I first attempted to terminate/kill the process. 

I chose to remove the offending device. 

----

% date 
Sun 18 Jul 2021 06:55:24 BST
% tail -f -n 18 /var/log/messages
Jul 18 06:43:44 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): READ(10). CDB: 28 00 00 00 00 00 00 00 01 00 
Jul 18 06:43:44 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): CAM status: CCB request completed with an error
Jul 18 06:43:44 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): Error 5, Retries exhausted
Jul 18 06:43:54 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): READ(10). CDB: 28 00 00 3b b7 ff 00 00 01 00 
Jul 18 06:43:54 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): CAM status: CCB request completed with an error
Jul 18 06:43:54 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): Retrying command, 3 more tries remain
Jul 18 06:44:05 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): READ(10). CDB: 28 00 00 3b b7 ff 00 00 01 00 
Jul 18 06:44:05 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): CAM status: CCB request completed with an error
Jul 18 06:44:05 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): Retrying command, 2 more tries remain
Jul 18 06:44:15 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): READ(10). CDB: 28 00 00 3b b7 ff 00 00 01 00 
Jul 18 06:44:15 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): CAM status: CCB request completed with an error
Jul 18 06:44:15 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): Retrying command, 1 more tries remain
Jul 18 06:44:25 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): READ(10). CDB: 28 00 00 3b b7 ff 00 00 01 00 
Jul 18 06:44:25 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): CAM status: CCB request completed with an error
Jul 18 06:44:25 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): Retrying command, 0 more tries remain
Jul 18 06:44:36 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): READ(10). CDB: 28 00 00 3b b7 ff 00 00 01 00 
Jul 18 06:44:36 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): CAM status: CCB request completed with an error
Jul 18 06:44:36 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): Error 5, Retries exhausted
Jul 18 06:55:32 mowa219-gjp4-8570p kernel: ugen1.7: <Alcor Micro Mass Storage Device> at usbus1 (disconnected)
Jul 18 06:55:32 mowa219-gjp4-8570p kernel: umass3: at uhub4, port 6, addr 7 (disconnected)
Jul 18 06:55:32 mowa219-gjp4-8570p kernel: da3 at umass-sim3 bus 3 scbus8 target 0 lun 0
Jul 18 06:55:32 mowa219-gjp4-8570p kernel: da3: <Generic USB Flash Disk 7.76>  s/n 6 detached
Jul 18 06:55:32 mowa219-gjp4-8570p kernel: (da3:umass-sim3:3:0:0): Periph destroyed
Jul 18 06:55:32 mowa219-gjp4-8570p kernel: umass3: detached
^C
% 

----

Note to self, lines from root user history 
  (lsblk at 6:03, htop at 6:08, gpart show at 6:47): 

  …
   975  6:03    lsblk
   976  6:08    which glabel
   977  6:08    htop
   978  6:09    which glabel
   979  6:09    pkg provides glabel
   980  6:09    which glabel
   981  6:09    pkg provides /sbin/glabel
   982  6:16    man glabel
   983  6:17    man gdisk
   984  6:17    newfs
   985  6:17    man newfs
   986  6:17    man 8 gdisk
   987  6:18    man 8 newfs
   988  6:25    man lsblk
   989  6:25    pkg query '%o %v %R' lsblk
   990  6:26    pkg query '%o %v %R' gdisk
   991  6:31    pkg query '%o %v %R' htop
   992  6:44    pkg query '%o %v %R' gdisk htop lsblk
   993  6:45    uname -KRu
   994  6:45    uname -KrU
   995  6:45    pkg query '%o %v %R' gdisk htop lsblk
   996  6:45    uname -KuV
   997  6:45    uname -KUv
   998  6:45    pkg query '%o %v %R' gdisk htop lsblk
   999  6:45    uname -KUv
  1000  6:46    exit
  1001  6:47    gpart show
  1002  6:47    zpool status
  1003  6:51    exit
  …