Bug 149215

Summary: [panic] [geom_part] gpart(8): Delete linux's slice via Gpart - get kernel panic
Product: Base System Reporter: vladislav V. Prodan <universite>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me    
Priority: Normal    
Version: 9.0-CURRENT   
Hardware: Any   
OS: Any   

Description vladislav V. Prodan 2010-08-02 23:50:05 UTC
Disc ad4 inserted with a Linux server, most likely contained ad4s3 ReiserFS ...
Disc ad8 - native to the system on ZFS

# gpart show
=>        63  2930277105  ad4  MBR  (1.4T)
          63      385497    1  !253  [active]  (188M)
      385560  2904503805    3  !253  (1.4T)
  2904889365    25382700    2  !130  (12G)
  2930272065        5103       - free -  (2.5M)

=>        34  2930277101  ad8  GPT  (1.4T)
          34         128    1  freebsd-boot  (64K)
         162    33554432    2  freebsd-swap  (16G)
    33554594  2896722541    3  freebsd-zfs  (1.3T)
# gpart create -s gpt ad4
gpart: geom 'ad4': File exists
# df -h
Filesystem           Size    Used   Avail Capacity  Mounted on
tank                 1.3T    810M    1.3T     0%    /
devfs                1.0K    1.0K      0B   100%    /dev
tank/tmp             1.3T    243K    1.3T     0%    /tmp
tank/usr             1.3T    2.0G    1.3T     0%    /usr
tank/usr/home        1.3T    5.4M    1.3T     0%    /usr/home
tank/usr/ports       1.3T    2.2G    1.3T     0%    /usr/ports
tank/usr/src         1.3T    334M    1.3T     0%    /usr/src
tank/var             1.3T    245K    1.3T     0%    /var
tank/var/crash       1.3T     20K    1.3T     0%    /var/crash
tank/var/db          1.3T     56M    1.3T     0%    /var/db
tank/mysql           1.3T    1.7M    1.3T     0%    /var/db/mysql
tank/mysql/ibdata    1.3T     10M    1.3T     0%    /var/db/mysql/ibdata
tank/mysql/iblogs    1.3T     10M    1.3T     0%    /var/db/mysql/iblogs
tank/var/log         1.3T    803K    1.3T     0%    /var/log
tank/var/mail        1.3T     25K    1.3T     0%    /var/mail
tank/var/run         1.3T     65K    1.3T     0%    /var/run
tank/var/tmp         1.3T    1.4M    1.3T     0%    /var/tmp
devfs                1.0K    1.0K      0B   100%    /var/named/dev
# gpart destroy ad4
gpart: Device busy
# gpart delete -i 1 ad4
ad4s1 deleted
# gpart delete -i 2 ad4
ad4s2 deleted
# gpart delete -i 3 ad4

and panic...

I am sending a screenshot, because crash dump is not created on zfs ...

after reboot:
# gpart show ad4
=>        63  2930277105  ad4  MBR  (1.4T)
          63  2930277105       - free -  (1.4T)

My kernel config:
cpu             HAMMER
ident           second-nextonmarket
maxusers        512
options         ROUTETABLES=5           # max 16. 1 is back compatible.
options         RADIX_MPATH
options         PPS_SYNC

makeoptions     DEBUG=-g                # Build kernel with gdb(1) debug symbols

options         SCHED_ULE               # ULE scheduler
options         PREEMPTION              # Enable kernel thread preemption
options         INET                    # InterNETworking
options         INET6                   # IPv6 communications protocols
options         SCTP                    # Stream Control Transmission Protocol
options         SCTP_LOCK_LOGGING
options         SCTP_MBUF_LOGGING
options         SCTP_MBCNT_LOGGING
options         SCTP_PACKET_LOGGING
options         SCTP_LTRACE_CHUNKS
options         SCTP_LTRACE_ERRORS

options         FFS                     # Berkeley Fast Filesystem
options         SOFTUPDATES             # Enable FFS soft updates support
options         UFS_ACL                 # Support for access control lists
options         UFS_DIRHASH             # Improve performance on big directories
options         UFS_GJOURNAL            # Enable gjournal-based UFS journaling
options         MD_ROOT                 # MD is a potential root device
options         NFSCLIENT               # Network Filesystem Client
options         NFSSERVER               # Network Filesystem Server
options         NFSLOCKD                # Network Lock Manager
options         NFS_ROOT                # NFS usable as /, requires NFSCLIENT
options         MSDOSFS                 # MSDOS Filesystem
options         CD9660                  # ISO 9660 Filesystem
options         PROCFS                  # Process filesystem (requires PSEUDOFS)
options         PSEUDOFS                # Pseudo-filesystem framework
options         NTFS
options         NULLFS                  #NULL filesystem
options         QUOTA                   #enable disk quotas
options         SUIDDIR

options         EXT2FS
options         REISERFS

options         NFS_MINATTRTIMO=3       # VREG attrib cache timeout in sec
options         NFS_MAXATTRTIMO=60
options         NFS_MINDIRATTRTIMO=30   # VDIR attrib cache timeout in sec
options         NFS_MAXDIRATTRTIMO=60
options         NFS_GATHERDELAY=10      # Default write gather delay (msec)
options         NFS_WDELAYHASHSIZ=16    # and with this

options         GEOM_BDE                # Disk encryption.
options         GEOM_BSD                # BSD disklabels
options         GEOM_CACHE              # Disk cache.
options         GEOM_CONCAT             # Disk concatenation.
options         GEOM_FOX                # Redundant path mitigation
options         GEOM_GATE               # Userland services.
options         GEOM_LABEL              # Providers labelization.
options         GEOM_LINUX_LVM          # Linux LVM2 volumes
options         GEOM_MIRROR             # Disk mirroring.
options         GEOM_MULTIPATH          # Disk multipath
options         GEOM_PART_EBR           # Extended Boot Records
options         GEOM_PART_EBR_COMPAT    # Backward compatible partition names
options         GEOM_PART_GPT           # GPT partitioning
options         GEOM_PART_MBR           # MBR partitioning
options         GEOM_STRIPE             # Disk striping.
options         GEOM_VIRSTOR            # Virtual storage.
options         GEOM_VOL                # Volume names from UFS superblock

options         COMPAT_FREEBSD32        # Compatible with i386 binaries
options         COMPAT_FREEBSD4         # Compatible with FreeBSD4
options         COMPAT_FREEBSD5         # Compatible with FreeBSD5
options         COMPAT_FREEBSD6         # Compatible with FreeBSD6
options         COMPAT_FREEBSD7         # Compatible with FreeBSD7
options         SCSI_DELAY=5000         # Delay (in ms) before probing SCSI
options         KTRACE                  # ktrace(1) support
options         STACK                   # stack(9) support
options         P1003_1B_SEMAPHORES     # POSIX-style semaphores
options         _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options         PRINTF_BUFR_SIZE=128    # Prevent printf output being interspersed.
options         KBD_INSTALL_CDEV        # install a CDEV entry in /dev
options         HWPMC_HOOKS             # Necessary kernel hooks for hwpmc(4)
options         AUDIT                   # Security event auditing
options         MAC                     # TrustedBSD MAC Framework
options         FLOWTABLE               # per-cpu routing cache
options         INCLUDE_CONFIG_FILE     # Include this file in kernel

options         KDB                     # Enable kernel debugger support.

options         SMP                     # Symmetric MultiProcessor Kernel

device          cpufreq

options         SW_WATCHDOG
options         PANIC_REBOOT_WAIT_TIME=20
options         DEADLKRES
options         LIBICONV
options         LIBMCHAIN
options         MSGBUF_SIZE=40960
options         SYSVSEM         # include support for semaphores
options         SEMMAP=31       # amount of entries in semaphore map
options         SEMMNI=11       # number of semaphore identifiers in the system
options         SEMMNS=61       # number of semaphores in the system
options         SEMMNU=31       # number of undo structures in the system
options         SEMMSL=61       # max number of semaphores per id
options         SEMOPM=101      # max number of operations per semop call
options         SEMUME=11       # max number of undo entries per process

options         SYSVMSG         # include support for message queues
options         MSGMNB=2049     # max characters per message queue
options         MSGMNI=41       # max number of message queue identifiers
options         MSGSEG=2049     # max number of message segments in the system
options         MSGSSZ=16       # size of a message segment MUST be power of 2
options         MSGTQL=41       # max amount of messages in the system

options         SYSVSHM         # include support for shared memory
options         SHMMAXPGS=2048  # max amount of shared memory pages (4k on i386)
options         SHMALL=2048     # max number of shared memory pages system wide
options         SHMMAX="(SHMMAXPGS*PAGE_SIZE+1)"         # max shared memory seg
options         SHMMIN=2        # min shared memory segment size (bytes)
options         SHMMNI=33       # max number of shared memory identifiers
options         SHMSEG=9        # max shared memory segments per process

options         MCLSHIFT=12     # mbuf cluster shift in bits, 12 == 4KB
options         MSIZE=512       # mbuf size in bytes

options         MBUF_PROFILING
options         NBUF=1024        # Number of buffer headers

options         LIBALIAS
options         NETGRAPH
options         NETGRAPH_ASYNC
options         NETGRAPH_BPF
options         NETGRAPH_BRIDGE
options         NETGRAPH_CISCO
options         NETGRAPH_DEVICE
options         NETGRAPH_ECHO
options         NETGRAPH_EIFACE
options         NETGRAPH_ETHER
options         NETGRAPH_HOLE
options         NETGRAPH_IFACE
options         NETGRAPH_IP_INPUT
options         NETGRAPH_IPFW
options         NETGRAPH_KSOCKET
options         NETGRAPH_L2TP
options         NETGRAPH_LMI
options         NETGRAPH_NAT
options         NETGRAPH_ONE2MANY
options         NETGRAPH_PPP
options         NETGRAPH_PPPOE
options         NETGRAPH_PPTPGRE
options         NETGRAPH_RFC1490
options         NETGRAPH_SOCKET
options         NETGRAPH_SPLIT
options         NETGRAPH_SPPP
options         NETGRAPH_TCPMSS
options         NETGRAPH_TEE
options         NETGRAPH_TTY
options         NETGRAPH_UI
options         NETGRAPH_VJC
options         NETGRAPH_VLAN

options         IPFIREWALL
options         IPFIREWALL_VERBOSE
options         IPFIREWALL_FORWARD
options         IPFIREWALL_VERBOSE_LIMIT=100
options         IPFIREWALL_NAT
options         IPDIVERT
options         IPSTEALTH

options         ALQ
options         KTR_ALQ
options         ALTQ
options         ALTQ_CBQ        # Class Bases Queueing
options         ALTQ_RED        # Random Early Detection
options         ALTQ_RIO        # RED In/Out
options         ALTQ_HFSC       # Hierarchical Packet Scheduler
options         ALTQ_CDNR       # Traffic conditioner
options         ALTQ_PRIQ       # Priority Queueing
options         ALTQ_NOPCC      # Required if the TSC is unusable

options         DUMMYNET

options         ACCEPT_FILTER_DATA
options         ACCEPT_FILTER_DNS
options         ACCEPT_FILTER_HTTP

device          acpi
device          pci

device          ata
device          atadisk         # ATA disk drives
device          ataraid         # ATA RAID drives
device          atapicd         # ATAPI CDROM drives
device          atapist         # ATAPI tape drives
options         ATA_STATIC_ID   # Static device numbering
device          scbus           # SCSI bus (required for SCSI)
device          ch              # SCSI media changers
device          da              # Direct Access (disks)
device          sa              # Sequential Access (tape etc)
device          cd              # CD
device          pass            # Passthrough device (direct SCSI access)
device          ses             # SCSI Environmental Services (and SAF-TE)

device          twe             # 3ware ATA RAID

device          atkbdc          # AT keyboard controller
device          atkbd           # AT keyboard
device          psm             # PS/2 mouse
device          kbdmux          # keyboard multiplexer
device          vga             # VGA video card driver
device          splash          # Splash screen and screen saver support
device          sc
device          uart            # Generic UART driver

device          ppc
device          ppbus           # Parallel port bus (required)
device          lpt             # Printer
device          plip            # TCP/IP over parallel
device          ppi             # Parallel port interface device

device          em              # Intel PRO/1000 Gigabit Ethernet Family
device          igb             # Intel PRO/1000 PCIE Server Gigabit Family

device          miibus          # MII bus support
device          bge             # Broadcom BCM570xx Gigabit Ethernet
device          fxp             # Intel EtherExpress PRO/100B (82557, 82558)
device          msk             # Marvell/SysKonnect Yukon II Gigabit Ethernet
device          re              # RealTek 8139C+/8169/8169S/8110S
device          rl              # RealTek 8129/8139

device          loop            # Network loopback
device          random          # Entropy device
device          ether           # Ethernet support
device          tun             # Packet tunnel.
device          pty             # BSD-style compatibility pseudo ttys
device          md              # Memory "disks"
device          firmware        # firmware assist module
device          disc
device          mem
device          ksyms

device          gif                     #IPv6 and IPv4 tunneling
options         XBONEHACK
device          faith                   #for IPv6 and IPv4 translation
device          stf                     #6to4 IPv6 over IPv4 encapsulation
device          vlan                    #VLAN support (needs miibus)
device          tap                     #Virtual Ethernet driver
device          gre                     #IP over IP tunneling
device          if_bridge               #Bridge interface
device          pf                      #PF OpenBSD packet-filter firewall
device          pflog                   #logging support interface for PF
device          pfsync                  #synchronization interface for PF
device          carp                    #Common Address Redundancy Protocol
device          lagg                    #Link aggregation interface
device          enc                     # IPsec interface.

device          bpf             # Berkeley packet filter

options         USB_DEBUG       # enable debug msgs
device          uhci            # UHCI PCI->USB interface
device          ohci            # OHCI PCI->USB interface
device          ehci            # EHCI PCI->USB interface (USB 2.0)
device          usb             # USB Bus (required)
device          uhid            # "Human Interface Devices"
device          ukbd            # Keyboard
device          umass           # Disks/Mass storage - Requires scbus and da
device          ums             # Mouse
device          uark            # Technologies ARK3116 based serial adapters
device          ubsa            # Belkin F5U103 and compatible serial adapters
device          uftdi           # For FTDI usb serial adapters
device          uipaq           # Some WinCE based devices
device          uplcom          # Prolific PL-2303 serial adapters
device          uslcom          # SI Labs CP2101/CP2102 serial adapters
device          uvscom          # USB serial support for DDI pocket's PHS
device          aue             # ADMtek USB Ethernet
device          axe             # ASIX Electronics USB Ethernet
device          cdce            # Generic USB over Ethernet
device          cue             # CATC USB Ethernet
device          kue             # Kawasaki LSI USB Ethernet
device          rue             # RealTek RTL8150 USB Ethernet
device          udav            # Davicom DM9601E USB

How-To-Repeat: Insert the hard disk with Linux-server that has a ReiserFS partition.
And try to use gpart to remove this partition
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2010-08-03 01:21:19 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Not sure exactly how to classify this, but perhaps someone on fs@ can 
evalute it.
Comment 2 Andrey V. Elsukov freebsd_committer 2010-08-03 08:13:09 UTC
Responsible Changed
From-To: freebsd-fs->freebsd-geom

Seems geom-related.
Comment 3 Andrey V. Elsukov 2010-08-17 16:12:46 UTC

As I see from `gpart show ad4` output and from screenshot ad4 disk
was part of software raid (partition type '253') and also it was
part of Linux LVM. Also, last messages before panic are:
GEOM_LINUX_LVM: Disk ad4s3 removed from pv0.

I think panic occurs in this code from g_linux_lvm.c:

g_llvm_remove_disk(struct g_llvm_vg *vg, struct g_consumer *cp)

if (found) {
	G_LLVM_DEBUG(0, "Device %s removed.",
^^^^^^^^^^^^^^^^^^^^^^^^ - NULL-pointer dereference here
	g_orphan_provider(lv->lv_gprov, ENXIO);
	lv->lv_gprov = NULL;

WBR, Andrey V. Elsukov
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:16 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped