Q. NFS, return value of close(2)
Subsystems (2)
By the commit af7fa16 "NFS: Fix up the fsync code", close(2) seems to return the non-zero value even if it goes well, eg. the number of page via
nfs_file_flush()vfs_fsync()nfs_file_fsync()nfs_commit_inode()nfs_scan_commit()nfs_scan_list()
Should nfs_file_fsync() return 0 when "status" is positive?
{
status = nfs_commit_inode(inode, FLUSH_SYNC);
;;;
- if (!ret)
+ if (!ret && status < 0)
ret = status;
}J. R. Okajima
Quoted 21 lines · J. R. Okajima
By the commit af7fa16 "NFS: Fix up the fsync code", close(2) seems to return the non-zero value even if it goes well, eg. the number of page via
nfs_file_flush()vfs_fsync()nfs_file_fsync()nfs_commit_inode()nfs_scan_commit()nfs_scan_list()Should
nfs_file_fsync()return 0 when "status" is positive?{ status = nfs_commit_inode(inode, FLUSH_SYNC); ;;;(quoted diff) +1
-1- if (!ret) + if (!ret && status < 0)ret = status; }
Quoted 1 line
J. R. Okajima
Yes. That looks correct. Can you resend with an appropriate signed-off line, etc.?
Cheers
Trond
Trond Myklebust:
Quoted 2 lines
Yes. That looks correct. Can you resend with an appropriate signed-off line, etc.?
Sure.
----------------------------------------------------------------------
commit e56f956a08a6227004cd9b7747df6a089dbb3594
Author: J. R. Okajima <[email protected]> Date: Thu Aug 12 02:00:02 2010 +0900
NFS: fix the return value of nfs_file_fsync()
By the commit
af7fa16 2010-08-03 NFS: Fix up the fsync code
close(2) became returning the non-zero value even if it went well. nfs_file_fsync() should return 0 when "status" is positive.
fs/nfs/file.c +1 -1
@@ -323,7 +323,7 @@ nfs_file_fsync(struct file *file, int datasync) have_error |=test_bit (NFS_CONTEXT_ERROR_WRITE , &ctx->flags);if (have_error) ret =xchg (&ctx->error,0 ); -if (!ret) +if (!ret && status <0 ) ret = status;return ret; }
Trond Myklebust
AppliedQuoted 5 lines · J. R. Okajima
Trond Myklebust:
Quoted 2 lines
Yes. That looks correct. Can you resend with an appropriate signed-off line, etc.?
Sure.
Thank you! Applied...
Trond
Quoted 27 lines
----------------------------------------------------------------------
commite56f956a08a6227004cd9b7747df6a089dbb3594Author: J. R. Okajima <[email protected]> Date: Thu Aug 12 02:00:02 2010 +0900NFS: fix the return value of
nfs_file_fsync()By the commit
af7fa16 2010-08-03 NFS: Fix up the fsync code
close(2) became returning the non-zero value even if it went well.nfs_file_fsync()should return 0 when "status" is positive.Signed-off-by J. R. Okajima <[email protected]>fs/nfs/file.c +1
-1@@ -323,7 +323,7 @@ nfs_file_fsync(struct file *file, int datasync) have_error |=test_bit (NFS_CONTEXT_ERROR_WRITE , &ctx->flags);if (have_error) ret =xchg (&ctx->error,0 ); -if (!ret) +if (!ret && status <0 ) ret = status;return ret; }
Quoted 4 lines · Trond Myklebust
Quoted 4 lines
commit
e56f956a08a6227004cd9b7747df6a089dbb3594Author: J. R. Okajima <[email protected]> Date: Thu Aug 12 02:00:02 2010 +0900
Quoted 8 lines
Quoted 8 lines
NFS: fix the return value of
nfs_file_fsync()By the commit
af7fa16 2010-08-03 NFS: Fix up the fsync code
close(2) became returning the non-zero value even if it went well.nfs_file_fsync()should return 0 when "status" is positive.Signed-off-by J. R. Okajima <[email protected]>
Hi,
please can you send this patch to Linus' tree?
NFS is currently broken, so it will save time for people trying to bisect the problem.
It breaks even elementary operation on nfs mounts
# cat a > b cat: write error
Patch above from nfs-git fixed the problem for me
http://git.linux-nfs.org/?p=trondmy/nfs-2.6.git;a=commitdiff;h=0702099bd86c33c2dcdbd3963433a61f3f503901
Thanks,
Milan
--
[email protected]