Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90945
b: refs/heads/master
c: aceaf78
h: refs/heads/master
i:
  90943: 873d820
v: v3
  • Loading branch information
Dave Hansen authored and Al Viro committed Apr 19, 2008
1 parent f4d99be commit 060b701
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 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: 8366025eb80dfa0d8d94b286d53027081c280ef1
refs/heads/master: aceaf78da92a53f5e1b105649a1b8c0afdb2135c
21 changes: 19 additions & 2 deletions trunk/fs/file_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,23 @@ void fput(struct file *file)

EXPORT_SYMBOL(fput);

/**
* drop_file_write_access - give up ability to write to a file
* @file: the file to which we will stop writing
*
* This is a central place which will give up the ability
* to write to @file, along with access to write through
* its vfsmount.
*/
void drop_file_write_access(struct file *file)
{
struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode;

put_write_access(inode);
}
EXPORT_SYMBOL_GPL(drop_file_write_access);

/* __fput is called from task context when aio completion releases the last
* last use of a struct file *. Do not use otherwise.
*/
Expand All @@ -236,10 +253,10 @@ void __fput(struct file *file)
if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL))
cdev_put(inode->i_cdev);
fops_put(file->f_op);
if (file->f_mode & FMODE_WRITE)
put_write_access(inode);
put_pid(file->f_owner.pid);
file_kill(file);
if (file->f_mode & FMODE_WRITE)
drop_file_write_access(file);
file->f_path.dentry = NULL;
file->f_path.mnt = NULL;
file_free(file);
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <linux/sunrpc/svc.h>
#include <linux/nfsd/nfsd.h>
#include <linux/nfsd/cache.h>
#include <linux/file.h>
#include <linux/mount.h>
#include <linux/workqueue.h>
#include <linux/smp_lock.h>
Expand Down Expand Up @@ -1239,7 +1240,7 @@ static inline void
nfs4_file_downgrade(struct file *filp, unsigned int share_access)
{
if (share_access & NFS4_SHARE_ACCESS_WRITE) {
put_write_access(filp->f_path.dentry->d_inode);
drop_file_write_access(filp);
filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE;
}
}
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ extern struct kmem_cache *filp_cachep;

extern void __fput(struct file *);
extern void fput(struct file *);
extern void drop_file_write_access(struct file *file);

struct file_operations;
struct vfsmount;
Expand Down

0 comments on commit 060b701

Please sign in to comment.