免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1229 | 回复: 0
打印 上一主题 下一主题

BKL 究竟用在什么时候 vfs里面的readdir 需要吗 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-11-10 14:06 |只看该作者 |倒序浏览
有两个问题求教
一 BKL(Big kernel lock )
看 2.6.9 内核
"include/linux/fs.h" 里面对file_operations前有段说明
/*
* NOTE:
* read, write, poll, fsync, readv, writev can be called
*   without the big kernel lock held in all filesystems.
*/
意思是除他提到的几个外, 其他的有可能要调用 BKL
而在 "Documentation/filesystems/Locking"里对file_operations的说明
locking rules:
        All except ->poll() may block.
                        BKL
llseek:                 no      (see below)
read:                   no
aio_read:               no
write:                  no
aio_write:              no
readdir:                no
poll:                   no
ioctl:                  yes     (see below)
mmap:                   no
open:                   maybe   (see below)
flush:                  no
release:                no
fsync:                  no      (see below)
aio_fsync:              no
fasync:                 yes     (see below)
lock:                   yes
readv:                  no
writev:                 no
sendfile:               no
sendpage:               no
get_unmapped_area:      no
check_flags:            no
dir_notify:             no

好像是绝大部分都不需要 BKL
而ioctl等几个是要的,就看了 sys_ioctl, 里面的确有 lock_kernel ()  unlock_kernel()
想问这个BKL究竟用在什么场合。  用来保护什么资源。

二  hook vfs里面的readdir。 之后rmmod, 在磁盘读写比较密集时,会oops。 而一般空闲时正常
我是用 find / -name not _exist_file 进行测试
rmmod之后
oops情况见附件

可能是正在有readdir的操作, 而刚好这时把指针替换了。 所以报错。 需要加什么同步保护机制可以防止这种情况呢? 可是我看sys_read好像也没检查什么同步机制啊

oops.JPG (73.91 KB, 下载次数: 40)

oops.JPG
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP