aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2004-08-22 23:02:07 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-22 23:02:07 -0700
commit2b9b6f10f252c095dd047c26a3bdec599588d42a (patch)
treeb59d026eb67ef7b5d8416efaf3b7fa84bfb53bad /fs
parent08dd6c30a33d5313d0fe97af1c276e1aa5cd28ca (diff)
downloadhistory-2b9b6f10f252c095dd047c26a3bdec599588d42a.tar.gz
[PATCH] kNFSd: get rid of open_private_file
This is only used by nfsd to save one kmalloc, and the code is not always kept up-to-date with dentry_open, so just get rid of it. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/exportfs/expfs.c15
-rw-r--r--fs/file_table.c46
-rw-r--r--fs/lockd/svc4proc.c2
-rw-r--r--fs/lockd/svclock.c30
-rw-r--r--fs/lockd/svcproc.c2
-rw-r--r--fs/lockd/svcsubs.c8
-rw-r--r--fs/nfsd/lockd.c11
-rw-r--r--fs/nfsd/nfs4state.c22
-rw-r--r--fs/nfsd/vfs.c91
9 files changed, 83 insertions, 144 deletions
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index edde9a5d5414f5..383fb6f70b4c8f 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -1,5 +1,6 @@
#include <linux/fs.h>
+#include <linux/file.h>
#include <linux/module.h>
#include <linux/smp_lock.h>
#include <linux/namei.h>
@@ -347,7 +348,7 @@ static int get_name(struct dentry *dentry, char *name,
{
struct inode *dir = dentry->d_inode;
int error;
- struct file file;
+ struct file *file;
struct getdents_callback buffer;
error = -ENOTDIR;
@@ -359,11 +360,13 @@ static int get_name(struct dentry *dentry, char *name,
/*
* Open the directory ...
*/
- error = open_private_file(&file, dentry, O_RDONLY);
- if (error)
+ file = dentry_open(dget(dentry), NULL, O_RDONLY);
+ error = PTR_ERR(file);
+ if (IS_ERR(file))
goto out;
+
error = -EINVAL;
- if (!file.f_op->readdir)
+ if (!file->f_op->readdir)
goto out_close;
buffer.name = name;
@@ -373,7 +376,7 @@ static int get_name(struct dentry *dentry, char *name,
while (1) {
int old_seq = buffer.sequence;
- error = vfs_readdir(&file, filldir_one, &buffer);
+ error = vfs_readdir(file, filldir_one, &buffer);
if (error < 0)
break;
@@ -387,7 +390,7 @@ static int get_name(struct dentry *dentry, char *name,
}
out_close:
- close_private_file(&file);
+ fput(file);
out:
return error;
}
diff --git a/fs/file_table.c b/fs/file_table.c
index 6e97427ff0d8fb..426444c0e8d568 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -106,52 +106,6 @@ fail:
EXPORT_SYMBOL(get_empty_filp);
-/*
- * Clear and initialize a (private) struct file for the given dentry,
- * allocate the security structure, and call the open function (if any).
- * The file should be released using close_private_file.
- */
-int open_private_file(struct file *filp, struct dentry *dentry, int flags)
-{
- int error;
- memset(filp, 0, sizeof(*filp));
- eventpoll_init_file(filp);
- filp->f_flags = flags;
- filp->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE;
- atomic_set(&filp->f_count, 1);
- filp->f_dentry = dentry;
- filp->f_mapping = dentry->d_inode->i_mapping;
- filp->f_uid = current->fsuid;
- filp->f_gid = current->fsgid;
- filp->f_op = dentry->d_inode->i_fop;
- INIT_LIST_HEAD(&filp->f_list);
- error = security_file_alloc(filp);
- if (!error)
- if (filp->f_op && filp->f_op->open) {
- error = filp->f_op->open(dentry->d_inode, filp);
- if (error)
- security_file_free(filp);
- }
- return error;
-}
-
-EXPORT_SYMBOL(open_private_file);
-
-/*
- * Release a private file by calling the release function (if any) and
- * freeing the security structure.
- */
-void close_private_file(struct file *file)
-{
- struct inode * inode = file->f_dentry->d_inode;
-
- if (file->f_op && file->f_op->release)
- file->f_op->release(inode, file);
- security_file_free(file);
-}
-
-EXPORT_SYMBOL(close_private_file);
-
void fastcall fput(struct file *file)
{
if (atomic_dec_and_test(&file->f_count))
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index a3d3b78f7ce3a8..0fbe459a34c7a9 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -53,7 +53,7 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
*filp = file;
/* Set up the missing parts of the file_lock structure */
- lock->fl.fl_file = &file->f_file;
+ lock->fl.fl_file = file->f_file;
lock->fl.fl_owner = (fl_owner_t) host;
}
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 2addc9200763fd..b85d721172599f 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -238,7 +238,7 @@ nlmsvc_delete_block(struct nlm_block *block, int unlock)
/* Remove block from list */
nlmsvc_remove_block(block);
- posix_unblock_lock(&file->f_file, fl);
+ posix_unblock_lock(file->f_file, fl);
block->b_granted = 0;
/* If the block is in the middle of a GRANT callback,
@@ -299,8 +299,8 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
int error;
dprintk("lockd: nlmsvc_lock(%s/%ld, ty=%d, pi=%d, %Ld-%Ld, bl=%d)\n",
- file->f_file.f_dentry->d_inode->i_sb->s_id,
- file->f_file.f_dentry->d_inode->i_ino,
+ file->f_file->f_dentry->d_inode->i_sb->s_id,
+ file->f_file->f_dentry->d_inode->i_ino,
lock->fl.fl_type, lock->fl.fl_pid,
(long long)lock->fl.fl_start,
(long long)lock->fl.fl_end,
@@ -316,8 +316,8 @@ again:
/* Lock file against concurrent access */
down(&file->f_sema);
- if (!(conflock = posix_test_lock(&file->f_file, &lock->fl))) {
- error = posix_lock_file(&file->f_file, &lock->fl);
+ if (!(conflock = posix_test_lock(file->f_file, &lock->fl))) {
+ error = posix_lock_file(file->f_file, &lock->fl);
if (block)
nlmsvc_delete_block(block, 0);
@@ -382,13 +382,13 @@ nlmsvc_testlock(struct nlm_file *file, struct nlm_lock *lock,
struct file_lock *fl;
dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n",
- file->f_file.f_dentry->d_inode->i_sb->s_id,
- file->f_file.f_dentry->d_inode->i_ino,
+ file->f_file->f_dentry->d_inode->i_sb->s_id,
+ file->f_file->f_dentry->d_inode->i_ino,
lock->fl.fl_type,
(long long)lock->fl.fl_start,
(long long)lock->fl.fl_end);
- if ((fl = posix_test_lock(&file->f_file, &lock->fl)) != NULL) {
+ if ((fl = posix_test_lock(file->f_file, &lock->fl)) != NULL) {
dprintk("lockd: conflicting lock(ty=%d, %Ld-%Ld)\n",
fl->fl_type, (long long)fl->fl_start,
(long long)fl->fl_end);
@@ -414,8 +414,8 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
int error;
dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n",
- file->f_file.f_dentry->d_inode->i_sb->s_id,
- file->f_file.f_dentry->d_inode->i_ino,
+ file->f_file->f_dentry->d_inode->i_sb->s_id,
+ file->f_file->f_dentry->d_inode->i_ino,
lock->fl.fl_pid,
(long long)lock->fl.fl_start,
(long long)lock->fl.fl_end);
@@ -424,7 +424,7 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
nlmsvc_cancel_blocked(file, lock);
lock->fl.fl_type = F_UNLCK;
- error = posix_lock_file(&file->f_file, &lock->fl);
+ error = posix_lock_file(file->f_file, &lock->fl);
return (error < 0)? nlm_lck_denied_nolocks : nlm_granted;
}
@@ -442,8 +442,8 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
struct nlm_block *block;
dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
- file->f_file.f_dentry->d_inode->i_sb->s_id,
- file->f_file.f_dentry->d_inode->i_ino,
+ file->f_file->f_dentry->d_inode->i_sb->s_id,
+ file->f_file->f_dentry->d_inode->i_ino,
lock->fl.fl_pid,
(long long)lock->fl.fl_start,
(long long)lock->fl.fl_end);
@@ -515,7 +515,7 @@ nlmsvc_grant_blocked(struct nlm_block *block)
}
/* Try the lock operation again */
- if ((conflock = posix_test_lock(&file->f_file, &lock->fl)) != NULL) {
+ if ((conflock = posix_test_lock(file->f_file, &lock->fl)) != NULL) {
/* Bummer, we blocked again */
dprintk("lockd: lock still blocked\n");
nlmsvc_insert_block(block, NLM_NEVER);
@@ -528,7 +528,7 @@ nlmsvc_grant_blocked(struct nlm_block *block)
* following yields an error, this is most probably due to low
* memory. Retry the lock in a few seconds.
*/
- if ((error = posix_lock_file(&file->f_file, &lock->fl)) < 0) {
+ if ((error = posix_lock_file(file->f_file, &lock->fl)) < 0) {
printk(KERN_WARNING "lockd: unexpected error %d in %s!\n",
-error, __FUNCTION__);
nlmsvc_insert_block(block, 10 * HZ);
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index b676e8ccd8c8f4..4104f4bb6af7d1 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -82,7 +82,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
*filp = file;
/* Set up the missing parts of the file_lock structure */
- lock->fl.fl_file = &file->f_file;
+ lock->fl.fl_file = file->f_file;
lock->fl.fl_owner = (fl_owner_t) host;
}
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 0be7f080eb8a0e..4d37124b928943 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -124,7 +124,7 @@ out_free:
static inline void
nlm_delete_file(struct nlm_file *file)
{
- struct inode *inode = file->f_file.f_dentry->d_inode;
+ struct inode *inode = file->f_file->f_dentry->d_inode;
struct nlm_file **fp, *f;
dprintk("lockd: closing file %s/%ld\n",
@@ -133,7 +133,7 @@ nlm_delete_file(struct nlm_file *file)
while ((f = *fp) != NULL) {
if (f == file) {
*fp = file->f_next;
- nlmsvc_ops->fclose(&file->f_file);
+ nlmsvc_ops->fclose(file->f_file);
kfree(file);
return;
}
@@ -176,7 +176,7 @@ again:
lock.fl_type = F_UNLCK;
lock.fl_start = 0;
lock.fl_end = OFFSET_MAX;
- if (posix_lock_file(&file->f_file, &lock) < 0) {
+ if (posix_lock_file(file->f_file, &lock) < 0) {
printk("lockd: unlock failure in %s:%d\n",
__FILE__, __LINE__);
return 1;
@@ -230,7 +230,7 @@ nlm_traverse_files(struct nlm_host *host, int action)
if (!file->f_blocks && !file->f_locks
&& !file->f_shares && !file->f_count) {
*fp = file->f_next;
- nlmsvc_ops->fclose(&file->f_file);
+ nlmsvc_ops->fclose(file->f_file);
kfree(file);
} else {
fp = &file->f_next;
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
index 479835b164dee8..3397bec4708558 100644
--- a/fs/nfsd/lockd.c
+++ b/fs/nfsd/lockd.c
@@ -10,6 +10,7 @@
#include <linux/types.h>
#include <linux/fs.h>
+#include <linux/file.h>
#include <linux/mount.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/svc.h>
@@ -22,7 +23,7 @@
* Note: we hold the dentry use count while the file is open.
*/
static u32
-nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file *filp)
+nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp)
{
u32 nfserr;
struct svc_fh fh;
@@ -35,10 +36,6 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file *filp)
exp_readlock();
nfserr = nfsd_open(rqstp, &fh, S_IFREG, MAY_LOCK, filp);
- if (!nfserr) {
- dget(filp->f_dentry);
- mntget(filp->f_vfsmnt);
- }
fh_put(&fh);
rqstp->rq_client = NULL;
exp_readunlock();
@@ -60,9 +57,7 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file *filp)
static void
nlm_fclose(struct file *filp)
{
- nfsd_close(filp);
- dput(filp->f_dentry);
- mntput(filp->f_vfsmnt);
+ fput(filp);
}
struct nlmsvc_binding nfsd_nlm_ops = {
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 0ff4425cae9aba..72e79254e7d78c 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -962,12 +962,10 @@ release_stateid(struct nfs4_stateid *stp, int flags) {
list_del(&stp->st_perfilestate);
if((stp->st_vfs_set) && (flags & OPEN_STATE)) {
release_stateid_lockowner(stp);
- nfsd_close(&stp->st_vfs_file);
+ nfsd_close(stp->st_vfs_file);
vfsclose++;
- dput(stp->st_vfs_file.f_dentry);
- mntput(stp->st_vfs_file.f_vfsmnt);
} else if ((stp->st_vfs_set) && (flags & LOCK_STATE)) {
- struct file *filp = &stp->st_vfs_file;
+ struct file *filp = stp->st_vfs_file;
locks_remove_posix(filp, (fl_owner_t) stp->st_stateowner);
}
@@ -1315,8 +1313,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
goto out_free;
vfsopen++;
- dget(stp->st_vfs_file.f_dentry);
- mntget(stp->st_vfs_file.f_vfsmnt);
init_stateid(stp, fp, sop, open);
stp->st_vfs_set = 1;
@@ -1331,7 +1327,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
share_access &= open->op_share_access;
/* update the struct file */
- if ((status = nfs4_file_upgrade(&stp->st_vfs_file, share_access)))
+ if ((status = nfs4_file_upgrade(stp->st_vfs_file, share_access)))
goto out;
/* remember the open */
set_bit(open->op_share_access, &stp->st_access_bmap);
@@ -1499,7 +1495,7 @@ static inline int
nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stateid *stp)
{
return (stp->st_vfs_set == 0 ||
- fhp->fh_dentry->d_inode != stp->st_vfs_file.f_dentry->d_inode);
+ fhp->fh_dentry->d_inode != stp->st_vfs_file->f_dentry->d_inode);
}
static int
@@ -1816,7 +1812,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n
goto out;
}
set_access(&share_access, stp->st_access_bmap);
- nfs4_file_downgrade(&stp->st_vfs_file,
+ nfs4_file_downgrade(stp->st_vfs_file,
share_access & ~od->od_share_access);
reset_union_bmap_access(od->od_share_access, &stp->st_access_bmap);
@@ -2059,7 +2055,7 @@ alloc_init_lock_stateid(struct nfs4_stateowner *sop, struct nfs4_file *fp, struc
stp->st_stateid.si_stateownerid = sop->so_id;
stp->st_stateid.si_fileid = fp->fi_id;
stp->st_stateid.si_generation = 0;
- stp->st_vfs_file = open_stp->st_vfs_file;
+ stp->st_vfs_file = open_stp->st_vfs_file; /* FIXME refcount?? */
stp->st_vfs_set = open_stp->st_vfs_set;
stp->st_access_bmap = open_stp->st_access_bmap;
stp->st_deny_bmap = open_stp->st_deny_bmap;
@@ -2172,7 +2168,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
goto out;
}
/* lock->lk_stateowner and lock_stp have been created or found */
- filp = &lock_stp->st_vfs_file;
+ filp = lock_stp->st_vfs_file;
if ((status = fh_verify(rqstp, current_fh, S_IFREG, MAY_LOCK))) {
printk("NFSD: nfsd4_lock: permission denied!\n");
@@ -2378,7 +2374,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
&locku->lu_stateowner, &stp, NULL)))
goto out;
- filp = &stp->st_vfs_file;
+ filp = stp->st_vfs_file;
BUG_ON(!filp);
file_lock.fl_type = F_UNLCK;
file_lock.fl_owner = (fl_owner_t) locku->lu_stateowner;
@@ -2473,7 +2469,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *
list_for_each_entry(stp, &local->so_perfilestate,
st_perfilestate) {
if(stp->st_vfs_set) {
- if (check_for_locks(&stp->st_vfs_file, local))
+ if (check_for_locks(stp->st_vfs_file, local))
goto out;
}
}
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 763dee080c9340..8e242a54676cc9 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -21,6 +21,7 @@
#include <linux/time.h>
#include <linux/errno.h>
#include <linux/fs.h>
+#include <linux/file.h>
#include <linux/mount.h>
#include <linux/major.h>
#include <linux/ext2_fs.h>
@@ -79,6 +80,7 @@ struct raparms {
unsigned int p_count;
ino_t p_ino;
dev_t p_dev;
+ int p_set;
struct file_ra_state p_ra;
};
@@ -635,7 +637,7 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *suppor
*/
int
nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
- int access, struct file *filp)
+ int access, struct file **filp)
{
struct dentry *dentry;
struct inode *inode;
@@ -671,21 +673,13 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
goto out_nfserr;
if (access & MAY_WRITE) {
- err = get_write_access(inode);
- if (err)
- goto out_nfserr;
-
flags = O_WRONLY|O_LARGEFILE;
DQUOT_INIT(inode);
}
-
- err = open_private_file(filp, dentry, flags);
- if (!err) {
- filp->f_vfsmnt = fhp->fh_export->ex_mnt;
- } else if (access & MAY_WRITE)
- put_write_access(inode);
-
+ *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags);
+ if (IS_ERR(*filp))
+ err = PTR_ERR(*filp);
out_nfserr:
if (err)
err = nfserrno(err);
@@ -699,12 +693,7 @@ out:
void
nfsd_close(struct file *filp)
{
- struct dentry *dentry = filp->f_dentry;
- struct inode *inode = dentry->d_inode;
-
- close_private_file(filp);
- if (filp->f_mode & FMODE_WRITE)
- put_write_access(inode);
+ fput(filp);
}
/*
@@ -748,7 +737,7 @@ nfsd_sync_dir(struct dentry *dp)
static spinlock_t ra_lock = SPIN_LOCK_UNLOCKED;
static inline struct raparms *
-nfsd_get_raparms(dev_t dev, ino_t ino, struct address_space *mapping)
+nfsd_get_raparms(dev_t dev, ino_t ino)
{
struct raparms *ra, **rap, **frap = NULL;
int depth = 0;
@@ -770,7 +759,7 @@ nfsd_get_raparms(dev_t dev, ino_t ino, struct address_space *mapping)
ra = *frap;
ra->p_dev = dev;
ra->p_ino = ino;
- file_ra_state_init(&ra->p_ra, mapping);
+ ra->p_set = 0;
found:
if (rap != &raparm_cache) {
*rap = ra->p_next;
@@ -827,14 +816,14 @@ nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
struct raparms *ra;
mm_segment_t oldfs;
int err;
- struct file file;
+ struct file *file;
struct inode *inode;
err = nfsd_open(rqstp, fhp, S_IFREG, MAY_READ, &file);
if (err)
goto out;
err = nfserr_perm;
- inode = file.f_dentry->d_inode;
+ inode = file->f_dentry->d_inode;
#ifdef MSNFS
if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
(!lock_may_read(inode, offset, *count)))
@@ -842,38 +831,40 @@ nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
#endif
/* Get readahead parameters */
- ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino,
- inode->i_mapping->host->i_mapping);
- if (ra)
- file.f_ra = ra->p_ra;
+ ra = nfsd_get_raparms(inode->i_sb->s_dev, inode->i_ino);
+
+ if (ra && ra->p_set)
+ file->f_ra = ra->p_ra;
- if (file.f_op->sendfile) {
+ if (file->f_op->sendfile) {
svc_pushback_unused_pages(rqstp);
- err = file.f_op->sendfile(&file, &offset, *count,
+ err = file->f_op->sendfile(file, &offset, *count,
nfsd_read_actor, rqstp);
} else {
oldfs = get_fs();
set_fs(KERNEL_DS);
- err = vfs_readv(&file, (struct iovec __user *)vec, vlen, &offset);
+ err = vfs_readv(file, (struct iovec __user *)vec, vlen, &offset);
set_fs(oldfs);
}
/* Write back readahead params */
if (ra) {
spin_lock(&ra_lock);
- ra->p_ra = file.f_ra;
+ ra->p_ra = file->f_ra;
+ ra->p_set = 1;
ra->p_count--;
spin_unlock(&ra_lock);
}
+
if (err >= 0) {
nfsdstats.io_read += err;
*count = err;
err = 0;
- dnotify_parent(file.f_dentry, DN_ACCESS);
+ dnotify_parent(file->f_dentry, DN_ACCESS);
} else
err = nfserrno(err);
out_close:
- nfsd_close(&file);
+ nfsd_close(file);
out:
return err;
}
@@ -889,7 +880,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
unsigned long cnt, int *stablep)
{
struct svc_export *exp;
- struct file file;
+ struct file *file;
struct dentry *dentry;
struct inode *inode;
mm_segment_t oldfs;
@@ -905,11 +896,11 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
#ifdef MSNFS
if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
- (!lock_may_write(file.f_dentry->d_inode, offset, cnt)))
+ (!lock_may_write(file->f_dentry->d_inode, offset, cnt)))
goto out_close;
#endif
- dentry = file.f_dentry;
+ dentry = file->f_dentry;
inode = dentry->d_inode;
exp = fhp->fh_export;
@@ -922,7 +913,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
* flushing the data to disk is handled separately below.
*/
- if (file.f_op->fsync == 0) {/* COMMIT3 cannot work */
+ if (file->f_op->fsync == 0) {/* COMMIT3 cannot work */
stable = 2;
*stablep = 2; /* FILE_SYNC */
}
@@ -930,15 +921,15 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
if (!EX_ISSYNC(exp))
stable = 0;
if (stable && !EX_WGATHER(exp))
- file.f_flags |= O_SYNC;
+ file->f_flags |= O_SYNC;
/* Write the data. */
oldfs = get_fs(); set_fs(KERNEL_DS);
- err = vfs_writev(&file, (struct iovec __user *)vec, vlen, &offset);
+ err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset);
set_fs(oldfs);
if (err >= 0) {
nfsdstats.io_write += cnt;
- dnotify_parent(file.f_dentry, DN_MODIFY);
+ dnotify_parent(file->f_dentry, DN_MODIFY);
}
/* clear setuid/setgid flag after write */
@@ -978,7 +969,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
if (inode->i_state & I_DIRTY) {
dprintk("nfsd: write sync %d\n", current->pid);
- nfsd_sync(&file);
+ nfsd_sync(file);
}
#if 0
wake_up(&inode->i_wait);
@@ -994,7 +985,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
else
err = nfserrno(err);
out_close:
- nfsd_close(&file);
+ nfsd_close(file);
out:
return err;
}
@@ -1013,7 +1004,7 @@ int
nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
loff_t offset, unsigned long count)
{
- struct file file;
+ struct file *file;
int err;
if ((u64)count > ~(u64)offset)
@@ -1022,14 +1013,14 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
if ((err = nfsd_open(rqstp, fhp, S_IFREG, MAY_WRITE, &file)) != 0)
return err;
if (EX_ISSYNC(fhp->fh_export)) {
- if (file.f_op && file.f_op->fsync) {
- nfsd_sync(&file);
+ if (file->f_op && file->f_op->fsync) {
+ nfsd_sync(file);
} else {
err = nfserr_notsupp;
}
}
- nfsd_close(&file);
+ nfsd_close(file);
return err;
}
#endif /* CONFIG_NFSD_V3 */
@@ -1652,14 +1643,14 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
struct readdir_cd *cdp, encode_dent_fn func)
{
int err;
- struct file file;
+ struct file *file;
loff_t offset = *offsetp;
err = nfsd_open(rqstp, fhp, S_IFDIR, MAY_READ, &file);
if (err)
goto out;
- offset = vfs_llseek(&file, offset, 0);
+ offset = vfs_llseek(file, offset, 0);
if (offset < 0) {
err = nfserrno((int)offset);
goto out_close;
@@ -1673,18 +1664,18 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
do {
cdp->err = nfserr_eof; /* will be cleared on successful read */
- err = vfs_readdir(&file, (filldir_t) func, cdp);
+ err = vfs_readdir(file, (filldir_t) func, cdp);
} while (err >=0 && cdp->err == nfs_ok);
if (err)
err = nfserrno(err);
else
err = cdp->err;
- *offsetp = vfs_llseek(&file, 0, 1);
+ *offsetp = vfs_llseek(file, 0, 1);
if (err == nfserr_eof || err == nfserr_toosmall)
err = nfs_ok; /* can still be found in ->err */
out_close:
- nfsd_close(&file);
+ nfsd_close(file);
out:
return err;
}