Skip to content

Commit

Permalink
nfsd: use RWF_SYNC
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Christoph Hellwig authored and Al Viro committed May 1, 2016
1 parent e864f39 commit 24368aa
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
int stable = *stablep;
int use_wgather;
loff_t pos = offset;
loff_t end = LLONG_MAX;
unsigned int pflags = current->flags;
int flags = 0;

if (test_bit(RQ_LOCAL, &rqstp->rq_flags))
/*
Expand All @@ -955,25 +955,21 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
if (!EX_ISSYNC(exp))
stable = 0;

if (stable && !use_wgather)
flags |= RWF_SYNC;

/* Write the data. */
oldfs = get_fs(); set_fs(KERNEL_DS);
host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos, 0);
host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &pos, flags);
set_fs(oldfs);
if (host_err < 0)
goto out_nfserr;
*cnt = host_err;
nfsdstats.io_write += host_err;
fsnotify_modify(file);

if (stable) {
if (use_wgather) {
host_err = wait_for_concurrent_writes(file);
} else {
if (*cnt)
end = offset + *cnt - 1;
host_err = vfs_fsync_range(file, offset, end, 0);
}
}
if (stable && use_wgather)
host_err = wait_for_concurrent_writes(file);

out_nfserr:
dprintk("nfsd: write complete host_err=%d\n", host_err);
Expand Down

0 comments on commit 24368aa

Please sign in to comment.