Re: 4.8-rcN nfs O_DYSNC, write(2) doesn't return ENOSPC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2016-09-03 at 13:31 +0900, J. R. Okajima wrote:
> Hello NFS folks,
> 
> I am not subscribing this ML. Please CC to me explicitly when you
> reply.
> 
> I found a problem of NFS in linux-v4.8-rc[123]. Here is a
> reproducible
> sequence.
> 
> - mount a rather small tmpfs, for example /tmp/srvr
> - export it to localhost
> - mount localhost:/tmp/srvr /tmp/clnt
> - dd if=/dev/zero of=/tmp/clnt/full
> 
> After a while, dd ends with ENOSPC expectedly. But if I add
> "oflag=dsync"
> to dd(1), it never ends. strace(1) shows dd repeats write(512bytes)
> and
> gets the value 512.
> 
> If this is a known issue, please tell me the commit id of the fix.
> 

Thanks for testing! Does the following patch fix the issue for you?

Cheers
  Trond

8<----------------------------------------------------------------
>From c49edecd513693ea7530ab18efbd7d6d5b7cbf90 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Date: Sat, 3 Sep 2016 12:05:31 -0400
Subject: [PATCH] NFS: Fix error reporting in nfs_file_write()

When doing O_DSYNC writes, the actual write errors are reported through
generic_write_sync(), so we must test the result.

Reported-by: J. R. Okajima <hooanon05g@xxxxxxxxx>
Fixes: 18290650b1c8 ("NFS: Move buffered I/O locking into nfs_file_write()")
Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
---
 fs/nfs/file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 7d620970f2e1..ca699ddc11c1 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -657,7 +657,10 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from)
 	if (result <= 0)
 		goto out;
 
-	written = generic_write_sync(iocb, result);
+	result = generic_write_sync(iocb, result);
+	if (result < 0)
+		goto out;
+	written = result;
 	iocb->ki_pos += written;
 
 	/* Return error values */
-- 
2.7.4
-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@xxxxxxxxxxxxxxx
��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux