Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23910
b: refs/heads/master
c: 9eafa8c
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Mar 20, 2006
1 parent b4930aa commit c395eda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 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: c89f2ee5f9223b864725f7344f24a037dfa76568
refs/heads/master: 9eafa8cc521b489f205bf7b0634c99e34e046606
20 changes: 13 additions & 7 deletions trunk/fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,10 @@ static void nfs_direct_write_result(struct rpc_task *task, void *calldata)
else
atomic_set(&dreq->error, status);

if (unlikely(atomic_dec_and_test(&dreq->complete)))
if (unlikely(atomic_dec_and_test(&dreq->complete))) {
nfs_end_data_update(data->inode);
nfs_direct_complete(dreq);
}
}

static const struct rpc_call_ops nfs_write_direct_ops = {
Expand Down Expand Up @@ -548,8 +550,6 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
result = nfs_direct_wait(dreq);
rpc_clnt_sigunmask(clnt, &oldset);

nfs_end_data_update(inode);

return result;
}

Expand Down Expand Up @@ -655,10 +655,6 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t
file->f_dentry->d_name.name,
(unsigned long) count, (long long) pos);

retval = -EINVAL;
if (!is_sync_kiocb(iocb))
goto out;

retval = generic_write_checks(file, &pos, &count, 0);
if (retval)
goto out;
Expand Down Expand Up @@ -688,8 +684,18 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t

retval = nfs_direct_write(iocb, (unsigned long) buf, count,
pos, pages, page_count);

/*
* XXX: nfs_end_data_update() already ensures this file's
* cached data is subsequently invalidated. Do we really
* need to call invalidate_inode_pages2() again here?
*
* For aio writes, this invalidation will almost certainly
* occur before the writes complete. Kind of racey.
*/
if (mapping->nrpages)
invalidate_inode_pages2(mapping);

if (retval > 0)
iocb->ki_pos = pos + retval;

Expand Down

0 comments on commit c395eda

Please sign in to comment.