VFS: normal filesystems (and lustre): d_inode() annotations

that's the bulk of filesystem drivers dealing with inodes of their own

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
David Howells
2015-03-17 22:25:59 +00:00
committed by Al Viro
parent ce0b16ddf1
commit 2b0143b5c9
278 changed files with 1419 additions and 1420 deletions

View File

@@ -169,7 +169,7 @@ static int get_task_root(struct task_struct *task, struct path *root)
static int proc_cwd_link(struct dentry *dentry, struct path *path)
{
struct task_struct *task = get_proc_task(dentry->d_inode);
struct task_struct *task = get_proc_task(d_inode(dentry));
int result = -ENOENT;
if (task) {
@@ -186,7 +186,7 @@ static int proc_cwd_link(struct dentry *dentry, struct path *path)
static int proc_root_link(struct dentry *dentry, struct path *path)
{
struct task_struct *task = get_proc_task(dentry->d_inode);
struct task_struct *task = get_proc_task(d_inode(dentry));
int result = -ENOENT;
if (task) {
@@ -505,7 +505,7 @@ static int proc_fd_access_allowed(struct inode *inode)
int proc_setattr(struct dentry *dentry, struct iattr *attr)
{
int error;
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
if (attr->ia_valid & ATTR_MODE)
return -EPERM;
@@ -1353,7 +1353,7 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
struct mm_struct *mm;
struct file *exe_file;
task = get_proc_task(dentry->d_inode);
task = get_proc_task(d_inode(dentry));
if (!task)
return -ENOENT;
mm = get_task_mm(task);
@@ -1373,7 +1373,7 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path)
static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
struct path path;
int error = -EACCES;
@@ -1418,7 +1418,7 @@ static int do_proc_readlink(struct path *path, char __user *buffer, int buflen)
static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int buflen)
{
int error = -EACCES;
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
struct path path;
/* Are we allowed to snoop on the tasks file descriptors? */
@@ -1488,7 +1488,7 @@ out_unlock:
int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
struct task_struct *task;
const struct cred *cred;
struct pid_namespace *pid = dentry->d_sb->s_fs_info;
@@ -1545,7 +1545,7 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags)
if (flags & LOOKUP_RCU)
return -ECHILD;
inode = dentry->d_inode;
inode = d_inode(dentry);
task = get_proc_task(inode);
if (task) {
@@ -1579,7 +1579,7 @@ int pid_delete_dentry(const struct dentry *dentry)
* If so, then don't put the dentry on the lru list,
* kill it immediately.
*/
return proc_inode_is_dead(dentry->d_inode);
return proc_inode_is_dead(d_inode(dentry));
}
const struct dentry_operations pid_dentry_operations =
@@ -1617,12 +1617,12 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
child = d_alloc(dir, &qname);
if (!child)
goto end_instantiate;
if (instantiate(dir->d_inode, child, task, ptr) < 0) {
if (instantiate(d_inode(dir), child, task, ptr) < 0) {
dput(child);
goto end_instantiate;
}
}
inode = child->d_inode;
inode = d_inode(child);
ino = inode->i_ino;
type = inode->i_mode >> 12;
dput(child);
@@ -1665,7 +1665,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags)
goto out_notask;
}
inode = dentry->d_inode;
inode = d_inode(dentry);
task = get_proc_task(inode);
if (!task)
goto out_notask;
@@ -1718,7 +1718,7 @@ static int proc_map_files_get_link(struct dentry *dentry, struct path *path)
int rc;
rc = -ENOENT;
task = get_proc_task(dentry->d_inode);
task = get_proc_task(d_inode(dentry));
if (!task)
goto out;
@@ -2851,13 +2851,13 @@ int proc_pid_readdir(struct file *file, struct dir_context *ctx)
return 0;
if (pos == TGID_OFFSET - 2) {
struct inode *inode = ns->proc_self->d_inode;
struct inode *inode = d_inode(ns->proc_self);
if (!dir_emit(ctx, "self", 4, inode->i_ino, DT_LNK))
return 0;
ctx->pos = pos = pos + 1;
}
if (pos == TGID_OFFSET - 1) {
struct inode *inode = ns->proc_thread_self->d_inode;
struct inode *inode = d_inode(ns->proc_thread_self);
if (!dir_emit(ctx, "thread-self", 11, inode->i_ino, DT_LNK))
return 0;
ctx->pos = pos = pos + 1;
@@ -3176,7 +3176,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
static int proc_task_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
struct task_struct *p = get_proc_task(inode);
generic_fillattr(inode, stat);

View File

@@ -84,7 +84,7 @@ static int tid_fd_revalidate(struct dentry *dentry, unsigned int flags)
if (flags & LOOKUP_RCU)
return -ECHILD;
inode = dentry->d_inode;
inode = d_inode(dentry);
task = get_proc_task(inode);
fd = proc_fd(inode);
@@ -144,14 +144,14 @@ static int proc_fd_link(struct dentry *dentry, struct path *path)
struct task_struct *task;
int ret = -ENOENT;
task = get_proc_task(dentry->d_inode);
task = get_proc_task(d_inode(dentry));
if (task) {
files = get_files_struct(task);
put_task_struct(task);
}
if (files) {
int fd = proc_fd(dentry->d_inode);
int fd = proc_fd(d_inode(dentry));
struct file *fd_file;
spin_lock(&files->file_lock);

View File

@@ -101,7 +101,7 @@ static bool pde_subdir_insert(struct proc_dir_entry *dir,
static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
struct proc_dir_entry *de = PDE(inode);
int error;
@@ -120,7 +120,7 @@ static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
struct proc_dir_entry *de = PDE(inode);
if (de && de->nlink)
set_nlink(inode, de->nlink);

View File

@@ -396,7 +396,7 @@ static const struct file_operations proc_reg_file_ops_no_compat = {
static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct proc_dir_entry *pde = PDE(dentry->d_inode);
struct proc_dir_entry *pde = PDE(d_inode(dentry));
if (unlikely(!use_pde(pde)))
return ERR_PTR(-EINVAL);
nd_set_link(nd, pde->data);

View File

@@ -32,7 +32,7 @@ static const struct proc_ns_operations *ns_entries[] = {
static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops;
struct task_struct *task;
struct path ns_path;
@@ -53,7 +53,7 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd)
static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops;
struct task_struct *task;
char name[50];

View File

@@ -142,7 +142,7 @@ static struct dentry *proc_tgid_net_lookup(struct inode *dir,
static int proc_tgid_net_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
struct net *net;
net = get_proc_task_net(inode);

View File

@@ -604,7 +604,7 @@ static bool proc_sys_fill_cache(struct file *file,
return false;
}
}
inode = child->d_inode;
inode = d_inode(child);
ino = inode->i_ino;
type = inode->i_mode >> 12;
dput(child);
@@ -710,7 +710,7 @@ static int proc_sys_permission(struct inode *inode, int mask)
static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
int error;
if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID))
@@ -727,7 +727,7 @@ static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
static int proc_sys_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
struct inode *inode = d_inode(dentry);
struct ctl_table_header *head = grab_header(inode);
struct ctl_table *table = PROC_I(inode)->sysctl_entry;
@@ -773,12 +773,12 @@ static int proc_sys_revalidate(struct dentry *dentry, unsigned int flags)
{
if (flags & LOOKUP_RCU)
return -ECHILD;
return !PROC_I(dentry->d_inode)->sysctl->unregistering;
return !PROC_I(d_inode(dentry))->sysctl->unregistering;
}
static int proc_sys_delete(const struct dentry *dentry)
{
return !!PROC_I(dentry->d_inode)->sysctl->unregistering;
return !!PROC_I(d_inode(dentry))->sysctl->unregistering;
}
static int sysctl_is_seen(struct ctl_table_header *p)
@@ -805,7 +805,7 @@ static int proc_sys_compare(const struct dentry *parent, const struct dentry *de
/* Although proc doesn't have negative dentries, rcu-walk means
* that inode here can be NULL */
/* AV: can it, indeed? */
inode = ACCESS_ONCE(dentry->d_inode);
inode = d_inode_rcu(dentry);
if (!inode)
return 1;
if (name->len != len)

View File

@@ -195,7 +195,7 @@ void __init proc_root_init(void)
static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
)
{
generic_fillattr(dentry->d_inode, stat);
generic_fillattr(d_inode(dentry), stat);
stat->nlink = proc_root.nlink + nr_processes();
return 0;
}

View File

@@ -46,7 +46,7 @@ static unsigned self_inum;
int proc_setup_self(struct super_block *s)
{
struct inode *root_inode = s->s_root->d_inode;
struct inode *root_inode = d_inode(s->s_root);
struct pid_namespace *ns = s->s_fs_info;
struct dentry *self;

View File

@@ -47,7 +47,7 @@ static unsigned thread_self_inum;
int proc_setup_thread_self(struct super_block *s)
{
struct inode *root_inode = s->s_root->d_inode;
struct inode *root_inode = d_inode(s->s_root);
struct pid_namespace *ns = s->s_fs_info;
struct dentry *thread_self;