aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index f141bde7756a..7f9ecc46f3fb 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -97,16 +97,12 @@ u64 nfs_compat_user_ino64(u64 fileid)
97 return ino; 97 return ino;
98} 98}
99 99
100int nfs_write_inode(struct inode *inode, int sync) 100int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
101{ 101{
102 int ret; 102 int ret;
103 103
104 if (sync) { 104 ret = nfs_commit_inode(inode,
105 ret = filemap_fdatawait(inode->i_mapping); 105 wbc->sync_mode == WB_SYNC_ALL ? FLUSH_SYNC : 0);
106 if (ret == 0)
107 ret = nfs_commit_inode(inode, FLUSH_SYNC);
108 } else
109 ret = nfs_commit_inode(inode, 0);
110 if (ret >= 0) 106 if (ret >= 0)
111 return 0; 107 return 0;
112 __mark_inode_dirty(inode, I_DIRTY_DATASYNC); 108 __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
@@ -574,14 +570,14 @@ void nfs_close_context(struct nfs_open_context *ctx, int is_sync)
574 nfs_revalidate_inode(server, inode); 570 nfs_revalidate_inode(server, inode);
575} 571}
576 572
577static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, struct dentry *dentry, struct rpc_cred *cred) 573static struct nfs_open_context *alloc_nfs_open_context(struct path *path, struct rpc_cred *cred)
578{ 574{
579 struct nfs_open_context *ctx; 575 struct nfs_open_context *ctx;
580 576
581 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); 577 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
582 if (ctx != NULL) { 578 if (ctx != NULL) {
583 ctx->path.dentry = dget(dentry); 579 ctx->path = *path;
584 ctx->path.mnt = mntget(mnt); 580 path_get(&ctx->path);
585 ctx->cred = get_rpccred(cred); 581 ctx->cred = get_rpccred(cred);
586 ctx->state = NULL; 582 ctx->state = NULL;
587 ctx->lockowner = current->files; 583 ctx->lockowner = current->files;
@@ -686,7 +682,7 @@ int nfs_open(struct inode *inode, struct file *filp)
686 cred = rpc_lookup_cred(); 682 cred = rpc_lookup_cred();
687 if (IS_ERR(cred)) 683 if (IS_ERR(cred))
688 return PTR_ERR(cred); 684 return PTR_ERR(cred);
689 ctx = alloc_nfs_open_context(filp->f_path.mnt, filp->f_path.dentry, cred); 685 ctx = alloc_nfs_open_context(&filp->f_path, cred);
690 put_rpccred(cred); 686 put_rpccred(cred);
691 if (ctx == NULL) 687 if (ctx == NULL)
692 return -ENOMEM; 688 return -ENOMEM;