Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360722
b: refs/heads/master
c: dd37978
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Mar 2, 2013
1 parent de9a95c commit 2b9264d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5e608671dfbfd6a9556c31df65a4f147439eed59
refs/heads/master: dd37978c50bc8b354e5c4633f69387f16572fdac
2 changes: 2 additions & 0 deletions trunk/fs/file_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ struct file *alloc_file(struct path *path, fmode_t mode,
return file;

file->f_path = *path;
file->f_inode = path->dentry->d_inode;
file->f_mapping = path->dentry->d_inode->i_mapping;
file->f_mode = mode;
file->f_op = fop;
Expand Down Expand Up @@ -258,6 +259,7 @@ static void __fput(struct file *file)
drop_file_write_access(file);
file->f_path.dentry = NULL;
file->f_path.mnt = NULL;
file->f_inode = NULL;
file_free(file);
dput(dentry);
mntput(mnt);
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ static int do_dentry_open(struct file *f,
f->f_mode = FMODE_PATH;

path_get(&f->f_path);
inode = file_inode(f);
inode = f->f_inode = f->f_path.dentry->d_inode;
if (f->f_mode & FMODE_WRITE) {
error = __get_file_write_access(inode, f->f_path.mnt);
if (error)
Expand Down Expand Up @@ -752,6 +752,7 @@ static int do_dentry_open(struct file *f,
path_put(&f->f_path);
f->f_path.mnt = NULL;
f->f_path.dentry = NULL;
f->f_inode = NULL;
return error;
}

Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ struct file {
} f_u;
struct path f_path;
#define f_dentry f_path.dentry
struct inode *f_inode; /* cached value */
const struct file_operations *f_op;

/*
Expand Down Expand Up @@ -2217,7 +2218,7 @@ static inline bool execute_ok(struct inode *inode)

static inline struct inode *file_inode(struct file *f)
{
return f->f_path.dentry->d_inode;
return f->f_inode;
}

/*
Expand Down

0 comments on commit 2b9264d

Please sign in to comment.