URN Logo
UNIX Resources » Linux » China Linux Forum » Linux内核技术 » 第18页 » 重读2.4 --028 fs/bad_inode.c
announcement 声明: 本页内容为中国Linux论坛的内容镜像,文章的版权以及其他所有的相关权利属于中国Linux论坛和相应文章的作者,如果转载,请注明文章来源及相关版权信息。
Resources
China Linux Forum(finished)
Linux Forum(finished)
FreeBSD China(finished)
linuxforum.com
  LinuxForum General Chat
  Linux Advocacy
  LinuxForum Polls
  Introductions
  Linux Kernel Support
  Patch Management
  Development Release
  Linux Programming
  Linux Security
  Linux Software
  Linux Hardware Problems
    Linux Video Problems
    Linux Sound Problems
  Linux Networking Support
  Linux Printing Support
  Linux Human Interface Devices Support
  Linux Data Storage Support
  Linux Applications Support
  Linux Installation Support
  Linux Laptops Support
  Linux Motherboard, Chipsets, CPU, Memory
  Miscellaneous
  Debian Linux Support
  Ubuntu Linux Support
  LiveCD Discussions
  Gentoo Linux Support
  Mandrake Linux Support
  Redhat / Fedora Linux Support
  Slackware Linux Support
  SuSE Linux Support
  CentOS Linux Support
  Linux Web Servers
  Linux DNS Servers
  Linux Database Servers
  Linux Email Servers
  Linux FTP Servers
  Linux Squid Proxy Server
  Linux Samba Help
  Linux cPanel Help
  Linux Ensim Help
  Linux Plesk Help
  Linux Webmin / Usermin Help
  Qmail Toaster Help
  Linux Games
  Windows Game Emulation
  Linux Discussions
  General Linux Discussions
  Red Hat Linux Discussions
  More Red Hat Linux Discussions
  Mandrake Linux Discussions
  Slackware Linux Discussions
  SuSE Linux Discussions
  Debian Discussions
  Samba Help
  Linux Security
  Linux Networking
  Gentoo Help
  Operating System Rant Forum
  Hardware Rants
   
重读2.4 --028 fs/bad_inode.c
Author: hyl    Posted: 2007-11-13 21:06    Length: 3,002 byte(s)
[Original] [Print] [Top]

2007-3-16


当系统发现一个文件的inode有错误的时候,不是返回一个NULL指针,而是返回一个bad_inode.此i
node的所有操作函数都返回-EIO.
此模块的主要对外接口是







void make_bad_inode(struct inode * inode)
{
inode->i_mode = S_IFREG;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
inode->i_op = &bad_inode_ops;
inode->i_fop = &bad_file_ops;
}







int is_bad_inode(struct inode * inode)
{
return (inode->i_op == &bad_inode_ops);
}

这是个很好的例子,证名文件操作函数来自于对应的inode。so
simple。唯独bad_follow_link需要一些操作:


static int bad_follow_link(struct dentry *dent, struct nameidata *nd)
{
dput(nd->dentry);
nd->dentry = dget(dent);
return 0;
}

可以想象,当初为了能让bad
inode可以unmout,这里进行过艰苦的调试。可惜,到后来的版本中,不能unmout bad
inode的情况依
然存在。这个函数又被删除。看看path_walk,当inode->fllow_link
为非指针的时候,inode被认为是一个link。不必深究了,这里要做
的很简单,只要没有什么问题即可。只是要关注一下bad inode 的umount问题。

 

 

[Original] [Print] [Top]
« Previous thread
求救:内核netlink接收问题!!
Linux内核技术
18
Next thread »
重读2.4 --027 fs/attr.c dnotify.c
     

Copyright © 2018 UNIX Resources Network, All Rights Reserved.    About URN | Privacy & Legal | Help | Contact us