cregit-Linux how code gets into the kernel

Release 4.7 fs/bad_inode.c

Directory: fs
/*
 *  linux/fs/bad_inode.c
 *
 *  Copyright (C) 1997, Stephen Tweedie
 *
 *  Provide stub functions for unreadable inodes
 *
 *  Fabian Frederick : August 2003 - All file operations assigned to EIO
 */

#include <linux/fs.h>
#include <linux/export.h>
#include <linux/stat.h>
#include <linux/time.h>
#include <linux/namei.h>
#include <linux/poll.h>


static int bad_file_open(struct inode *inode, struct file *filp) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen20100.00%1100.00%
Total20100.00%1100.00%

static const struct file_operations bad_file_ops = { .open = bad_file_open, };
static int bad_inode_create (struct inode *dir, struct dentry *dentry, umode_t mode, bool excl) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen2388.46%133.33%
al viroal viro311.54%266.67%
Total26100.00%3100.00%


static struct dentry *bad_inode_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) { return ERR_PTR(-EIO); }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen2689.66%150.00%
al viroal viro310.34%150.00%
Total29100.00%2100.00%


static int bad_inode_link (struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen25100.00%1100.00%
Total25100.00%1100.00%


static int bad_inode_unlink(struct inode *dir, struct dentry *dentry) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen20100.00%1100.00%
Total20100.00%1100.00%


static int bad_inode_symlink (struct inode *dir, struct dentry *dentry, const char *symname) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen25100.00%1100.00%
Total25100.00%1100.00%


static int bad_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen2295.65%150.00%
al viroal viro14.35%150.00%
Total23100.00%2100.00%


static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen20100.00%1100.00%
Total20100.00%1100.00%


static int bad_inode_mknod (struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen2596.15%150.00%
al viroal viro13.85%150.00%
Total26100.00%2100.00%


static int bad_inode_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen2985.29%150.00%
miklos szeredimiklos szeredi514.71%150.00%
Total34100.00%2100.00%


static int bad_inode_readlink(struct dentry *dentry, char __user *buffer, int buflen) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen23100.00%1100.00%
Total23100.00%1100.00%


static int bad_inode_permission(struct inode *inode, int mask) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen18100.00%1100.00%
Total18100.00%1100.00%


static int bad_inode_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen25100.00%1100.00%
Total25100.00%1100.00%


static int bad_inode_setattr(struct dentry *direntry, struct iattr *attrs) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen20100.00%1100.00%
Total20100.00%1100.00%


static int bad_inode_setxattr(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen2055.56%125.00%
pre-gitpre-git1130.56%250.00%
al viroal viro513.89%125.00%
Total36100.00%4100.00%


static ssize_t bad_inode_getxattr(struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen2578.12%125.00%
al viroal viro515.62%125.00%
pre-gitpre-git13.12%125.00%
arjan van de venarjan van de ven13.12%125.00%
Total32100.00%4100.00%


static ssize_t bad_inode_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen2090.91%150.00%
pre-gitpre-git29.09%150.00%
Total22100.00%2100.00%


static int bad_inode_removexattr(struct dentry *dentry, const char *name) { return -EIO; }

Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen20100.00%1100.00%
Total20100.00%1100.00%

static const struct inode_operations bad_inode_ops = { .create = bad_inode_create, .lookup = bad_inode_lookup, .link = bad_inode_link, .unlink = bad_inode_unlink, .symlink = bad_inode_symlink, .mkdir = bad_inode_mkdir, .rmdir = bad_inode_rmdir, .mknod = bad_inode_mknod, .rename2 = bad_inode_rename2, .readlink = bad_inode_readlink, /* follow_link must be no-op, otherwise unmounting this inode won't work */ /* put_link returns void */ /* truncate returns void */ .permission = bad_inode_permission, .getattr = bad_inode_getattr, .setattr = bad_inode_setattr, .setxattr = bad_inode_setxattr, .getxattr = bad_inode_getxattr, .listxattr = bad_inode_listxattr, .removexattr = bad_inode_removexattr, }; /* * When a filesystem is unable to read an inode due to an I/O error in * its read_inode() function, it can call make_bad_inode() to return a * set of stubs which will return EIO errors as required. * * We only need to do limited initialisation: all other fields are * preinitialised to zero automatically. */ /** * make_bad_inode - mark an inode bad due to an I/O error * @inode: Inode to mark bad * * When an inode cannot be read due to a media or remote network * failure this function makes the inode "bad" and causes I/O operations * on it to fail from this point on. */
void make_bad_inode(struct inode *inode) { remove_inode_hash(inode); inode->i_mode = S_IFREG; inode->i_atime = inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb); inode->i_op = &bad_inode_ops; inode->i_fop = &bad_file_ops; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git4379.63%250.00%
andi kleenandi kleen611.11%125.00%
christoph hellwigchristoph hellwig59.26%125.00%
Total54100.00%4100.00%

EXPORT_SYMBOL(make_bad_inode); /* * This tests whether an inode has been flagged as bad. The test uses * &bad_inode_ops to cover the case of invalidated inodes as well as * those created by make_bad_inode() above. */ /** * is_bad_inode - is an inode errored * @inode: inode to test * * Returns true if the inode in question has been marked as bad. */
bool is_bad_inode(struct inode *inode) { return (inode->i_op == &bad_inode_ops); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git1995.00%150.00%
yaowei baiyaowei bai15.00%150.00%
Total20100.00%2100.00%

EXPORT_SYMBOL(is_bad_inode); /** * iget_failed - Mark an under-construction inode as dead and release it * @inode: The inode to discard * * Mark an under-construction inode as dead and release it. */
void iget_failed(struct inode *inode) { make_bad_inode(inode); unlock_new_inode(inode); iput(inode); }

Contributors

PersonTokensPropCommitsCommitProp
david howellsdavid howells25100.00%1100.00%
Total25100.00%1100.00%

EXPORT_SYMBOL(iget_failed);

Overall Contributors

PersonTokensPropCommitsCommitProp
eric sandeeneric sandeen44063.68%13.23%
pre-gitpre-git11416.50%516.13%
david howellsdavid howells314.49%13.23%
art haasart haas243.47%13.23%
al viroal viro213.04%929.03%
andrew mortonandrew morton213.04%13.23%
arnaldo carvalho de meloarnaldo carvalho de melo121.74%13.23%
miklos szeredimiklos szeredi81.16%26.45%
andi kleenandi kleen60.87%13.23%
christoph hellwigchristoph hellwig50.72%13.23%
arjan van de venarjan van de ven20.29%26.45%
dave hansendave hansen20.29%13.23%
adrian bunkadrian bunk10.14%13.23%
hugh dickinshugh dickins10.14%13.23%
yaowei baiyaowei bai10.14%13.23%
dave jonesdave jones10.14%13.23%
paul gortmakerpaul gortmaker10.14%13.23%
Total691100.00%31100.00%
Directory: fs
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}