Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242403
b: refs/heads/master
c: b8413f9
h: refs/heads/master
i:
  242401: f6cb43c
  242399: 1e192e4
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Mar 22, 2011
1 parent fc2610c commit 5e5f36b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 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: b31268ac793fd300da66b9c28bbf0a200339ab96
refs/heads/master: b8413f98f997bb3ed7327e6d7117e7e91ce010c3
31 changes: 19 additions & 12 deletions trunk/fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,13 +1261,17 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait)
{
int ret;

if (!test_and_set_bit(NFS_INO_COMMIT, &nfsi->flags))
return 1;
if (may_wait && !out_of_line_wait_on_bit_lock(&nfsi->flags,
NFS_INO_COMMIT, nfs_wait_bit_killable,
TASK_KILLABLE))
return 1;
return 0;
if (!may_wait)
return 0;
ret = out_of_line_wait_on_bit_lock(&nfsi->flags,
NFS_INO_COMMIT,
nfs_wait_bit_killable,
TASK_KILLABLE);
return (ret < 0) ? ret : 1;
}

static void nfs_commit_clear_lock(struct nfs_inode *nfsi)
Expand Down Expand Up @@ -1443,9 +1447,10 @@ int nfs_commit_inode(struct inode *inode, int how)
{
LIST_HEAD(head);
int may_wait = how & FLUSH_SYNC;
int res = 0;
int res;

if (!nfs_commit_set_lock(NFS_I(inode), may_wait))
res = nfs_commit_set_lock(NFS_I(inode), may_wait);
if (res <= 0)
goto out_mark_dirty;
spin_lock(&inode->i_lock);
res = nfs_scan_commit(inode, &head, 0, 0);
Expand All @@ -1454,12 +1459,14 @@ int nfs_commit_inode(struct inode *inode, int how)
int error = nfs_commit_list(inode, &head, how);
if (error < 0)
return error;
if (may_wait)
wait_on_bit(&NFS_I(inode)->flags, NFS_INO_COMMIT,
nfs_wait_bit_killable,
TASK_KILLABLE);
else
if (!may_wait)
goto out_mark_dirty;
error = wait_on_bit(&NFS_I(inode)->flags,
NFS_INO_COMMIT,
nfs_wait_bit_killable,
TASK_KILLABLE);
if (error < 0)
return error;
} else
nfs_commit_clear_lock(NFS_I(inode));
return res;
Expand Down

0 comments on commit 5e5f36b

Please sign in to comment.