ubuntu - 调用 freeze_bdev() 会导致内核错误

标签 ubuntu linux-kernel

需要帮助来解决下一种情况:在内核模块中的“退出”过程中正在执行一段代码:

...
printk(KERN_NOTICE __MODULE__ ": Freeze I/O on '%s' (@%p)\n", dudrv_bckends, backend_bdev);

if ( IS_ERR(sb = freeze_bdev(backend_bdev)) )
        {
        status = PTR_ERR(sb);
        printk(KERN_ERR __MODULE__ ": freeze_bdev(%s) -> %d", dudrv_bckends, status);
        sb = NULL;
        }
...

dmesg 向我们显示如下跟踪:
[ 4366.087002] DUDRIVER: Freeze I/O on '/dev/sda' (@ffff880035500000)
[ 4366.088246] BUG: unable to handle kernel NULL pointer dereference at 0000000000000070
[ 4366.089399] IP: [<ffffffff810cd4e3>] up_read+0x13/0x30
[ 4366.092139] PGD 0 
[ 4366.094160] Oops: 0002 [#1] SMP 
[ 4366.101024] Modules linked in: vboxsf(OE) crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 vboxvideo(OE) lrw gf128mul glue_helper ttm drm_kms_helper ablk_helper drm input_leds joydev cryptd i2c_piix4 8250_fintek fb_sys_fops syscopyarea sysfillrect sysimgblt serio_raw mac_hid vboxguest(OE) autofs4 dudriver(OE-) vmw_pvscsi vmxnet3 hid_generic usbhid hid video psmouse ahci e1000 libahci pata_acpi
[ 4366.124022] CPU: 2 PID: 1267 Comm: rmmod Tainted: G           OE   4.4.0-127-generic #153-Ubuntu
[ 4366.135713] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 4366.143461] task: ffff8800d5c5e200 ti: ffff8800a6850000 task.ti: ffff8800a6850000
[ 4366.152714] RIP: 0010:[<ffffffff810cd4e3>]  [<ffffffff810cd4e3>] up_read+0x13/0x30
[ 4366.153813] RSP: 0018:ffff8800a6853e80  EFLAGS: 00010246
[ 4366.154706] RAX: 0000000000000070 RBX: 0000000000000000 RCX: 0000000000000006
[ 4366.155732] RDX: ffffffffffffffff RSI: 0000000000000246 RDI: 0000000000000070
[ 4366.156753] RBP: ffff8800a6853e80 R08: 0000000000000000 R09: 000000000000063b
[ 4366.157778] R10: ffff88011a587490 R11: 000000000000063b R12: ffff880035500000
[ 4366.158790] R13: ffff8800355000d0 R14: 0000000000000000 R15: 0000559fc92d51f0
[ 4366.159833] FS:  00007f58f8fe9700(0000) GS:ffff88011fd00000(0000) knlGS:0000000000000000
[ 4366.160972] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 4366.161877] CR2: 0000000000000070 CR3: 00000000a7286000 CR4: 0000000000060670
[ 4366.162946] Stack:
[ 4366.163522]  ffff8800a6853e98 ffffffff81216b66 0000000000000000 ffff8800a6853ec8
[ 4366.164700]  ffffffff8124fbed ffffffffc00d2500 00007ffe9f86b110 00007ffe9f86c87d
[ 4366.165895]  0000000000000000 ffff8800a6853ee8 ffffffffc00ce95b ffffffff8110914f
[ 4366.167065] Call Trace:
[ 4366.167724]  [<ffffffff81216b66>] drop_super+0x16/0x30
[ 4366.168626]  [<ffffffff8124fbed>] freeze_bdev+0x4d/0xf0
[ 4366.169545]  [<ffffffffc00ce95b>] dua_exit+0x81/0x726 [dudriver]
[ 4366.170588]  [<ffffffff8110914f>] ? find_module+0x1f/0x30
[ 4366.171562]  [<ffffffff8110bae8>] SyS_delete_module+0x1b8/0x210
[ 4366.172571]  [<ffffffff81850c88>] entry_SYSCALL_64_fastpath+0x1c/0xbb
[ 4366.173626] Code: 25 00 fc 00 00 48 89 57 20 5d c3 0f 1f 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 c7 c2 ff ff ff ff 48 89 f8 48 89 e5 <f0> 48 0f c1 10 79 05 e8 01 15 34 00 5d c3 0f 1f 44 00 00 66 2e 
[ 4366.177788] RIP  [<ffffffff810cd4e3>] up_read+0x13/0x30
[ 4366.178756]  RSP <ffff8800a6853e80>
[ 4366.179535] CR2: 0000000000000070
[ 4366.180345] ---[ end trace 85d82da9277a6cc4 ]---

这是在 ubuntu 16/x64, 4.4.0-127-generic 下。

那么在调用 freeze_bdev() 之前,我有什么需要检查的吗?

最佳答案

例程 freeze_bdev() 不能适用于像/dev/sda 这样的卷,仅适用于像/dev/sda1 这样的分区。

关于ubuntu - 调用 freeze_bdev() 会导致内核错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51323745/

相关文章:

linux-kernel - 系统调用期间将数据复制到内核空间

linux - Linux 内核中磁盘文件的 I/O 缓冲区缓存

Ubuntu 14.04 LTS 中的 Android Studio 2.2 出现错误 : "Gradle sync failed: Cause: error=13, Permission denied"

bash - ZSH 在 linux bash 中的 "compadd' 等价物是什么?

linux - 命令 : tail file. txt '

phpMyAdmin 错误调用未定义的函数

c++ - Linux,C++,使用 poll/select 等待事件(不阻塞执行线程)

linux - Linux 内核中的 Buddy 系统分配器

c - PCIE 区域未对齐,且不一致

node.js - 在 Ubuntu 服务器上运行 selenium-standalone npm 包